You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add Lottie/Bodymovin support to the build-time SVG transcoder (#5066)
* Add Lottie/Bodymovin support to the build-time SVG transcoder
Lottie / Bodymovin JSON (.json, .lottie) files flow through the same
build-time pipeline as SVG: each source file is lowered into the
existing SVGDocument model, the SVG JavaCodeGenerator emits the
GeneratedSVGImage subclass, and the same SVGRegistry registers it
under its source filename. No new Image base class, no new registry,
no per-port wiring -- the SVG path's JavaSE reflective load and the
iOS / Android Stub weaving already cover the new format.
New maven/lottie-transcoder/ module parses Bodymovin JSON with no
external deps (built-in JSON parser): shape layers with grouped
rectangle / ellipse / bezier path primitives, solid fills and strokes,
layer transforms (anchor / position / scale / rotation / opacity),
and animated rotation / position / scale collapsed to a 2-keyframe
loop. Solid-color layers (ty:1) lower to a filled rect.
TranscodeSVGMojo now scans src/main/{svg,lottie,css}/ for
.svg / .json / .lottie and dispatches each file to the right
transcoder. Resources.registerGeneratedImage strips any extension
(not just .svg) so getImage("home") resolves regardless of source
format.
Hellocodenameone picks up sample lottie_spinner.json and
lottie_pulse.json (proper Bodymovin exports -- open and play in
lottieeditor.app) plus LottieAnimatedScreenshotTest registered next
to the SVG screenshot tests, with the same HTML5 skip list.
docs/developer-guide/SVG-Transcoder.asciidoc gains a Lottie section
with the feature matrix and troubleshooting. The initializr skill's
references/css.md picks up the same material so generated projects'
Claude Code skill stays accurate.
Lottie test coverage (17 cases):
- animated translate / scale / rotation
- bezier path "sh" shape with closed cycle
- multi-shape fill propagation within a single gr group
- stroke color + width extraction from "st"
- multi-layer paint order (Lottie back-to-front -> SVG front-to-back)
- solid-color layer (ty:1) lowered to a filled rect
- unsupported layer type producing an empty group
- opacity below 100% baked into the layer style as a 0..1 fraction
- RGBA 0..1 -> ARGB int normalization with edge values
- ellipse codegen path through gr/tr wrapping
- missing top-level dimensions fall back to 100x100
- static-only layers don't emit any animation entries
- realistic Bodymovin export (3D vectors, ix indices, gr/tr wrapping)
- JSON parser primitives
- transcodesToCompilableJava round-trip
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Add LottieAnimatedScreenshotTest goldens for iOS, iOS-Metal, and Android
Captured from the first CI run that included the new test. Android and
iOS-Metal both show the expected animation: red rotating spinner and
blue pulsing ellipse across the six progress samples (0%, 20%, 40%,
60%, 80%, 100%) the AbstractAnimationScreenshotTest grid renders.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments