-
Notifications
You must be signed in to change notification settings - Fork 15
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
feat: add repeat-from animation mode #40
Conversation
sounds good to me, thanks for the contribution 👍
indeed, it is not a breaking change.
Yeah, I made the mistake of making it public even though that wasn't needed. But we can go for the solution you suggest without making a breaking change. here is how:
You may do that in a different PR if you wish. Or you may do it here, as you prefer. Let me know if you don't have time or don't want to do that refactoring, in that case, I'll merge as-is and refactor myself later. |
631485d
to
c3ed369
Compare
@jcornaz Ok, great, didn't want to go hacking on your codebase before checking with you on the design! Just push-forced a commit that does the refactor you described---the old changes didn't really make sense as the first commit so I replaced the commit instead. I can have a go at splitting up into two commits instead: refactor first, add RepeatFrom second, but it's a bit of a faff and weren't sure if you cared enough. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me thanks!
Adds
AnimationMode::RepeatFrom(index)
which repeats from a given index rather than going all the way back to zero. This super handy for simple animations like e.g. a torch being lit then staying lit, or a missile lighting up its motor and then looping.Because
AnimationMode
isnon_exhaustive
I believe this is not a breaking change.I considered getting rid of
AnimiationMode::Repeat
and usingAnimation::RepeatFrom(0)
infn repeat(self)
, but we can't do this without a breaking change.I was wondering, why even expose the
AnimationMode
enum? It looks to me like it's not actually returned or taken as argument by any APIs. Could it be private to the crate? It would make it easier to make changes like this, which generalise an existing animation mode without it being a breaking change.