flocc 0.5.21 → 0.5.23

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.
@@ -53,6 +53,15 @@ declare class Environment extends Agent {
53
53
  opts: EnvironmentOptions;
54
54
  width: number;
55
55
  height: number;
56
+ /**
57
+ * Whether the `Environment` tick cycle is currently playing.
58
+ * Use {@linkcode pause}, {@linkcode resume}, or {@linkcode toggle}
59
+ * to control playback.
60
+ * @since 0.5.22
61
+ */
62
+ playing: boolean;
63
+ /** @hidden */
64
+ private _tickIntervalId;
56
65
  /**
57
66
  * This property will always equal the number of tick cycles that
58
67
  * have passed since the `Environment` was created. If you call
@@ -179,6 +188,35 @@ declare class Environment extends Agent {
179
188
  * @since 0.0.5
180
189
  */
181
190
  tick(opts?: number | TickOptions): void;
191
+ /**
192
+ * Pause the tick cycle. While paused, calling {@linkcode tick} will
193
+ * be a no-op unless you use {@linkcode step} to advance manually.
194
+ * @since 0.5.22
195
+ */
196
+ pause(): void;
197
+ /**
198
+ * Resume the tick cycle after it has been paused.
199
+ * @since 0.5.22
200
+ */
201
+ resume(): void;
202
+ /**
203
+ * Toggle the tick cycle between playing and paused.
204
+ * @since 0.5.22
205
+ */
206
+ toggle(): void;
207
+ /**
208
+ * Advance the `Environment` by exactly one tick, regardless of whether
209
+ * it is paused. This is useful for stepping through the simulation
210
+ * frame-by-frame while paused.
211
+ *
212
+ * ```js
213
+ * environment.pause();
214
+ * environment.step(); // advances one tick
215
+ * ```
216
+ *
217
+ * @since 0.5.22
218
+ */
219
+ step(opts?: number | TickOptions): void;
182
220
  /**
183
221
  * Use a helper with this environment. A helper can be one of:
184
222
  * - {@linkcode KDTree}