Repository navigation
Add an Animation tab for the Watch Pro 2's animated image (0x82, type 2) - #122
Merged
freethinkel merged 5 commits intoNov 29, 2026
Merged
Conversation
The editor kept these layers byte for byte but treated them as plain images. Decode the 0x5c body into a typed view (duration, start/end angle; the fields whose meaning isn't known stay raw, named by offset) with an encoder that reproduces the stock bytes, and edit it through a pure withAnim edit. - Animation tab in the right panel: the layer list, a timeline that plays or scrubs on its own clock, and the effect fields. - Preview: one geometry function (render/anim.ts) places the image by value and replays the wake sweep; the simulator can wake the screen, and a time, sunrise or sunset change replays it too. - "Animated layer" in the add menu, seeded with Sun Circle's exact body. - Selecting a layer no longer leaves the Animation tab. compat.ts and assertWatchCompat are untouched; types 0..3 were already allowed on a Pro 2. The geometry is a model that fits Sun Circle, to be checked on a watch. Sun Circle AOD is added as a round-trip fixture. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The preview now computes the position the firmware does (app_073.bin, 0x1004BAE0): a float32 angle, two branches with their own base angle (180 and 270), the constant 3.14, truncation toward zero and 16-bit wrap. An angle the watch ignores leaves the image where it was. The wake sweep starts at the start angle and walks linearly to the value-scaled end, as the firmware's timer does. orbitAt is tested against every row of the firmware's own output (1800 angles at R = 3817 and 181 at R = 1900), with no tolerance. Also: off 16 and 18 are signed; the Animation panel points out values the firmware is known to handle badly (duration under 18 ms, flags other than 0x88/0x89, angles outside 180..360 degrees, a radius outside 0..8000 px). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The timer callback does not round the step angle to whole tenths: it computes ((float)((end - start) * k) / (float)N + (float)start) / 10 in float32 and hands that fractional degree to the position function. Doing the same makes the preview's sweep agree with the firmware on every step; truncating to tenths was off on about 100 of Sun Circle's 110. orbitAt is split into orbitAtDeg (a float angle) and orbitAt (tenths). Both sweep outputs of the firmware's timer callback (value 50 and 100, 125 callbacks each) are fixtures and are compared exactly. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
Author
|
I am still working on the capability of animated watch faces like sun circle, I will let you once my research and working is done |
The Animation tab now offers ten ready-made effects for the Watch Pro 2's animated image (type 2), grouped as Slide and Arc, each with a thumbnail and a motion-path preview. Sun Circle's rise and set are the proven bytes; the others change only values the firmware reads (angles, radius, offset, duration) and are labelled as not yet tried on a watch. The simple controls (direction, speed, angles, repeat, reset) write only inside ANIM_LIMITS, and the raw fields are folded under "advanced". The widget type word is always 2, so no edit can reach the types the Pro 2 boot-loops on; compat.ts and assertWatchCompat are untouched. Tests cover the preset bytes, the firmware positions of the arcs, and 200 fuzzed bodies through assertWatchCompat. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- A new animated layer's blank frame is cf 5: cf 4 has no alpha, so it was an opaque black disc over the whole screen. - The timeline runs to animEndMs (start delay + every step), not to the duration, so its end is where the motion rests. - The phone's sheet lets go of the scrub when the tab unmounts. - Animation edits go through withAnim + committed: a no-op keeps its undo step, and a locked layer is refused (and shown disabled, as in Props). - Source 0 ignores the timeline's value, as the watch does; the value slider shows the source's value and hides for source 0. - The path preview's stroke is a fixed 2px. - The tab's layer list and current layer live in sim.model. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The Watch Pro 2 (stock 1.0.0.73) already plays the animated image widget
(tag 0x82, type 2), but the editor treated types 0..3 as plain images and
only kept their bytes. This adds editing and preview for it.
proc.ts): duration, start/end angle,and the other fields, named by offset (
raw4..raw18,flags,tail)and labelled "raw" in the UI.
encodeAnimreproduces the stock bytes.scrubs on its own clock, and the effect fields. Selecting a layer no longer
leaves this tab.
render/anim.ts): the position math is a port of the firmware'sfunction, and the wake sweep follows its timer. The simulator can wake the
screen; changing the time, sunrise or sunset replays it.
warns; nothing is blocked.
compat.tsandassertWatchCompatare untouched: types 0..3 are alreadyallowed on a Pro 2.
What is known, and how
The position math was read from the stock app firmware (
app_073.bin,function at 0x1004BAE0) and checked against the firmware's own code run in an
emulator.
orbitAtis tested against every row of that output (1800 angles atR = 3817, 181 at R = 1900) with no tolerance. Its details: a float32
angle, two branches with their own base angle (180 and 270), the constant
3.14, truncation toward zero and 16-bit wrap. The sweep follows the firmware's
timer callback (0x100DF2EC): the step angle is a fractional float32, and both
of its emulated outputs (value 50 and 100, 125 callbacks each) are compared
step by step, also with no tolerance.
Confirmed on a watch (Sun Circle): the sun and moon sweep in on wake over
about 2 s and stop where daylight % / night % put them, bottom to top.
Still inferred, so please read the labels accordingly:
the sweep is one step per callback and a watch showed about 2 s for a
duration of 2000, so the preview assumes one step per 18 ms. The display
service that drives the timer was not traced.
was traced in orbit mode).
Tests that change one field each on a real watch are planned.
Testing
tests/doc-anim.test.ts: the stock body round-trips, edits change only thefield named, the factory layer equals the stock layer,
orbitAtmatches thefirmware's CSV output exactly, and the sweep and warnings behave as described.
pnpm check,pnpm lintandpnpm format:checkclean; unit tests pass apartfrom
tests/typography.test.ts, which fails on Windows because itsallowlist uses
/paths (unrelated to this change).CI will run them.
add layer); nothing was flashed to a watch.
🤖 Generated with Claude Code