-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Open
Description
I have playOnce animation with context:
playFrom = 0
playTo = 30
When I set the ColorValueProvider with currentFrame = 29.5..<30.0, the layer starts playing the full animation.
In my point of view, there should be trunc or floor. What do you think about it?
lottie-ios/Sources/Public/Animation/LottieAnimationLayer.swift
Lines 1379 to 1396 in 0f731ab
| // The animation should start playing from the `currentFrame`, | |
| // if `currentFrame` is included in the time range being played. | |
| let lowerBoundTime = min(animationContext.playFrom, animationContext.playTo) | |
| let upperBoundTime = max(animationContext.playFrom, animationContext.playTo) | |
| if (lowerBoundTime ..< upperBoundTime).contains(round(currentFrame)) { | |
| // We have to configure this differently depending on the loop mode: | |
| switch loopMode { | |
| // When playing exactly once (and not looping), we can just set the | |
| // `playFrom` time to be the `currentFrame`. Since the animation duration | |
| // is based on `playFrom` and `playTo`, this automatically truncates the | |
| // duration (so the animation stops playing at `playFrom`). | |
| // - Don't do this if the animation is already at that frame | |
| // (e.g. playing from 100% to 0% when the animation is already at 0%) | |
| // since that would cause the animation to not play at all. | |
| case .playOnce: | |
| if animationContext.playTo != currentFrame { | |
| animationContext.playFrom = currentFrame | |
| } |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels