Repository navigation
Expand file tree
/
Copy pathMotionGuideBlitz.html
More file actions
72 lines (55 loc) · 1.8 KB
/
Copy pathMotionGuideBlitz.html
File metadata and controls
72 lines (55 loc) · 1.8 KB
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
<!DOCTYPE html>
<html>
<head>
<title>TweenJS: Simple Tween Demo</title>
<link href="../_assets/css/shared.css" rel="stylesheet" type="text/css"/>
<link href="../_assets/css/examples.css" rel="stylesheet" type="text/css"/>
<link href="../_assets/css/tweenjs.css" rel="stylesheet" type="text/css"/>
<script src="../_assets/js/examples.js" type="text/javascript"></script>
<script type="text/javascript" src="../_assets/libs/easeljs-NEXT.min.js"></script>
<script type="text/javascript" src="../lib/tweenjs-NEXT.combined.js"></script>
<!-- We also provide hosted minified versions of all CreateJS libraries.
http://code.createjs.com -->
<script id="editable">
var canvas;
var stage;
function init() {
createjs.MotionGuidePlugin.install(createjs.Tween);
canvas = document.getElementById("testCanvas");
stage = new createjs.Stage(canvas);
stage.autoClear = true;
var ball;
var count = 1000;
while (count--) {
ball = new createjs.Shape();
ball.graphics.ss(1, 'round', 'round').s(('#000000')).f("#" + rc() + rc() + rc()).dc(0, 0, 5).ef().es();
var path = [rx(), ry(), rx(), ry(), rx(), ry()];
createjs.Tween.get(ball, {loop: true})
.to({guide: {path: path, start: 0, end: 1}}, 5000)
.wait(Math.random() * 4000)
.to({guide: {path: path, start: 1, end: 0}}, 5000);
stage.addChild(ball);
}
createjs.Ticker.addEventListener("tick", stage);
}
function rx() {
return Math.random() * 940 + 10;
}
function ry() {
return Math.random() * 380 + 10;
}
function rc() {
return Math.round(Math.random() * 0xED + 0x12).toString(16);
}
</script>
</head>
<body onload="init();">
<div>
<header class="EaselJS">
<h1>Simple Tween Demo</h1>
<p>This example shows TweenJS in action.</p>
</header>
<canvas id="testCanvas" width="960" height="400"></canvas>
</div>
</body>
</html>