MLP206: Literal play duration shorter than one frame¶
qual reports MLP206 when a Scene.play / Scene.wait call has a
literal positive duration that is provably shorter than one frame period at
every analyzed profile's frame rate.
The frame grid is np.arange(0, run_time, 1/frame_rate): a run time below
one frame period still renders exactly one frame, sampled at t = 0 — the
video shows a single frame near the animation's start state.
Animation.finish() afterwards moves the live geometry to its final state
but writes no additional video frame, so the intended motion (and its end
state) never appears on screen, while the whole per-play startup (argument
compile, hash, begin copies, cleanup, partial stream) is paid for that
single frame of output.
- Default severity:
warning - Minimum confidence:
certain - Implementation phase:
3 - Fix: none
Zero and negative literal durations are a runtime ValueError and belong
to MLC104, not this rule. A duration that is not a literal at the call
site (a variable, a computed value) stays silent — the clamp is only
reported when it is provable.
Wrong¶
class Demo(Scene):
def construct(self):
square = Square()
self.play(FadeIn(square), run_time=0.004) # < 1/60 s at 60 fps