-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete_object.html
More file actions
41 lines (33 loc) · 1.13 KB
/
delete_object.html
File metadata and controls
41 lines (33 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
<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();
stage.addChild(container);
var circleRed = new createjs.Shape();
circleRed.graphics.beginFill("DarkRed").drawCircle(40, 40, 40);
var circleGreen = new createjs.Shape();
circleGreen.graphics.beginFill("green").drawCircle(120, 40, 40);
container.addChild(circleRed);
container.addChild(circleGreen);
circleRed.addEventListener("click", handleRedClick);
circleGreen.addEventListener("click", handleGreenClick);
function handleRedClick(event){
container.removeChild(circleRed);
}
function handleGreenClick(event){
container.removeChild(circleGreen);
}
createjs.Ticker.addEventListener("tick", stage);
}
</script>
</head>
<body>
<canvas id="myCanvas" width="1000" height="1000"></canvas>
</body>
</html>