[~] Added a returnPlay property to MovieClip.#816
Open
B-Interactive wants to merge 3 commits into
Open
Conversation
… effect, play to the end, then play in reverse. I've tried to make it play nice with all other MovieClip methods.
Contributor
|
Thanks a lot for the pull request! |
Author
|
No worries Daniel, all that you're doing in Starling 2 is hugely David On 22 March 2016 at 23:07, Daniel Sperl [email protected] wrote:
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a feature I've put into a current project. When enabled, the clip will play to the end, then effectively play in reverse back to the start, in a back-forth way. I thought I'd see if it could be worked into the MovieClip class as a built in property.
In effect, it replicates the existing frames and adds them in reverse to the MovieClipFrames vector.
In handling things like numFrames and currentFrame, I've obscured the return value to only reflect the original clip. The reasoning is I thought it'd be easier for people to continue treating the clip as unchanged in length and framecount, it simply plays in reverse when it gets to the end.
I'm uncertain if currentTime should be obscured in the same way, my gut feeling is it should remain unobscured, so the full play time back and forth, is twice the normal play time.
When adding and removing frames to a clip, if returnPlay is active, the logic works like this:
if (returnPlay == true)
returnPlay = false: remove the mirrored frames
add or remove frames
returnPlay = true: re-mirror the frames
There's perhaps a more elegant way to do this rather than destroying and re-creating all the mirrored frames each time, but it's not something I anticipate needs to be done too frequently so I've left it for now.
Known quirks: The first and last frames of the clip are doubled. I'm not sure if this is an issue, or expected behaviour?