-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwiggle.html
73 lines (55 loc) · 1.69 KB
/
wiggle.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Beach Wiggle Example</title>
<link href="assets/demoStyles.css" rel="stylesheet" type="text/css" />
<script src="http://code.createjs.com/easeljs-0.4.2.min.js"></script>
<script src="./js/parseUri.js"></script>
<script type="text/javascript">
function init() {
// create a new stage and point it at our canvas:
var stage = new Stage(document.getElementById("testCanvas"));
var imagefile = parseUri(window.location.href).queryKey.file;
var sourcefile = parseUri(window.location.href).queryKey.source;
var width = parseUri(window.location.href).queryKey.width;
var height = parseUri(window.location.href).queryKey.height;
var frames = parseUri(window.location.href).queryKey.frames;
document.getElementById("source").src=sourcefile;
var ss = new SpriteSheet({
"frames": {
"width": width,
"numFrames": frames,
"height": height
},
"animations": {"run": [0, frames-1]},
"images": [imagefile]
});
var wiggle = new BitmapAnimation(ss);
wiggle.x = 0;
wiggle.y = 0;
ss.getAnimation("run").frequency = 1;
ss.getAnimation("run").next = "run";
wiggle.gotoAndPlay("run");
stage.addChild(wiggle);
Ticker.setFPS(60);
Ticker.addListener(stage);
}
</script>
<style type="text/css">
body {
background-color:
}
</style>
</head>
<body onload="init();">
<h3>Source file</h3>
<img id="source" src="assets/DSCF0640.LR.jpg" width="600" alt="">
<br/>
<br/>
<h3>Animation</h3>
<div class="canvasHolder">
<canvas id="testCanvas" width="1024" height="1024"></canvas>
</div>
</body>
</html>