nx_animation_timeline.nx
buildroot/runtime/nx_animation_timeline.nx
about
nx_animation_timeline.nx -- keyframe animation primitive.
Holds N (ts_us, value_q14) keyframes; samples a value at any
timestamp via linear interpolation between adjacent keyframes.
Pre-first-keyframe samples return the first value; post-last
samples return the last (no extrapolation). Composes with all
game-render primitives that need time-varying values.
V1 ships:
- struct NxKeyframe + NxTimeline
- add_keyframe (must be added in ts order; substrate enforces)
- sample(ts_us) returns interpolated Q14 value
- loop sample (modulo at duration_us)
dependencies 2 imports · 2 importers
imports: nx_syscalls.nxnx_tier.nx
imported by: nx_animation_timeline_test.nxnx_game_runtime_compose_test.nx
structs
| 25 | struct NxKeyframe |
| 32 | struct NxTimeline |
consts
| 18 | const NX_AT_OK: nx_int = 0 |
| 19 | const NX_AT_ERR_FULL: nx_int = 1 |
| 20 | const NX_AT_ERR_OUT_OF_ORDER: nx_int = 2 |
| 21 | const NX_AT_ERR_EMPTY: nx_int = 3 |
| 39 | const NX_AT_KEY_BYTES: nx_size = 16 |
functions
| 41 | func nx_timeline_new(capacity: nx_size) -> *NxTimeline |
| 51 | func _at_at(t: *NxTimeline, idx: nx_size) -> *NxKeyframe |
| 60 | func nx_timeline_add_keyframe(t: *NxTimeline, ts_us: nx_size, value_q14: nx_int) -> nx_int |
| 79 | func nx_timeline_sample(t: *NxTimeline, ts_us: nx_size) -> nx_int |
| 109 | func nx_timeline_sample_loop(t: *NxTimeline, now_us: nx_size, duration_us: nx_size) -> nx_int |
| 116 | func nx_timeline_count(t: *NxTimeline) -> nx_size called by 1: main |
| 120 | func nx_timeline_duration_us(t: *NxTimeline) -> nx_size |