cocos2dx之动作Action

前端之家收集整理的这篇文章主要介绍了cocos2dx之动作Action前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

版本 cocos2dx 2.2.5

--淡入淡出
	local function FadeInOut(sec)
		local fadein = CCFadeIn:create(sec)
		local fadeout = CCFadeOut:create(sec)
		local sequence = CCSequence:createWithTwoActions(fadein,fadeout)
		return sequence
	end
调用
fadeinout = FadeInOut(2)
		bg:runAction(CCRepeatForever:create(fadeinout))

bg是CCSprite对象


--旋转并放大
		rot = CCRotateBy:create(1,360)		
		scale = CCScaleTo:create(1.0,2.0)
		seq = CCSequence:createWithTwoActions(rot,scale)
		zhuque:runAction(seq)

边旋转边放大

rot = CCRotateBy:create(1,2.0)
		ary = CCArray:create()
		ary:addObject(rot)
		ary:addObject(scale)
		--seq = CCSequence:createWithTwoActions(rot,scale)		
		--jump = CCJumpBy:create(3,ccp(0,0),100,4)		
		--skewTo = CCSkewTo:create(2,40,0)
		--skewTo2 = CCSkewTo:create(2,40)
		spawn = CCSpawn:create(ary)
		--move = CCMoveTo:create(0.5,ccp(300,hpos))
		
		zhuque:runAction(spawn)
原文链接:https://www.f2er.com/cocos2dx/347122.html

猜你在找的Cocos2d-x相关文章