Revert centered zoom; Scale+Translate causes a periodic rendering pop
Combining animation.Scale with animation.Translate to center the zoom (two commits back) visually fixed the top-left crop bias, but introduced a worse problem: pixlet periodically re-rasterizes the whole image with a visible "pop" roughly every 0.7-1s, confirmed with both WebP and GIF output and independent of zoom amplitude -- a property of pixlet's animation engine when Scale and Translate are combined, not something fixable from this app's math. Scale alone, with no Translate, has none of this popping (confirmed via isolated testing). Reverted _art_widget to Scale-only (as it was before centering), and restored ZOOM_LEVELS["strong"] to 1.7 (the strong-zoom black border only applied to the Translate-based centering, not plain Scale). This brings back the original top-left crop bias as a known, accepted cosmetic trade-off -- better than a periodic visible pop. Updated the README and dev/calibration_test.star to match and documented the full history for anyone who wants to revisit centering later.
This commit is contained in:
1 parent
5f42319e26
commit
9f63adbfbf
3 files changed
+79
-77
No files matched your search
+17
-10
@@ -1,15 +1,11 @@
|
||||
"""
|
||||
Dev tool, not part of the deployed app: renders dev/calibration.png through
|
||||
the exact same zoom logic as _art_widget in subwave_nowplaying.star, so you
|
||||
can visually check how much margin gets cropped at rest and at full zoom,
|
||||
and whether the crop is even on all sides.
|
||||
can visually check how much margin gets cropped at rest and at full zoom.
|
||||
|
||||
calibration.png is a 360x360 grid: concentric 10%-wide color rings (magenta
|
||||
outermost, then yellow, then cyan) plus four corner markers (red TL, green
|
||||
TR, blue BL, white BR) and a center crosshair. At rest, you should see a
|
||||
thin, EVEN sliver of magenta on all four edges. As it zooms in, each corner
|
||||
marker should get clipped by the same amount -- if one side/corner loses
|
||||
noticeably more than the others, the zoom isn't centered.
|
||||
TR, blue BL, white BR) and a center crosshair.
|
||||
|
||||
Usage:
|
||||
pixlet render dev/calibration_test.star -o calib.gif
|
||||
@@ -17,6 +13,18 @@ Usage:
|
||||
|
||||
Keep ART_SIZE/ART_SLOT/the zoom math below in sync with the real
|
||||
_art_widget if that ever changes.
|
||||
|
||||
Note: a centered (Scale + Translate) version of this zoom was tried and
|
||||
visually fixed the top-left crop bias below, but combining Scale with
|
||||
Translate causes pixlet to periodically re-rasterize the whole image with
|
||||
a visible "pop" -- confirmed with both WebP and GIF output, independent of
|
||||
zoom amplitude, so it's pixlet's animation engine, not app-level math. This
|
||||
tool (and the real app) stick to Scale alone -- a real but minor crop-bias
|
||||
cosmetic issue, instead of the pop a centered zoom introduces. If you want
|
||||
to re-investigate centering, add animation.Translate back in here first
|
||||
and compare frame-to-frame pixel deltas (see git history around the
|
||||
"Center the album art zoom" / "Revert jerky zoom fix" commits) before
|
||||
touching the real app.
|
||||
"""
|
||||
|
||||
load("render.star", "render")
|
||||
@@ -30,14 +38,13 @@ ART_ZOOM_DURATION = 200
|
||||
def _art_widget(art_bytes, zoom_scale):
|
||||
art = render.Image(src = art_bytes, width = ART_SIZE, height = ART_SIZE)
|
||||
top_scale = max(zoom_scale, 1.0)
|
||||
shift = (1.0 - top_scale) * (ART_SIZE / 2.0)
|
||||
zoom = animation.Transformation(
|
||||
child = art,
|
||||
duration = ART_ZOOM_DURATION,
|
||||
keyframes = [
|
||||
animation.Keyframe(percentage = 0.0, transforms = [animation.Scale(1.0, 1.0), animation.Translate(0, 0)]),
|
||||
animation.Keyframe(percentage = 0.5, transforms = [animation.Scale(top_scale, top_scale), animation.Translate(shift, shift)], curve = "ease_in_out"),
|
||||
animation.Keyframe(percentage = 1.0, transforms = [animation.Scale(1.0, 1.0), animation.Translate(0, 0)], curve = "ease_in_out"),
|
||||
animation.Keyframe(percentage = 0.0, transforms = [animation.Scale(1.0, 1.0)]),
|
||||
animation.Keyframe(percentage = 0.5, transforms = [animation.Scale(top_scale, top_scale)], curve = "ease_in_out"),
|
||||
animation.Keyframe(percentage = 1.0, transforms = [animation.Scale(1.0, 1.0)], curve = "ease_in_out"),
|
||||
],
|
||||
)
|
||||
return render.Box(width = ART_SLOT, height = ART_SLOT, child = zoom)
|
||||
|
||||