Aseprite allows you to export a standard sprite sheet, and export timing information and tags to a JSON file. I'm loading that file in to create the animations and tags from - the data class is currently a container that holds the loaded set of animations, tags, and a reference to the pyglet Sprite itself.
In another engine, I also created functions that you could use to tell when you hit specific tags (for example, a "spawn" tag in a shooting animation) - that's what I'd like to add here, too, for simplicity and ease-of-use. I'll see about exposing this frame index to the data class I have so that the user can tell what frame the animation's on - perhaps also a function that gives a percentage completed. Being able to tweak the animation speed of a "currently running" animation is also important, so that's what I was looking into. Seems like it might be good to add a multiplication value to Animations so that it's easier to tweak speed, rather than having to loop through each frame and alter its duration (since that takes processor speed to do). Thanks for the information! On Thu, Jan 5, 2017 at 5:54 AM, Benjamin Moran <benmora...@gmail.com> wrote: > That sounds like an interesting project. What kind of format will your > data be in? > > The Sprite class does not currently have any public attributes that show > the animation details, but it *is* possible to access this information. > If you create a Sprite with an animation, it will have a private attribute > with the current frame (this attribute will not exist if the sprite uses a > static image): > >>> sprite = pyglet.sprite.Sprite(img=some_animation) > >>> sprite._frame_index > 0 > > As for animation speed: > If you're creating an animation from a sequence of images, or a sprite > sheet (ImageGrid), you can specify the animation speed on creation. > There is not currently a standard way of controlling animation speed after > creation, but there are some ways you could to it. The trick is that each > frame in an animation has it's own duration attribute. The Sprite class > simply plays these frames in order. One way to do it would be to simple > re-create the animation and update the sprites *image* attribue with the > new animation. Another way would be to iterate through the animations > frames, and modify their duration attribute. If you post a little more > about what you're trying to accomplish, it would be easier to recommend > something. > > -Ben > > > > On Thursday, January 5, 2017 at 7:15:37 PM UTC+9, Solar Lune wrote: >> >> Hey, there. So, I'm doing work on creating a quick little Python module >> to auto-load tags and animations in from Aseprite into pyglet, but before I >> go further, I wanted to confirm: Is there no way to control how quickly a >> sprite is playing, or know where in the animation a sprite is (apart from >> when it hits the end of the animation)? >> > -- > You received this message because you are subscribed to a topic in the > Google Groups "pyglet-users" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/pyglet-users/3Pp3VHtoAto/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > pyglet-users+unsubscr...@googlegroups.com. > To post to this group, send email to pyglet-users@googlegroups.com. > Visit this group at https://groups.google.com/group/pyglet-users. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscr...@googlegroups.com. To post to this group, send email to pyglet-users@googlegroups.com. Visit this group at https://groups.google.com/group/pyglet-users. For more options, visit https://groups.google.com/d/optout.