Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request framePerSecond attribute for every animation #3

Closed
pixelpicosean opened this issue Feb 26, 2013 · 3 comments
Closed

Request framePerSecond attribute for every animation #3

pixelpicosean opened this issue Feb 26, 2013 · 3 comments

Comments

@pixelpicosean
Copy link

Currently every SpriteSheet has only one framePerSecond attribute, which forces sprite assets to have the same interval. One fps per animation is REALLY useful so that I'll not have to change assets every time when I want to change some animation's speed (just like sprite animation of flixel).

@endel
Copy link
Owner

endel commented Mar 2, 2013

Good one @pixelpicosean :)

I've just created SpriteAnimation to control framesPerSecond, allowing you to configure SpriteSheets like this:

var sheet = new Joy.SpriteSheet({
  src: "spritesheet.png",
  framesPerSecond: 12, // optional, 24 by default
  width: 120,
  height: 120,
  animations: {
    "walking": { frames: [0, 30], framesPerSecond: 32 },
    "idle": { frames: [31, 39], framesPerSecond: 24 },
    "jumping": [40, 59] // framesPerSecond is optional, will be 12 here
  }
});

What do you think?

OBS: It would be awesome to have "reverse" and non-linear frame support on SpriteAnimation too.

@pixelpicosean
Copy link
Author

Wow, that looks amazing. Does non-linear mean configuring different time between every 2 frames or using a tween to control the anmiation? Sounds cool!

@endel
Copy link
Owner

endel commented Mar 12, 2013

@pixelpicosean I didn't mean that, but really sounds cool what you said. :)
with non-linear I mean using frames without a sequence, like: [1,2,1,3]. Actually it's supporting only frame ranges, like: [1,4] = 1,2,3,4

(I've closed this pull request, but feel free to open it again if you have some trouble)

@endel endel closed this as completed Mar 12, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants