-
Notifications
You must be signed in to change notification settings - Fork 2k
/
Copy pathGraphics_simple.html
executable file
·72 lines (55 loc) · 1.5 KB
/
Graphics_simple.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>EaselJS: Simple Graphics Example</title>
<link href="../_assets/css/shared.css" rel="stylesheet" type="text/css"/>
<link href="../_assets/css/examples.css" rel="stylesheet" type="text/css"/>
<script src="../_assets/js/examples.js"></script>
<script src="../lib/easeljs-NEXT.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() {
canvas = document.getElementById('myCanvas');
width = canvas.width;
height = canvas.height;
stage = new createjs.Stage(canvas);
var s = drawSmiley();
s.x = canvas.width / 2;
s.y = canvas.height / 2;
stage.addChild(s);
stage.update();
}
function drawSmiley() {
var s = new createjs.Shape();
var g = s.graphics;
//Head
g.setStrokeStyle(10, 'round', 'round');
g.beginStroke("#000");
g.beginFill("#FC0");
g.drawCircle(0, 0, 100); //55,53
//Mouth
g.beginFill(); // no fill
g.arc(0, 0, 60, 0, Math.PI);
//Right eye
g.beginStroke(); // no stroke
g.beginFill("#000");
g.drawCircle(-30, -30, 15);
//Left eye
g.drawCircle(30, -30, 15);
return s;
}
</script>
</head>
<body onload="init()">
<header class="EaselJS">
<h1>Vector Graphics</h1>
<p>This example draws a simple vector smiley face using <code>Shape</code>
and <code>Graphics</code>.</p>
</header>
<canvas id="myCanvas" width="960" height="400"></canvas>
</body>
</html>