Closed mattbroussard closed 7 months ago
https://github.com/tidbyt/community/pull/1652 is the applet I've been working on that employs the workaround above.
Saw this and created a PR to make a frame_count()
method available on widgets from within starlark. It delegates to the relevant Go FrameCount()
method. https://github.com/tidbyt/pixlet/pull/827
Addressed by #827
It's currently not possible as far as I can tell for Starlark code to tell programmatically how long an animation will be. This is not a problem for most basic animations where the number of frames is deterministic and could be computed manually by the developer, but some are dynamic: namely
Marquee
and any other widget that contains one.What I'm trying to do is have an applet that displays several pages of information using a
Sequence
, and each one contains aMarquee
with text dynamically generated according to an API response. The length of the animationMarquee
does can vary based on the text, from a single frame (if the text fits on screen) to any larger number depending on the length of the text. This makes it tough to ensure that each page is on screen long enough to read, because if the page is only a single frame, I want to duplicate it in theSequence
.My suggested fix would be either to 1) expose the
FrameCount
method that exists on the Go side from Starlark or 2) expose a new widget with a behavior like "min duration".For (2), I've been able to sort of hack this behavior using
animation.Transformation
andwait_for_child
, but this is pretty inelegant IMO and there should be a simpler primitive for this.