finscn / pixi.js

Super fast HTML 5 2D rendering engine that uses webGL with canvas fallback
MIT License
14 stars 0 forks source link

Question: Bind multiple Animations to a single sprite & switch between them? #5

Open CloverFeywilde opened 6 years ago

CloverFeywilde commented 6 years ago

Is this possible with your class that you've written? Currently Pixi doesn't have an easy way to have one sprite with different sets of frames for say, a walk animation, a punch animation, a run animation ect...

With your plugin, can I bind any set of frames I want to a single sprite, and choose at any given moment which I want to loop through?

finscn commented 6 years ago

Sorry, in the case about Bind multiple Animations to a single sprite & switch between them , my fork is as same as the original PIXI. There is no easier way to do it.

But I think it's not difficult at all.

CloverFeywilde commented 6 years ago

Not difficult? Do you know how I would do it then? Because nobody seems to have a very clear answer. :c

jonlepage commented 6 years ago

@bryanwillis7 I do not know if that can help you, but I put interest in pixi spriteAnimation. You can look my hold source code here. (m.i.t) https://forums.rpgmakerweb.com/index.php?threads/pixi-spritesheets-animations-core-v1-0-texturepacker.83083/ the file named: rmmvPixiSpriteAnimeCore.js

In my source code, I chose to create a class to manage the spriteSheets, and sub animation are called motions. However, I chose to switch to spine2d engine because you will maybe realize that spriteAniamtion does not allow to manage complex animation, and it also complexe to do it.

Personally, I only use it for special effects (FX) in games that require motionBlur and AfterEffect. Hope this can help you to find your approach to build a class. ps: you also have multiple video tutorial on how it work.

finscn commented 6 years ago

Do you try to use my animation class : https://github.com/finscn/pixi.js/blob/v4-plus/src/extensions/Animation.js ?

CloverFeywilde commented 6 years ago

@finscn No, but you just said it wouldn't work?

finscn commented 6 years ago

@bryanwillis7 , I didn't say any thing about extensions/Animation.js .
in the first repay , I talked about AnimationSprite . extensions/Animation.js could work.