-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyFirstAppScene.js
More file actions
44 lines (35 loc) · 1.14 KB
/
MyFirstAppScene.js
File metadata and controls
44 lines (35 loc) · 1.14 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
var MyFirstApp = cc.Layer.extend({
init:function()
{
this._super();
var s = cc.Director.getInstance().getWinSize();
var layer1 = cc.LayerColor.create(new cc.Color4B(255, 255, 0, 255), 600, 600);
layer1.setAnchorPoint(new cc.Point(0.5,0.5));
var helloLabel = cc.LabelTTF.create("Hello world", "Arial", 30);
helloLabel.setPosition(new cc.Point(s.width/2,s.height/2));
helloLabel.setColor(new cc.Color3B(255,0,0));
var rotationAmount = 0;
var scale = 1;
helloLabel.schedule(function()
{
this.setRotation(rotationAmount++);
if(rotationAmount > 360)
rotationAmount = 0;
this.setScale(scale);
scale+= 0.05;
if(scale > 10)
scale =1;
});
layer1.addChild(helloLabel);
this.addChild(layer1);
return true;
}
});
var MyFirstAppScene = cc.Scene.extend({
onEnter:function(){
this._super();
var layer = new MyFirstApp();
layer.init();
this.addChild(layer);
}
})