-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
58 lines (49 loc) · 1.01 KB
/
main.js
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
/**
@title{helloworld}
@description
初始化colorbox库,得到colorbox句柄。
*/
var colorbox = initColorbox();
/**
@description
创建一个500*500的@class[Stage]{舞台}。
@bold{舞台负责管理了舞台上所有精灵的结构组织、渲染以及交互。}
*/
var myStage = colorbox.Stage.create({
width:500,
height:500
});
/**
@description
创建hello world @class[Text]{文本精灵},并且设置其相关属性。
*/
var text = colorbox.Text.create({
text:"hello world!!!",
fillStyle:{r: 0, g: 0, b: 255},
font:{
size:30
},
x:200,
y:200
});
/**
@description
将hello world文本精灵加入到舞台上。
@bold{精灵只有被加入到舞台才能被显示出来。}
*/
myStage.add(text);
/**
@description
创建@class[Circle]{圆形精灵},并且设置其相关属性。
*/
var circle = colorbox.Circle.create({
radius:30,
fillStyle:{r: 255, g: 0, b: 0},
x:300,
y:300
});
/**
@description
将圆形精灵加入到舞台上。
*/
myStage.add(circle);