Created
February 26, 2015 06:43
-
-
Save vkgtaro/952210d80130b50452d4 to your computer and use it in GitHub Desktop.
cocos2d-js のアニメーションを動かす / 反転させる ref: http://qiita.com/vkgtaro/items/f75b60b489803fb205d4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var animation = cc.AnimationCache.getInstance().getAnimation('animation_name'); | |
animation.setRestoreOriginalFrame(true); | |
var animation_sprite = cc.Sprite.create( image_path, cc.rect(0, 0, width, height) ); | |
animation_sprite.setPosition(220, 240); | |
layer.addChild(anime_sprite, 300); | |
animation_sprite.runAction( cc.RepeatForever.create( cc.Animate.create(animation)) ); | |
animation_sprite.runAction( cc.MoveBy.create(10, cc.p(200,100) ) ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var animation_sprite2 = cc.Sprite.create( image_path, cc.rect(0, 0, width, height) ); | |
animation_sprite2.setPosition(420, 240); | |
animation_sprite2.setScale(-1); | |
this.addChild(animation_sprite2, 300); | |
animation_sprite2.runAction( cc.RepeatForever.create( cc.Animate.create(animation)) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment