-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshapes.html
More file actions
44 lines (37 loc) · 1.7 KB
/
shapes.html
File metadata and controls
44 lines (37 loc) · 1.7 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
<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 shape = new createjs.Shape();
shape.graphics.beginFill("DarkRed"); // 赤色で描画するように設定
shape.graphics.drawRect(0, 0, 200, 100); // 長方形を描画
stage.addChild(shape); // 表示リストに追加
var shape = new createjs.Shape();
shape.graphics.beginFill("DarkRed"); // 赤色で描画するように設定
shape.graphics.drawRoundRect(0, 110, 100, 100, 20, 20); //100pxの正方形を描画。20pxの角丸を設定。
stage.addChild(shape); // 表示リストに追加
var poly = new createjs.Shape();
poly.graphics.beginFill("DarkRed"); // 赤色で描画するように設定
poly.graphics.drawPolyStar(75, 295, 75, 5, 0.6, -90); //75pxの星を記述
stage.addChild(poly); // 表示リストに追加
var obj = new createjs.Shape();
obj.graphics.beginFill("DarkRed"); // 赤色で描画するように設定
obj.graphics.moveTo(0, 360); // (0,0)座標から描き始める
obj.graphics.lineTo(100, 360); // (100,0)座標まで辺を描く
obj.graphics.lineTo(0, 460); // (0,100)座標まで辺を描く
obj.graphics.lineTo(0, 460); // (0,0)座標まで辺を描く
stage.addChild(obj); // 表示リストに追加
// Stageの描画を更新します
stage.update();
}
</script>
</head>
<body>
<canvas id="myCanvas" width="1000" height="1000"></canvas>
</body>
</html>