Add FrameStart/FrameEnd range control and read-only frame properties to SKLottieView#351
Add FrameStart/FrameEnd range control and read-only frame properties to SKLottieView#351
Conversation
|
@copilot i think the goal is to also animate to a position. So actually play. Can you think of a good way to do this. |
…eView Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
Added // Toggle switch: animates forward on open, backward on close
lottieView.PlayToFrame(isOn ? lottieView.FrameCount - 1 : 0);
// Animate to the 50% position
lottieView.PlayToProgress(0.5);
// Animate to a specific time
lottieView.PlayToTime(TimeSpan.FromSeconds(1.5));Key design choices:
The sample app also has "Play→0%", "Play→50%", "Play→100%" buttons to demonstrate the animated seeking. |
…eView Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
…rameStart/FrameEnd properties Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
|
@copilot please remove the methods. Please just add the framestart and frameend. We just want to props to control the segment. This needs to be respected in both directions of playback. Instead of 0 and count, it is now start and end. |
Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
Done in commit // Multi-state animation: restrict to a frame sub-range
lottieView.FrameStart = 0; lottieView.FrameEnd = 30; // forward: plays 0→29
lottieView.FrameStart = 30; lottieView.FrameEnd = -1; // forward: plays 30→end
// AnimationSpeed = -1 reverses direction within the same range
|
SKLottieViewhad no programmatic playback control beyond settingProgressdirectly, making stateful animations (toggle switches, multi-state icons) require polling hacks.New read-only bindable properties
Fps— animation frame rateFrameCount— frames in the active rangeCurrentFrame— current frame, zero-based within the active range, updated every frameFrame range control:
FrameStart/FrameEndTwo settable
BindablePropertyintegers that restrict playback to a sub-range of the InPoint→OutPoint span.Duration,FrameCount,Progress, andCurrentFrameoperate transparently within the active range. Respected in both forward and reverse playback directions.FrameStart0FrameEnd-1-1= OutPoint, same convention asRepeatCount = -1)Values are clamped on assignment and persist across source changes (clamped to the new animation's frame count). XAML two-way binding works directly.
Other
FrameStart/FrameEndfurther sub-clip that range💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.