embedded-react 0.19.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +5 -0
- package/README.md +8 -3
- package/aot/app-file-loader.mjs +116 -0
- package/aot/compile.mjs +180 -90
- package/aot/compiler/animations.mjs +568 -317
- package/aot/compiler/boot.mjs +97 -35
- package/aot/compiler/branch-merge.mjs +4 -3
- package/aot/compiler/check.mjs +70 -18
- package/aot/compiler/collect.mjs +787 -288
- package/aot/compiler/contexts.mjs +391 -0
- package/aot/compiler/control-flow.mjs +439 -268
- package/aot/compiler/custom-hooks.mjs +686 -0
- package/aot/compiler/diagnostics.mjs +22 -25
- package/aot/compiler/elements/activity-indicator.mjs +25 -24
- package/aot/compiler/elements/button.mjs +182 -0
- package/aot/compiler/elements/dial.mjs +91 -77
- package/aot/compiler/elements/flat-list.mjs +24 -22
- package/aot/compiler/elements/image-background.mjs +76 -0
- package/aot/compiler/elements/image.mjs +52 -50
- package/aot/compiler/elements/modal.mjs +31 -30
- package/aot/compiler/elements/props.mjs +61 -26
- package/aot/compiler/elements/rewrite.mjs +118 -0
- package/aot/compiler/elements/section-list.mjs +370 -0
- package/aot/compiler/elements/switch.mjs +42 -34
- package/aot/compiler/elements/text-input.mjs +34 -32
- package/aot/compiler/expressions.mjs +1685 -392
- package/aot/compiler/handlers.mjs +2029 -547
- package/aot/compiler/helper-values.mjs +312 -0
- package/aot/compiler/ir/functions.mjs +11 -1
- package/aot/compiler/ir/nodes.mjs +43 -4
- package/aot/compiler/ir/reads.mjs +223 -22
- package/aot/compiler/ir/text.mjs +5 -1
- package/aot/compiler/ir/types.mjs +26 -14
- package/aot/compiler/ir/vectors.mjs +5 -1
- package/aot/compiler/kept-states.mjs +177 -0
- package/aot/compiler/keyboard.mjs +17 -7
- package/aot/compiler/list-items.mjs +226 -0
- package/aot/compiler/list-order.mjs +586 -0
- package/aot/compiler/list-split.mjs +259 -0
- package/aot/compiler/loops.mjs +582 -0
- package/aot/compiler/lower.mjs +246 -111
- package/aot/compiler/native-files.mjs +439 -0
- package/aot/compiler/native-header.mjs +335 -0
- package/aot/compiler/native-modules.mjs +1173 -0
- package/aot/compiler/nodes.mjs +195 -172
- package/aot/compiler/options.mjs +37 -31
- package/aot/compiler/out.mjs +32 -23
- package/aot/compiler/package/animations.mjs +779 -0
- package/aot/compiler/package/arena.mjs +252 -0
- package/aot/compiler/package/assemble.mjs +175 -0
- package/aot/compiler/package/bytecode.mjs +315 -0
- package/aot/compiler/package/checks.mjs +1026 -0
- package/aot/compiler/package/codegen.mjs +2168 -0
- package/aot/compiler/package/enums.mjs +148 -0
- package/aot/compiler/package/format.mjs +771 -0
- package/aot/compiler/package/layouts.mjs +136 -0
- package/aot/compiler/package/lower.mjs +2103 -0
- package/aot/compiler/package/props.mjs +118 -0
- package/aot/compiler/package/string-caps.mjs +515 -0
- package/aot/compiler/package/tables.mjs +127 -0
- package/aot/compiler/package/vectors.mjs +502 -0
- package/aot/compiler/package/writer.mjs +686 -0
- package/aot/compiler/pan-responder.mjs +69 -61
- package/aot/compiler/parse.mjs +23 -21
- package/aot/compiler/record-shapes.mjs +246 -0
- package/aot/compiler/records.mjs +654 -0
- package/aot/compiler/reducers.mjs +272 -0
- package/aot/compiler/static-eval.mjs +340 -30
- package/aot/compiler/style-text.mjs +178 -174
- package/aot/compiler/svg.mjs +480 -251
- package/aot/compiler/switch-cases.mjs +198 -0
- package/aot/compiler/tagged-records.mjs +450 -0
- package/aot/compiler/typing.mjs +307 -0
- package/aot/compiler/updaters.mjs +320 -0
- package/aot/compiler/window-dimensions.mjs +94 -0
- package/aot/compiler/worked-values.mjs +319 -0
- package/aot/demo-file.mjs +30 -0
- package/aot/screenshot-smoke.mjs +54 -40
- package/aot/style-map.mjs +152 -92
- package/assets/bake-font.mjs +123 -77
- package/assets/bake-image.mjs +39 -22
- package/assets/bake-svg.mjs +361 -262
- package/assets/build-builtin-font.mjs +11 -7
- package/assets/emit-c.mjs +77 -58
- package/assets/emit-container.mjs +123 -37
- package/assets/emit-pack.mjs +77 -67
- package/assets/font-config.mjs +9 -6
- package/assets/font-sizes.mjs +163 -123
- package/assets/glyph-coverage.mjs +74 -54
- package/assets/index.mjs +31 -9
- package/assets/rasterize.mjs +126 -99
- package/assets/svg-loader.mjs +8 -8
- package/build.mjs +23 -13
- package/cli.mjs +402 -172
- package/compile-bin.mjs +3 -3
- package/flash.mjs +537 -0
- package/hotreload/dev-device.mjs +90 -33
- package/hotreload/pack-app.mjs +55 -43
- package/hotreload/pack-split.mjs +62 -64
- package/hotreload/package-transfer.mjs +175 -0
- package/hotreload/protocol.mjs +50 -37
- package/hotreload/uploader.mjs +38 -27
- package/hotreload/watch-tree.mjs +19 -19
- package/pack-container.mjs +37 -21
- package/package.json +7 -8
- package/persist-transform.mjs +34 -28
- package/qjsc-wasm.mjs +25 -14
- package/sim/embedded-react.cjs +1 -1
- package/sim/embedded-react.js +1 -1
- package/sim/embedded-react.wasm +0 -0
- package/sim/index.html +94 -85
- package/sim-server.mjs +113 -94
- package/src/embedded-react/Animated.js +24 -24
- package/src/embedded-react/Dimensions.js +37 -0
- package/src/embedded-react/Easing.js +1 -1
- package/src/embedded-react/FlatList.js +3 -3
- package/src/embedded-react/LayoutAnimation.js +8 -5
- package/src/embedded-react/PanResponder.js +75 -71
- package/src/embedded-react/Pressable.js +2 -8
- package/src/embedded-react/SectionList.js +7 -9
- package/src/embedded-react/StyleSheet.js +4 -3
- package/src/embedded-react/TouchableOpacity.js +13 -8
- package/src/embedded-react/index.d.ts +88 -8
- package/src/embedded-react/index.js +2 -0
- package/src/embedded-react/layout-anim-config.js +10 -4
- package/src/embedded-react/list-child.js +5 -5
- package/src/embedded-react/named-colors.js +1 -1
- package/src/embedded-react/nativeModule.js +462 -0
- package/src/embedded-react/split-style.js +11 -11
- package/src/embedded-react/svg-ops.js +760 -593
- package/src/embedded-react/useHostValue.js +3 -3
- package/src/embedded-react/usePersistentState.js +6 -6
- package/src/embedded-react/warn-props.js +1 -1
- package/src/host-config.js +60 -53
- package/src/props.js +49 -41
- package/src/renderer.js +7 -4
- package/aot/compiler/assemble.mjs +0 -944
- package/aot/compiler/c/animations.mjs +0 -436
- package/aot/compiler/c/boot.mjs +0 -127
- package/aot/compiler/c/expressions.mjs +0 -270
- package/aot/compiler/c/functions.mjs +0 -268
- package/aot/compiler/c/keyboard.mjs +0 -96
- package/aot/compiler/c/nodes.mjs +0 -303
- package/aot/compiler/c/pan-responder.mjs +0 -136
- package/aot/compiler/c/statements.mjs +0 -319
- package/aot/compiler/c/text.mjs +0 -83
- package/aot/compiler/c/vectors.mjs +0 -381
- package/aot/compiler/c-syntax.mjs +0 -127
|
@@ -0,0 +1,779 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Cory Lamming
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/*
|
|
17
|
+
* Animations in a package.
|
|
18
|
+
*
|
|
19
|
+
* An animated value is a slot. Each animation the IR starts is a leaf descriptor, started by ASTART with its
|
|
20
|
+
* toValue in a register; its delay is the engine's own delay_ms. Each on_complete callback is an
|
|
21
|
+
* animation-done function: a chain's steps start one another from them, and a completion wait is a delay leaf
|
|
22
|
+
* started from one. A completion is a helper that takes `finished`, entered through a done function of its own
|
|
23
|
+
* when an animation ends with it, or called directly. A completion that waits on several animations, or on a
|
|
24
|
+
* spring beside a longer delay, is on a group of them (and a delay leaf); a parallel of several is a group with
|
|
25
|
+
* or without one, so they stop together. A composition with waits keeps the handle of its last wait in a slot,
|
|
26
|
+
* so a stop can end it.
|
|
27
|
+
*/
|
|
28
|
+
/*----------------------------------------------------------------------------------------------------------------------
|
|
29
|
+
- Imports
|
|
30
|
+
---------------------------------------------------------------------------------------------------------------------*/
|
|
31
|
+
import { ANIMATION_PROP_FIELDS, AnimationFlag, AnimationKind, BindingKind, ENGINE_VALUES, EventField, FunctionKind, InterpolationFlag, NONE, ValueType, } from './format.mjs';
|
|
32
|
+
import { FunctionBuilder } from './bytecode.mjs';
|
|
33
|
+
import { abiProp, floatBits } from './props.mjs';
|
|
34
|
+
/*----------------------------------------------------------------------------------------------------------------------
|
|
35
|
+
- Constants
|
|
36
|
+
---------------------------------------------------------------------------------------------------------------------*/
|
|
37
|
+
/** Waits that run at once. */
|
|
38
|
+
const MAX_WAITS = 8;
|
|
39
|
+
/** Running-animation entries a wait takes: its delay leaf, and its group's. */
|
|
40
|
+
const WAIT_ENTRIES = 2;
|
|
41
|
+
/** A register operand that names no register (ASTART with no toValue in one). */
|
|
42
|
+
const NO_REGISTER = 0xff;
|
|
43
|
+
/** A <TouchableOpacity> fade's easing. */
|
|
44
|
+
const PRESS_FADE_EASING = 'ER_EASE_QUAD_IN_OUT';
|
|
45
|
+
/*----------------------------------------------------------------------------------------------------------------------
|
|
46
|
+
- Classes
|
|
47
|
+
---------------------------------------------------------------------------------------------------------------------*/
|
|
48
|
+
/**
|
|
49
|
+
* The program's animations: the slots they keep, their descriptors and interpolations, and the done functions
|
|
50
|
+
* and completion helpers code names. Functions are numbered in place until the program's are, then given their
|
|
51
|
+
* final indices.
|
|
52
|
+
*
|
|
53
|
+
* @class AnimationPlan
|
|
54
|
+
*/
|
|
55
|
+
export class AnimationPlan {
|
|
56
|
+
/** Each animated value's slot, by its handle. */
|
|
57
|
+
values = new Map();
|
|
58
|
+
/** The slot each started composition with waits keeps its last wait's handle in, by owner. */
|
|
59
|
+
owners = new Map();
|
|
60
|
+
loops = new Map();
|
|
61
|
+
animations = [];
|
|
62
|
+
interpolations = [];
|
|
63
|
+
/** The done functions, in function order, by name. */
|
|
64
|
+
doneFunctions = new Map();
|
|
65
|
+
/** The completions, in function order (callers first), by name. */
|
|
66
|
+
completions = new Map();
|
|
67
|
+
descriptors = new Map();
|
|
68
|
+
/** Each group's animations, in the order its tree lists them. */
|
|
69
|
+
groupLeaves = new Map();
|
|
70
|
+
waits = new Map();
|
|
71
|
+
interpolationIndex = new Map();
|
|
72
|
+
/** The running-animation table's entries. */
|
|
73
|
+
entries = 0;
|
|
74
|
+
doneBase = 0;
|
|
75
|
+
helperBase = 0;
|
|
76
|
+
/**
|
|
77
|
+
* Plans the slots the app's animations keep, and the running-animation table.
|
|
78
|
+
*
|
|
79
|
+
* @param app The app.
|
|
80
|
+
* @param arena The arena being planned.
|
|
81
|
+
*/
|
|
82
|
+
constructor(app, arena) {
|
|
83
|
+
const { output } = app;
|
|
84
|
+
for (const value of app.animations) {
|
|
85
|
+
this.values.set(value.slotName, arena.slot(ValueType.animatedValue, floatBits(value.initial)));
|
|
86
|
+
}
|
|
87
|
+
for (const [, record] of output.animationWaits) {
|
|
88
|
+
if (record.isStarted) {
|
|
89
|
+
this.owners.set(record.owner, arena.slot(ValueType.animation));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// Each callback, in the order the app declares them; a completion's own, first, is called from the rest.
|
|
93
|
+
const completions = [];
|
|
94
|
+
for (const callback of output.animationCallbacks) {
|
|
95
|
+
if (callback.kind === 'completion') {
|
|
96
|
+
completions.push(callback.completion);
|
|
97
|
+
this.doneFunctions.set(callback.completion.name, {
|
|
98
|
+
kind: 'completion',
|
|
99
|
+
completion: callback.completion,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
else if (callback.kind === 'completionWait') {
|
|
103
|
+
this.doneFunctions.set(callback.wait.callback, {
|
|
104
|
+
kind: 'wait',
|
|
105
|
+
completion: callback.completion,
|
|
106
|
+
delayMs: callback.wait.delayMs,
|
|
107
|
+
owner: callback.wait.owner,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
const { chain } = callback;
|
|
112
|
+
if (chain.completion && chain.completionWait) {
|
|
113
|
+
this.doneFunctions.set(chain.completionWait.callback, {
|
|
114
|
+
kind: 'wait',
|
|
115
|
+
completion: chain.completion,
|
|
116
|
+
delayMs: chain.completionWait.delayMs,
|
|
117
|
+
owner: chain.completionWait.owner,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
for (let index = chain.steps.length - 1; index >= 1; index--) {
|
|
121
|
+
this.doneFunctions.set(chainCallback(chain, index), {
|
|
122
|
+
kind: 'step',
|
|
123
|
+
chain,
|
|
124
|
+
index,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
if (chain.loop) {
|
|
128
|
+
this.doneFunctions.set(chainCallback(chain, 0), {
|
|
129
|
+
kind: 'repeat',
|
|
130
|
+
chain,
|
|
131
|
+
});
|
|
132
|
+
this.loops.set(chain.id, {
|
|
133
|
+
passes: chain.loop.iterations >= 0 ? arena.slot(ValueType.int) : null,
|
|
134
|
+
from: chain.loop.resetHandle ? arena.slot(ValueType.float) : null,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
// A completion that a completion calls was lowered inside it, so before it: callers go first, as CALL needs.
|
|
140
|
+
for (const completion of completions.reverse()) {
|
|
141
|
+
this.completions.set(completion.name, completion);
|
|
142
|
+
}
|
|
143
|
+
// Each value runs one animation at a time, and one more while a start cancels it; each wait takes its own,
|
|
144
|
+
// even in an app that only waits. A group's block is counted twice, for the run a restart cancels.
|
|
145
|
+
if (this.values.size || this.owners.size) {
|
|
146
|
+
const hasWaits = [...output.animationWaits.values()].some(record => record.hasWaits);
|
|
147
|
+
const waits = hasWaits ? MAX_WAITS * WAIT_ENTRIES : 0;
|
|
148
|
+
const groups = 2 * output.animationGroupEntries;
|
|
149
|
+
this.entries = this.values.size + 1 + waits + groups;
|
|
150
|
+
arena.animTable(this.entries);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Numbers the done functions and the completion helpers.
|
|
155
|
+
*
|
|
156
|
+
* @param doneBase The first done function's index.
|
|
157
|
+
* @param helperBase The first helper's index.
|
|
158
|
+
*/
|
|
159
|
+
number(doneBase, helperBase) {
|
|
160
|
+
this.doneBase = doneBase;
|
|
161
|
+
this.helperBase = helperBase;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* The done function a callback is.
|
|
165
|
+
*
|
|
166
|
+
* @param name The callback's name.
|
|
167
|
+
*
|
|
168
|
+
* @returns Its index.
|
|
169
|
+
*/
|
|
170
|
+
done(name) {
|
|
171
|
+
const index = [...this.doneFunctions.keys()].indexOf(name);
|
|
172
|
+
if (index < 0) {
|
|
173
|
+
throw new Error(`AOT internal: no animation callback "${name}"`);
|
|
174
|
+
}
|
|
175
|
+
return this.doneBase + index;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* The helper a completion is.
|
|
179
|
+
*
|
|
180
|
+
* @param completion The completion.
|
|
181
|
+
*
|
|
182
|
+
* @returns Its index.
|
|
183
|
+
*/
|
|
184
|
+
helper(completion) {
|
|
185
|
+
return (this.helperBase + [...this.completions.keys()].indexOf(completion.name));
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* An animated value's slot.
|
|
189
|
+
*
|
|
190
|
+
* @param handle Its handle.
|
|
191
|
+
*
|
|
192
|
+
* @returns The slot.
|
|
193
|
+
*/
|
|
194
|
+
value(handle) {
|
|
195
|
+
const slot = this.values.get(handle);
|
|
196
|
+
if (!slot) {
|
|
197
|
+
throw new Error(`AOT internal: no animated value "${handle}"`);
|
|
198
|
+
}
|
|
199
|
+
return slot;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* An animation's leaf descriptor, made the first time.
|
|
203
|
+
*
|
|
204
|
+
* @param animation The animation.
|
|
205
|
+
*
|
|
206
|
+
* @returns Its index.
|
|
207
|
+
*/
|
|
208
|
+
leaf(animation) {
|
|
209
|
+
let index = this.descriptors.get(animation);
|
|
210
|
+
if (index === undefined) {
|
|
211
|
+
index = this.animations.push(this.leafRecord(animation)) - 1;
|
|
212
|
+
this.descriptors.set(animation, index);
|
|
213
|
+
}
|
|
214
|
+
return index;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* A press fade's descriptor: a timing of the node's opacity value to a constant.
|
|
218
|
+
*
|
|
219
|
+
* @param fade The fade.
|
|
220
|
+
*
|
|
221
|
+
* @returns Its index.
|
|
222
|
+
*/
|
|
223
|
+
fade(fade) {
|
|
224
|
+
let index = this.descriptors.get(fade);
|
|
225
|
+
if (index === undefined) {
|
|
226
|
+
index =
|
|
227
|
+
this.animations.push({
|
|
228
|
+
...leafDefaults(),
|
|
229
|
+
kind: AnimationKind.timing,
|
|
230
|
+
easing: ENGINE_VALUES.get(PRESS_FADE_EASING),
|
|
231
|
+
target: this.value(fade.value).index,
|
|
232
|
+
amount: fade.durationMs,
|
|
233
|
+
to: floatBits(fade.opacity),
|
|
234
|
+
}) - 1;
|
|
235
|
+
this.descriptors.set(fade, index);
|
|
236
|
+
}
|
|
237
|
+
return index;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* A completion wait's delay leaf.
|
|
241
|
+
*
|
|
242
|
+
* @param delayMs The wait.
|
|
243
|
+
*
|
|
244
|
+
* @returns Its index.
|
|
245
|
+
*/
|
|
246
|
+
wait(delayMs) {
|
|
247
|
+
let index = this.waits.get(delayMs);
|
|
248
|
+
if (index === undefined) {
|
|
249
|
+
index = this.animations.push({ ...leafDefaults(), amount: delayMs }) - 1;
|
|
250
|
+
this.waits.set(delayMs, index);
|
|
251
|
+
}
|
|
252
|
+
return index;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* A group's tree: its wait's delay leaf, when it has one, then its animations, then its sequences, each group's
|
|
256
|
+
* children listed together after the groups before it. A parallel stops the rest when one stops; a stagger
|
|
257
|
+
* with no gap starts them together too, and lets the rest run on.
|
|
258
|
+
*
|
|
259
|
+
* @param start The start.
|
|
260
|
+
*
|
|
261
|
+
* @returns The group's index.
|
|
262
|
+
*/
|
|
263
|
+
group(start) {
|
|
264
|
+
let index = this.descriptors.get(start);
|
|
265
|
+
if (index === undefined) {
|
|
266
|
+
const { stopsTogether, wait } = start.group;
|
|
267
|
+
const root = this.groupNode(stopsTogether, start.animations, start.sequences, wait?.delayMs ?? null);
|
|
268
|
+
index = this.animations.push(root.record) - 1;
|
|
269
|
+
const leaves = [];
|
|
270
|
+
const nodes = [root];
|
|
271
|
+
for (const node of nodes) {
|
|
272
|
+
if (node.animation) {
|
|
273
|
+
leaves.push(node.animation);
|
|
274
|
+
}
|
|
275
|
+
if (!node.children.length)
|
|
276
|
+
continue;
|
|
277
|
+
node.record.first = this.animations.length;
|
|
278
|
+
node.record.count = node.children.length;
|
|
279
|
+
for (const child of node.children) {
|
|
280
|
+
this.animations.push(child.record);
|
|
281
|
+
nodes.push(child);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
this.descriptors.set(start, index);
|
|
285
|
+
this.groupLeaves.set(start, leaves);
|
|
286
|
+
}
|
|
287
|
+
return index;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* A group's animations, in the order a start reads their toValues from registers: its tree's.
|
|
291
|
+
*
|
|
292
|
+
* @param start The start.
|
|
293
|
+
*
|
|
294
|
+
* @returns The animations.
|
|
295
|
+
*/
|
|
296
|
+
groupAnimations(start) {
|
|
297
|
+
this.group(start);
|
|
298
|
+
return this.groupLeaves.get(start);
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* An animated value's bind as a binding: straight onto the prop, or through an interpolation.
|
|
302
|
+
*
|
|
303
|
+
* @param bind The bind.
|
|
304
|
+
*
|
|
305
|
+
* @returns The binding.
|
|
306
|
+
*/
|
|
307
|
+
binding(bind) {
|
|
308
|
+
const field = ANIMATION_PROP_FIELDS.get(bind.prop);
|
|
309
|
+
if (!field) {
|
|
310
|
+
throw new Error(`AOT internal: no ABI prop for ${bind.prop}`);
|
|
311
|
+
}
|
|
312
|
+
const prop = abiProp(field).id;
|
|
313
|
+
const slot = this.value(bind.slotName);
|
|
314
|
+
const { interpolation } = bind;
|
|
315
|
+
if (!interpolation) {
|
|
316
|
+
return { kind: BindingKind.animated, event: prop, target: slot.index };
|
|
317
|
+
}
|
|
318
|
+
// Interpolations that are the same are stored once, so list rows that bind one can share a template.
|
|
319
|
+
const record = {
|
|
320
|
+
slot: slot.index,
|
|
321
|
+
flags: interpolation.colors ? InterpolationFlag.color : 0,
|
|
322
|
+
extrapolateLeft: ENGINE_VALUES.get(interpolation.extrapolateLeft),
|
|
323
|
+
extrapolateRight: ENGINE_VALUES.get(interpolation.extrapolateRight),
|
|
324
|
+
input: interpolation.input.map(floatBits),
|
|
325
|
+
output: interpolation.colors
|
|
326
|
+
? interpolation.colors.map(color => color >>> 0)
|
|
327
|
+
: interpolation.output.map(floatBits),
|
|
328
|
+
};
|
|
329
|
+
const key = JSON.stringify(record);
|
|
330
|
+
let index = this.interpolationIndex.get(key);
|
|
331
|
+
if (index === undefined) {
|
|
332
|
+
index = this.interpolations.push(record) - 1;
|
|
333
|
+
this.interpolationIndex.set(key, index);
|
|
334
|
+
}
|
|
335
|
+
return { kind: BindingKind.interpolated, event: prop, target: index };
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* The slot a composition keeps its last wait's handle in.
|
|
339
|
+
*
|
|
340
|
+
* @param owner The composition.
|
|
341
|
+
*
|
|
342
|
+
* @returns The slot.
|
|
343
|
+
*/
|
|
344
|
+
owner(owner) {
|
|
345
|
+
const slot = this.owners.get(owner);
|
|
346
|
+
if (!slot) {
|
|
347
|
+
throw new Error(`AOT internal: no slot for composition ${owner}`);
|
|
348
|
+
}
|
|
349
|
+
return slot;
|
|
350
|
+
}
|
|
351
|
+
groupNode(stopsTogether, animations, sequences, waitMs) {
|
|
352
|
+
const children = [
|
|
353
|
+
...animations.map(animation => this.leafNode(animation)),
|
|
354
|
+
...sequences.map(sequence => this.sequenceNode(sequence)),
|
|
355
|
+
];
|
|
356
|
+
if (waitMs !== null) {
|
|
357
|
+
children.unshift(delayNode(waitMs));
|
|
358
|
+
}
|
|
359
|
+
return {
|
|
360
|
+
record: {
|
|
361
|
+
...leafDefaults(),
|
|
362
|
+
kind: stopsTogether ? AnimationKind.parallel : AnimationKind.stagger,
|
|
363
|
+
},
|
|
364
|
+
animation: null,
|
|
365
|
+
children,
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
sequenceNode(sequence) {
|
|
369
|
+
return {
|
|
370
|
+
record: { ...leafDefaults(), kind: AnimationKind.sequence },
|
|
371
|
+
animation: null,
|
|
372
|
+
children: sequence.steps.map(step => {
|
|
373
|
+
if (step.kind === 'animation') {
|
|
374
|
+
return this.leafNode(step.animation);
|
|
375
|
+
}
|
|
376
|
+
if (step.kind === 'delay') {
|
|
377
|
+
return delayNode(step.delayMs);
|
|
378
|
+
}
|
|
379
|
+
return this.groupNode(step.stopsTogether, step.animations, step.sequences, step.waitMs);
|
|
380
|
+
}),
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
leafNode(animation) {
|
|
384
|
+
return { record: this.leafRecord(animation), animation, children: [] };
|
|
385
|
+
}
|
|
386
|
+
leafRecord(animation) {
|
|
387
|
+
const { curve } = animation;
|
|
388
|
+
const record = {
|
|
389
|
+
...leafDefaults(),
|
|
390
|
+
target: this.value(animation.handle).index,
|
|
391
|
+
delayMs: animation.delayMs,
|
|
392
|
+
flags: (animation.isLooping ? AnimationFlag.loop : 0) |
|
|
393
|
+
(animation.to?.kind === 'number' ? 0 : AnimationFlag.toRegister),
|
|
394
|
+
to: animation.to?.kind === 'number' ? floatBits(animation.to.value) : 0,
|
|
395
|
+
};
|
|
396
|
+
switch (curve.kind) {
|
|
397
|
+
case 'spring':
|
|
398
|
+
return {
|
|
399
|
+
...record,
|
|
400
|
+
kind: AnimationKind.spring,
|
|
401
|
+
parameters: [
|
|
402
|
+
floatBits(curve.stiffness),
|
|
403
|
+
floatBits(curve.damping),
|
|
404
|
+
floatBits(curve.mass),
|
|
405
|
+
0,
|
|
406
|
+
],
|
|
407
|
+
};
|
|
408
|
+
case 'decay':
|
|
409
|
+
return {
|
|
410
|
+
...record,
|
|
411
|
+
kind: AnimationKind.decay,
|
|
412
|
+
parameters: [
|
|
413
|
+
floatBits(curve.velocity),
|
|
414
|
+
floatBits(curve.deceleration),
|
|
415
|
+
0,
|
|
416
|
+
0,
|
|
417
|
+
],
|
|
418
|
+
};
|
|
419
|
+
case 'timing':
|
|
420
|
+
return {
|
|
421
|
+
...record,
|
|
422
|
+
kind: AnimationKind.timing,
|
|
423
|
+
easing: ENGINE_VALUES.get(curve.easing),
|
|
424
|
+
amount: curve.durationMs,
|
|
425
|
+
parameters: curve.bezier
|
|
426
|
+
? curve.bezier.map(floatBits)
|
|
427
|
+
: [0, 0, 0, 0],
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
/*----------------------------------------------------------------------------------------------------------------------
|
|
433
|
+
- Implementation
|
|
434
|
+
---------------------------------------------------------------------------------------------------------------------*/
|
|
435
|
+
/**
|
|
436
|
+
* A descriptor with nothing set: a delay leaf of 0 ms, which a record overrides.
|
|
437
|
+
*
|
|
438
|
+
* @returns The record.
|
|
439
|
+
*/
|
|
440
|
+
const leafDefaults = () => ({
|
|
441
|
+
kind: AnimationKind.timing,
|
|
442
|
+
easing: 0,
|
|
443
|
+
flags: 0,
|
|
444
|
+
target: NONE,
|
|
445
|
+
prop: NONE,
|
|
446
|
+
first: 0,
|
|
447
|
+
count: 0,
|
|
448
|
+
amount: 0,
|
|
449
|
+
delayMs: 0,
|
|
450
|
+
to: 0,
|
|
451
|
+
parameters: [0, 0, 0, 0],
|
|
452
|
+
});
|
|
453
|
+
/**
|
|
454
|
+
* A delay leaf in a group's tree.
|
|
455
|
+
*
|
|
456
|
+
* @param delayMs The delay.
|
|
457
|
+
*
|
|
458
|
+
* @returns The node.
|
|
459
|
+
*/
|
|
460
|
+
const delayNode = (delayMs) => ({
|
|
461
|
+
record: { ...leafDefaults(), amount: delayMs },
|
|
462
|
+
animation: null,
|
|
463
|
+
children: [],
|
|
464
|
+
});
|
|
465
|
+
/**
|
|
466
|
+
* The name of a chain's callback that starts step `index` (step 0's starts a repeat).
|
|
467
|
+
*
|
|
468
|
+
* @param chain The chain.
|
|
469
|
+
* @param index The step.
|
|
470
|
+
*
|
|
471
|
+
* @returns The name.
|
|
472
|
+
*/
|
|
473
|
+
const chainCallback = (chain, index) => `chain_${chain.id}_${index}`;
|
|
474
|
+
/**
|
|
475
|
+
* The done function the step after `index` is started from, or what runs after the last step: the repeat for a
|
|
476
|
+
* loop, else the completion's wait or the completion.
|
|
477
|
+
*
|
|
478
|
+
* @param chain The chain.
|
|
479
|
+
* @param index The step.
|
|
480
|
+
* @param plan The program's animations.
|
|
481
|
+
*
|
|
482
|
+
* @returns The function, or NONE.
|
|
483
|
+
*/
|
|
484
|
+
function afterStep(chain, index, plan) {
|
|
485
|
+
if (index < chain.steps.length - 1) {
|
|
486
|
+
return plan.done(chainCallback(chain, index + 1));
|
|
487
|
+
}
|
|
488
|
+
if (chain.loop) {
|
|
489
|
+
return plan.done(chainCallback(chain, 0));
|
|
490
|
+
}
|
|
491
|
+
const name = chain.completionWait?.callback ?? chain.completion?.name;
|
|
492
|
+
return name ? plan.done(name) : NONE;
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Starts a descriptor, as er_animation_value_animate starts an animation.
|
|
496
|
+
*
|
|
497
|
+
* @param codegen The function's codegen.
|
|
498
|
+
* @param descriptor The descriptor.
|
|
499
|
+
* @param done The done function, or NONE.
|
|
500
|
+
* @param to The register its toValue is in, or null when the descriptor holds it.
|
|
501
|
+
*
|
|
502
|
+
* @returns The running animation's handle.
|
|
503
|
+
*/
|
|
504
|
+
function start(codegen, descriptor, done, to) {
|
|
505
|
+
const handle = codegen.builder.register('animation');
|
|
506
|
+
codegen.builder.abx('ASTART', handle.index, descriptor, (done & 0xffff) | ((to?.index ?? NO_REGISTER) << 16));
|
|
507
|
+
return handle;
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* An animation's toValue in a float register, or null when its descriptor holds it. A decay with
|
|
511
|
+
* none is given the value it holds now.
|
|
512
|
+
*
|
|
513
|
+
* @param codegen The function's codegen.
|
|
514
|
+
* @param animation The animation.
|
|
515
|
+
* @param plan The program's animations.
|
|
516
|
+
*
|
|
517
|
+
* @returns The register.
|
|
518
|
+
*/
|
|
519
|
+
function toValue(codegen, animation, plan) {
|
|
520
|
+
if (animation.to?.kind === 'number') {
|
|
521
|
+
return null;
|
|
522
|
+
}
|
|
523
|
+
if (animation.to) {
|
|
524
|
+
return codegen.valueAs(animation.to, 'float');
|
|
525
|
+
}
|
|
526
|
+
const register = codegen.builder.register('float');
|
|
527
|
+
codegen.builder.abx('AVGET', register.index, plan.value(animation.handle).index);
|
|
528
|
+
return register;
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* The toValues a group's animations take from registers, in consecutive registers in the animations' order.
|
|
532
|
+
*
|
|
533
|
+
* @param codegen The function's codegen.
|
|
534
|
+
* @param animations The animations.
|
|
535
|
+
* @param plan The program's animations.
|
|
536
|
+
*
|
|
537
|
+
* @returns The first register, or null when every descriptor holds its own.
|
|
538
|
+
*/
|
|
539
|
+
function toValues(codegen, animations, plan) {
|
|
540
|
+
const fromRegisters = animations.filter(animation => animation.to?.kind !== 'number');
|
|
541
|
+
if (fromRegisters.length <= 1) {
|
|
542
|
+
return fromRegisters.length
|
|
543
|
+
? toValue(codegen, fromRegisters[0], plan)
|
|
544
|
+
: null;
|
|
545
|
+
}
|
|
546
|
+
const run = codegen.builder.consecutive(fromRegisters.map(() => 'float'));
|
|
547
|
+
fromRegisters.forEach((animation, index) => {
|
|
548
|
+
const value = toValue(codegen, animation, plan);
|
|
549
|
+
codegen.builder.abc('MOVE', run[index].index, value.index);
|
|
550
|
+
});
|
|
551
|
+
return run[0];
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Starts one animation.
|
|
555
|
+
*
|
|
556
|
+
* @param codegen The function's codegen.
|
|
557
|
+
* @param animation The animation.
|
|
558
|
+
* @param done The done function, or NONE.
|
|
559
|
+
* @param plan The program's animations.
|
|
560
|
+
*/
|
|
561
|
+
function startAnimation(codegen, animation, done, plan) {
|
|
562
|
+
codegen.scoped(() => start(codegen, plan.leaf(animation), done, toValue(codegen, animation, plan)));
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Starts a completion's wait, keeping its handle where a stop of its composition finds it.
|
|
566
|
+
*
|
|
567
|
+
* @param codegen The function's codegen.
|
|
568
|
+
* @param completion The completion it runs.
|
|
569
|
+
* @param delayMs The wait.
|
|
570
|
+
* @param owner The composition.
|
|
571
|
+
* @param plan The program's animations.
|
|
572
|
+
*/
|
|
573
|
+
function startWait(codegen, completion, delayMs, owner, plan) {
|
|
574
|
+
codegen.scoped(() => {
|
|
575
|
+
const handle = start(codegen, plan.wait(delayMs), plan.done(completion.name), null);
|
|
576
|
+
codegen.builder.abx('SET32', handle.index, plan.owner(owner).index);
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Calls a completion directly.
|
|
581
|
+
*
|
|
582
|
+
* @param codegen The function's codegen.
|
|
583
|
+
* @param completion The completion.
|
|
584
|
+
* @param finished A bool register holding what it is passed.
|
|
585
|
+
* @param plan The program's animations.
|
|
586
|
+
*/
|
|
587
|
+
function callCompletion(codegen, completion, finished, plan) {
|
|
588
|
+
codegen.builder.abx('CALL', finished.index, plan.helper(completion));
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* Calls a completion with a constant.
|
|
592
|
+
*
|
|
593
|
+
* @param codegen The function's codegen.
|
|
594
|
+
* @param completion The completion.
|
|
595
|
+
* @param finished What it is passed.
|
|
596
|
+
* @param plan The program's animations.
|
|
597
|
+
*/
|
|
598
|
+
function callCompletionWith(codegen, completion, finished, plan) {
|
|
599
|
+
codegen.scoped(() => callCompletion(codegen, completion, codegen.load('bool', finished ? 1 : 0), plan));
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Lowers an animation statement that starts or stops one.
|
|
603
|
+
*
|
|
604
|
+
* @param codegen The function's codegen.
|
|
605
|
+
* @param statement The statement.
|
|
606
|
+
* @param plan The program's animations.
|
|
607
|
+
*/
|
|
608
|
+
export function animationStatement(codegen, statement, plan) {
|
|
609
|
+
const { builder } = codegen;
|
|
610
|
+
switch (statement.kind) {
|
|
611
|
+
case 'startAnimations': {
|
|
612
|
+
const { animations, completion, group } = statement;
|
|
613
|
+
if (!animations.length && !statement.sequences.length) {
|
|
614
|
+
return;
|
|
615
|
+
}
|
|
616
|
+
// A group is one tree, kept where a stop of its composition finds it when it has a wait. One with
|
|
617
|
+
// sequences is kept too, and stops its last run first: steps that run on would pile up runs.
|
|
618
|
+
if (group) {
|
|
619
|
+
const owner = group.owner ?? group.wait?.owner ?? null;
|
|
620
|
+
if (group.owner !== null) {
|
|
621
|
+
codegen.scoped(() => {
|
|
622
|
+
const last = builder.register('animation');
|
|
623
|
+
builder.abx('GET32', last.index, plan.owner(group.owner).index);
|
|
624
|
+
builder.abc('ASTOP', last.index);
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
codegen.scoped(() => {
|
|
628
|
+
const handle = start(codegen, plan.group(statement), completion ? plan.done(completion.name) : NONE, toValues(codegen, plan.groupAnimations(statement), plan));
|
|
629
|
+
if (owner !== null) {
|
|
630
|
+
builder.abx('SET32', handle.index, plan.owner(owner).index);
|
|
631
|
+
}
|
|
632
|
+
});
|
|
633
|
+
return;
|
|
634
|
+
}
|
|
635
|
+
// The completion (or its wait) goes on the last animation, the only one when there is a completion.
|
|
636
|
+
const name = statement.completionWait?.callback ?? completion?.name;
|
|
637
|
+
animations.forEach((animation, index) => startAnimation(codegen, animation, index === animations.length - 1 && name ? plan.done(name) : NONE, plan));
|
|
638
|
+
return;
|
|
639
|
+
}
|
|
640
|
+
case 'completeAfter':
|
|
641
|
+
if (statement.owner !== null) {
|
|
642
|
+
startWait(codegen, statement.completion, statement.delayMs, statement.owner, plan);
|
|
643
|
+
}
|
|
644
|
+
else {
|
|
645
|
+
callCompletionWith(codegen, statement.completion, true, plan);
|
|
646
|
+
}
|
|
647
|
+
return;
|
|
648
|
+
case 'startChain': {
|
|
649
|
+
// A loop first records the pass and where the value starts, then step 0 starts here.
|
|
650
|
+
const loop = plan.loops.get(statement.id);
|
|
651
|
+
if (loop?.passes) {
|
|
652
|
+
codegen.scoped(() => builder.abx('SET32', codegen.load('int', 1).index, loop.passes.index));
|
|
653
|
+
}
|
|
654
|
+
if (loop?.from) {
|
|
655
|
+
codegen.scoped(() => {
|
|
656
|
+
const from = builder.register('float');
|
|
657
|
+
builder.abx('AVGET', from.index, plan.value(statement.loop.resetHandle).index);
|
|
658
|
+
builder.abx('SET32', from.index, loop.from.index);
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
startAnimation(codegen, statement.steps[0], afterStep(statement, 0, plan), plan);
|
|
662
|
+
return;
|
|
663
|
+
}
|
|
664
|
+
case 'stopAnimations':
|
|
665
|
+
// Each value freezes where it is, which ends its animation as not finished; then the composition's wait.
|
|
666
|
+
for (const handle of statement.handles) {
|
|
667
|
+
codegen.scoped(() => {
|
|
668
|
+
const value = builder.register('float');
|
|
669
|
+
const slot = plan.value(handle).index;
|
|
670
|
+
builder.abx('AVGET', value.index, slot);
|
|
671
|
+
builder.abx('AVSET', value.index, slot);
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
if (statement.waitOwner !== null &&
|
|
675
|
+
plan.owners.has(statement.waitOwner)) {
|
|
676
|
+
codegen.scoped(() => {
|
|
677
|
+
const handle = builder.register('animation');
|
|
678
|
+
builder.abx('GET32', handle.index, plan.owner(statement.waitOwner).index);
|
|
679
|
+
builder.abc('ASTOP', handle.index);
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* Starts a <TouchableOpacity>'s fade, before the app's own handler for the event runs.
|
|
686
|
+
*
|
|
687
|
+
* @param codegen The handler's codegen.
|
|
688
|
+
* @param fade The fade.
|
|
689
|
+
* @param plan The program's animations.
|
|
690
|
+
*/
|
|
691
|
+
export function startPressFade(codegen, fade, plan) {
|
|
692
|
+
codegen.scoped(() => start(codegen, plan.fade(fade), NONE, null));
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* The done functions, in order: each one ends the chain or composition when the animation before it was
|
|
696
|
+
* interrupted, calling the completion as not finished.
|
|
697
|
+
*
|
|
698
|
+
* @param plan The program's animations.
|
|
699
|
+
* @param codegenFor Makes a function's codegen.
|
|
700
|
+
*
|
|
701
|
+
* @returns The functions.
|
|
702
|
+
*/
|
|
703
|
+
export function doneFunctions(plan, codegenFor) {
|
|
704
|
+
return [...plan.doneFunctions].map(([name, done]) => {
|
|
705
|
+
const builder = new FunctionBuilder(FunctionKind.animationDone, `animation ${name}`);
|
|
706
|
+
const codegen = codegenFor(builder);
|
|
707
|
+
const finished = builder.register('bool');
|
|
708
|
+
builder.abc('EVT', finished.index, EventField.finished);
|
|
709
|
+
if (done.kind === 'completion') {
|
|
710
|
+
callCompletion(codegen, done.completion, finished, plan);
|
|
711
|
+
return builder.finish();
|
|
712
|
+
}
|
|
713
|
+
const completion = done.kind === 'wait' ? done.completion : done.chain.completion;
|
|
714
|
+
const afterCompletion = builder.label();
|
|
715
|
+
const end = builder.label();
|
|
716
|
+
builder.branch('JT', afterCompletion, finished);
|
|
717
|
+
if (completion) {
|
|
718
|
+
callCompletion(codegen, completion, finished, plan);
|
|
719
|
+
}
|
|
720
|
+
builder.branch('JMP', end);
|
|
721
|
+
builder.place(afterCompletion);
|
|
722
|
+
if (done.kind === 'wait') {
|
|
723
|
+
startWait(codegen, done.completion, done.delayMs, done.owner, plan);
|
|
724
|
+
}
|
|
725
|
+
else if (done.kind === 'step') {
|
|
726
|
+
startAnimation(codegen, done.chain.steps[done.index], afterStep(done.chain, done.index, plan), plan);
|
|
727
|
+
}
|
|
728
|
+
else {
|
|
729
|
+
repeat(codegen, done.chain, end, plan);
|
|
730
|
+
}
|
|
731
|
+
builder.place(end);
|
|
732
|
+
return builder.finish();
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* A loop's repeat, when its last step finished: it counts the pass, puts the value back, and starts step 0 again.
|
|
737
|
+
*
|
|
738
|
+
* @param codegen The done function's codegen.
|
|
739
|
+
* @param chain The chain.
|
|
740
|
+
* @param end Where the function returns.
|
|
741
|
+
* @param plan The program's animations.
|
|
742
|
+
*/
|
|
743
|
+
function repeat(codegen, chain, end, plan) {
|
|
744
|
+
const { builder } = codegen;
|
|
745
|
+
const loop = chain.loop;
|
|
746
|
+
const slots = plan.loops.get(chain.id);
|
|
747
|
+
if (slots.passes) {
|
|
748
|
+
const passes = slots.passes;
|
|
749
|
+
codegen.scoped(() => {
|
|
750
|
+
const count = builder.register('int');
|
|
751
|
+
const more = builder.register('bool');
|
|
752
|
+
const next = builder.label();
|
|
753
|
+
builder.abx('GET32', count.index, passes.index);
|
|
754
|
+
builder.abc('LT', more.index, count.index, codegen.load('int', loop.iterations).index);
|
|
755
|
+
builder.branch('JT', next, more);
|
|
756
|
+
if (chain.completion) {
|
|
757
|
+
if (loop.finalWait) {
|
|
758
|
+
startWait(codegen, chain.completion, loop.finalWait.delayMs, loop.finalWait.owner, plan);
|
|
759
|
+
}
|
|
760
|
+
else {
|
|
761
|
+
callCompletionWith(codegen, chain.completion, true, plan);
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
builder.branch('JMP', end);
|
|
765
|
+
builder.place(next);
|
|
766
|
+
builder.abc('ADD', count.index, count.index, codegen.load('int', 1).index);
|
|
767
|
+
builder.abx('SET32', count.index, passes.index);
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
if (slots.from) {
|
|
771
|
+
const from = slots.from;
|
|
772
|
+
codegen.scoped(() => {
|
|
773
|
+
const value = builder.register('float');
|
|
774
|
+
builder.abx('GET32', value.index, from.index);
|
|
775
|
+
builder.abx('AVSET', value.index, plan.value(loop.resetHandle).index);
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
startAnimation(codegen, loop.restart, afterStep(chain, 0, plan), plan);
|
|
779
|
+
}
|