-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhierarchy_move_x.html
More file actions
49 lines (39 loc) · 1.13 KB
/
hierarchy_move_x.html
File metadata and controls
49 lines (39 loc) · 1.13 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
<html>
<head>
<meta charset="utf-8" />
<script src="https://code.createjs.com/1.0.0/createjs.min.js"></script>
<script>
window.addEventListener("load", init);
function init() {
// Stageオブジェクトを作成します
var stage = new createjs.Stage("myCanvas");
var container = new createjs.Container();
container.x = 0;
container.y = 0;
stage.addChild(container);
var circle1 = new createjs.Shape();
circle1.graphics.beginFill("DarkRed").drawCircle(0, 0, 50);
circle1.x = 100;
circle1.y = 100;
var circle2 = new createjs.Shape();
circle2.graphics.beginFill("Blue").drawCircle(0, 0, 50);
circle2.x = 100;
circle2.y = 300;
container.addChild(circle1);
container.addChild(circle2);
stage.update();
createjs.Ticker.addEventListener("tick", handleTick);
function handleTick() {
container.x += 1;
if (container.x > 960) {
container.x = 0;
}
stage.update();
}
}
</script>
</head>
<body>
<canvas id="myCanvas" width="1000" height="1000"></canvas>
</body>
</html>