Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
themeEmacs
var img2 = cocoApp.addImage('assets/ball1.png', 120,100, false);
img2.seqTo([
	{x:100,y:122,duration:0.3,angle:5 },
	{x:250,y:50,duration:0.3,angle:45 },
	{x:300,y:300,duration:0.3,angle:90 ,opacity:50,scale:0.5}
]);

...

Code Block
languagejs
themeEmacs
for(var i=0 ; i< 10 ; i++){
	_demoRefCount++;
	var frogAni = new SpriteAnimation({fileName:"assets/ani/flog/frogy",width:700,height:1000,frameCount:15,scale:0.3,repeat:false ,oneDelay:0.03 * (i+1) });
	frogAni.position.x=70 * i;
	frogAni.position.y=150;
	cocoApp.addChild(frogAni,"frog"+ _demoRefCount );
	frogAni.play();
}

가장 고전적이고 , 2D애니메이션에 여전히 활용이되고있는

여러장의 이미지를 넘기는 방식입니다.

...

Code Block
languagejs
themeEmacs
var canvasWidth=600;
var canvasHeight=480;
for(var i=0;i<100;i++){
	var ballImg = cocoApp.addImage('assets/greencircle.png',0,-10,false);
	ballImg.position.x = Math.round(Math.random() * canvasWidth );
	ballImg.position.y = Math.round(Math.random() * canvasHeight );
	ballImg.drift = Math.random();
	ballImg.speed = Math.round(Math.random() * 5) + 1;
	ballImg.addSchedule({method:function(){
	this.speed = Math.round(Math.random() * 3) + 1;
	if(this.position.y <= canvasHeight){
	this.position.y = this.position.y+this.speed;
	if(this.position.y > canvasHeight){
		this.position.y = -5;
	}
	this.position.x+=this.drift;
	if(this.position.x > canvasWidth){
		this.position.x=0
	}
}
	},target:ballImg,interval:0,paused:false});
}

...