@sophistry/core 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +27 -2
- package/dist/anim/animation.d.ts +207 -0
- package/dist/anim/draw.d.ts +108 -0
- package/dist/anim/emphasis.d.ts +93 -0
- package/dist/anim/fade.d.ts +82 -0
- package/dist/anim/growing.d.ts +92 -0
- package/dist/anim/index.d.ts +32 -0
- package/dist/anim/indication.d.ts +157 -0
- package/dist/anim/move.d.ts +123 -0
- package/dist/anim/movement.d.ts +114 -0
- package/dist/anim/points.d.ts +24 -0
- package/dist/anim/sequence.d.ts +135 -0
- package/dist/anim/slots.d.ts +303 -0
- package/dist/anim/speed.d.ts +43 -0
- package/dist/anim/spring.d.ts +146 -0
- package/dist/anim/timeline.d.ts +209 -0
- package/dist/anim/transform.d.ts +92 -0
- package/dist/anim/tween.d.ts +92 -0
- package/dist/anim/types.d.ts +113 -0
- package/dist/color/convert.d.ts +146 -0
- package/dist/color/index.d.ts +13 -0
- package/dist/color/named.d.ts +127 -0
- package/dist/color/ops.d.ts +95 -0
- package/dist/color/parse.d.ts +82 -0
- package/dist/color/random.d.ts +46 -0
- package/dist/color/types.d.ts +38 -0
- package/dist/color-CV6uMtjS.js +44 -0
- package/dist/colormap-BExuU8VP.js +463 -0
- package/dist/coords/axes.d.ts +172 -0
- package/dist/coords/axis-composition.d.ts +119 -0
- package/dist/coords/axis-labels.d.ts +126 -0
- package/dist/coords/complex-plane.d.ts +94 -0
- package/dist/coords/coords.d.ts +336 -0
- package/dist/coords/function-graph.d.ts +290 -0
- package/dist/coords/graph-annotations.d.ts +355 -0
- package/dist/coords/grid-lines.d.ts +126 -0
- package/dist/coords/implicit-function.d.ts +50 -0
- package/dist/coords/index.d.ts +28 -0
- package/dist/coords/linear-transform.d.ts +204 -0
- package/dist/coords/number-line.d.ts +211 -0
- package/dist/coords/number-plane.d.ts +111 -0
- package/dist/coords/polar-plane.d.ts +172 -0
- package/dist/coords/tangent.d.ts +73 -0
- package/dist/coords/vector-field.d.ts +318 -0
- package/dist/entries/color.d.ts +30 -0
- package/dist/entries/color.js +3 -0
- package/dist/entries/definitions.d.ts +72 -0
- package/dist/entries/definitions.js +14 -0
- package/dist/entries/geometry.d.ts +59 -0
- package/dist/entries/geometry.js +393 -0
- package/dist/entries/internal.d.ts +55 -0
- package/dist/entries/internal.js +190 -0
- package/dist/entries/themes.d.ts +37 -0
- package/dist/entries/themes.js +4 -0
- package/dist/export/frames.d.ts +170 -0
- package/dist/export/index.d.ts +5 -0
- package/dist/geometry/arc.d.ts +299 -0
- package/dist/geometry/band.d.ts +136 -0
- package/dist/geometry/bounds.d.ts +106 -0
- package/dist/geometry/brace.d.ts +61 -0
- package/dist/geometry/complex.d.ts +21 -0
- package/dist/geometry/curves.d.ts +126 -0
- package/dist/geometry/delaunay.d.ts +17 -0
- package/dist/geometry/field.d.ts +93 -0
- package/dist/geometry/graph-layout.d.ts +321 -0
- package/dist/geometry/implicit.d.ts +73 -0
- package/dist/geometry/index.d.ts +41 -0
- package/dist/geometry/lerp.d.ts +174 -0
- package/dist/geometry/morph.d.ts +169 -0
- package/dist/geometry/num.d.ts +176 -0
- package/dist/geometry/path/arclength.d.ts +164 -0
- package/dist/geometry/path/cubic.d.ts +112 -0
- package/dist/geometry/path/outline-reveal.d.ts +48 -0
- package/dist/geometry/path/svg-path.d.ts +88 -0
- package/dist/geometry/path/types.d.ts +79 -0
- package/dist/geometry/resolver.d.ts +45 -0
- package/dist/geometry/scale/range-transition.d.ts +114 -0
- package/dist/geometry/scale/scales.d.ts +279 -0
- package/dist/geometry/scale/tick-format.d.ts +149 -0
- package/dist/geometry/scale/ticks.d.ts +150 -0
- package/dist/geometry/shape-match.d.ts +157 -0
- package/dist/geometry/shapes.d.ts +163 -0
- package/dist/geometry/stitch.d.ts +40 -0
- package/dist/geometry/time.d.ts +175 -0
- package/dist/geometry/tips.d.ts +56 -0
- package/dist/geometry/transform.d.ts +245 -0
- package/dist/geometry/view-matrix.d.ts +59 -0
- package/dist/geometry/write-phase.d.ts +50 -0
- package/dist/geometry3d/camera.d.ts +144 -0
- package/dist/geometry3d/index.d.ts +4 -0
- package/dist/geometry3d/mat.d.ts +70 -0
- package/dist/implicit-DtDJLCJr.js +886 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.js +8 -0
- package/dist/interact/constrain.d.ts +270 -0
- package/dist/interact/drag.d.ts +159 -0
- package/dist/interact/drop.d.ts +71 -0
- package/dist/interact/hit.d.ts +198 -0
- package/dist/interact/index.d.ts +17 -0
- package/dist/interact/item-order.d.ts +35 -0
- package/dist/interact/param.d.ts +96 -0
- package/dist/interact/pick-items.d.ts +33 -0
- package/dist/interact/pointer.d.ts +71 -0
- package/dist/interact/registry.d.ts +63 -0
- package/dist/interact/slop.d.ts +9 -0
- package/dist/interact/types.d.ts +418 -0
- package/dist/labels/decimal-number.d.ts +326 -0
- package/dist/labels/digits.d.ts +156 -0
- package/dist/labels/index.d.ts +10 -0
- package/dist/labels/paragraph.d.ts +313 -0
- package/dist/labels/text-layout.d.ts +74 -0
- package/dist/network/index.d.ts +5 -0
- package/dist/network/network-graph.d.ts +314 -0
- package/dist/reactive/index.d.ts +2 -0
- package/dist/reactive/track.d.ts +118 -0
- package/dist/render/a11y.d.ts +152 -0
- package/dist/render/camera-gesture.d.ts +55 -0
- package/dist/render/camera.d.ts +147 -0
- package/dist/render/canvas-renderer.d.ts +243 -0
- package/dist/render/index.d.ts +15 -0
- package/dist/render/layer-cache.d.ts +67 -0
- package/dist/render/paint-items.d.ts +69 -0
- package/dist/render/paint.d.ts +113 -0
- package/dist/render/pointer-core.d.ts +59 -0
- package/dist/render/pointer-drop.d.ts +23 -0
- package/dist/render/pointer-gestures.d.ts +50 -0
- package/dist/render/pointer-presence.d.ts +35 -0
- package/dist/render/pointer-wheel.d.ts +27 -0
- package/dist/render/pointer.d.ts +258 -0
- package/dist/resolver-qY_MwSeI.js +21 -0
- package/dist/scene/cameras.d.ts +283 -0
- package/dist/scene/composite.d.ts +209 -0
- package/dist/scene/container.d.ts +61 -0
- package/dist/scene/context.d.ts +108 -0
- package/dist/scene/fonts.d.ts +86 -0
- package/dist/scene/graph.d.ts +174 -0
- package/dist/scene/group.d.ts +115 -0
- package/dist/scene/index.d.ts +32 -0
- package/dist/scene/instance-bank.d.ts +348 -0
- package/dist/scene/instance-marks.d.ts +164 -0
- package/dist/scene/instance-node.d.ts +204 -0
- package/dist/scene/instances.d.ts +244 -0
- package/dist/scene/interaction-group-context.d.ts +46 -0
- package/dist/scene/interaction-group.d.ts +72 -0
- package/dist/scene/interaction-props.d.ts +29 -0
- package/dist/scene/interaction.d.ts +61 -0
- package/dist/scene/marks.d.ts +270 -0
- package/dist/scene/node.d.ts +244 -0
- package/dist/scene/pan-zoom.d.ts +186 -0
- package/dist/scene/path-batch.d.ts +209 -0
- package/dist/scene/primitive.d.ts +127 -0
- package/dist/scene/scene.d.ts +415 -0
- package/dist/scene/shape.d.ts +376 -0
- package/dist/scene/text.d.ts +230 -0
- package/dist/scene/types.d.ts +345 -0
- package/dist/scene-B92FTpdT.js +8795 -0
- package/dist/shape-match-ByhMD-8z.js +2255 -0
- package/dist/shapes/angle.d.ts +135 -0
- package/dist/shapes/animated-boundary.d.ts +78 -0
- package/dist/shapes/arc.d.ts +169 -0
- package/dist/shapes/bezier.d.ts +72 -0
- package/dist/shapes/brace.d.ts +102 -0
- package/dist/shapes/circle.d.ts +69 -0
- package/dist/shapes/dot.d.ts +207 -0
- package/dist/shapes/forward.d.ts +54 -0
- package/dist/shapes/index.d.ts +33 -0
- package/dist/shapes/line.d.ts +276 -0
- package/dist/shapes/matchers.d.ts +174 -0
- package/dist/shapes/path.d.ts +92 -0
- package/dist/shapes/polygon.d.ts +45 -0
- package/dist/shapes/polygram.d.ts +118 -0
- package/dist/shapes/rect.d.ts +66 -0
- package/dist/shapes/traced-path.d.ts +76 -0
- package/dist/shapes/transform-matching-shapes.d.ts +65 -0
- package/dist/spec/bake.d.ts +485 -0
- package/dist/spec/clip.d.ts +87 -0
- package/dist/spec/colorRampProp.d.ts +23 -0
- package/dist/spec/compile.d.ts +28 -0
- package/dist/spec/gradient.d.ts +209 -0
- package/dist/spec/index.d.ts +14 -0
- package/dist/spec/layout.d.ts +287 -0
- package/dist/spec/metrics.d.ts +104 -0
- package/dist/spec/types.d.ts +506 -0
- package/dist/src-Dfi1aXsz.js +6551 -0
- package/dist/theme-DEP9bZB3.js +347 -0
- package/dist/themes/catppuccin.d.ts +58 -0
- package/dist/themes/colormap.d.ts +79 -0
- package/dist/themes/css.d.ts +50 -0
- package/dist/themes/index.d.ts +17 -0
- package/dist/themes/mode.d.ts +167 -0
- package/dist/themes/palette.d.ts +92 -0
- package/dist/themes/ramp.d.ts +50 -0
- package/dist/themes/theme.d.ts +42 -0
- package/dist/themes/types.d.ts +190 -0
- package/dist/themes-CBBPL7u9.js +24 -0
- package/dist/tween/clock.d.ts +145 -0
- package/dist/tween/easing.d.ts +160 -0
- package/dist/tween/frame-loop.d.ts +167 -0
- package/dist/tween/index.d.ts +19 -0
- package/dist/tween/interpolate.d.ts +13 -0
- package/dist/tween/interpolators.d.ts +144 -0
- package/dist/tween/reduced-motion.d.ts +49 -0
- package/dist/tween/spring.d.ts +275 -0
- package/dist/tween/target.d.ts +92 -0
- package/dist/tween/track.d.ts +38 -0
- package/package.json +87 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Benjamin Lucier
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @sophistry/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Framework-free animation and visualization engine: a retained scene graph, tracks, seekable animations, geometry, themes and a Canvas2D renderer. Pair it with a binding ([`@sophistry/solidjs`](../solidjs) or [`@sophistry/react`](../react)).
|
|
4
|
+
|
|
5
|
+
Part of [sophistry](https://sophistry.dev), controllable Manim for the web. Pre-1.0: minor releases may break.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pnpm add @sophistry/core
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { circle, createScene, draw, track } from "@sophistry/core";
|
|
17
|
+
|
|
18
|
+
const scene = createScene({ host: document.getElementById("stage") as HTMLElement });
|
|
19
|
+
const drawn = track(0);
|
|
20
|
+
scene.root.add(circle.create({ radius: 2, progress: drawn }));
|
|
21
|
+
void scene.play(draw(drawn, { duration: 1.5 }));
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Subpaths: `/geometry`, `/color`, `/themes` (pure helpers) and the unstable `/internal`.
|
|
25
|
+
|
|
26
|
+
## Links
|
|
27
|
+
|
|
28
|
+
[Documentation](https://sophistry.dev) · [API](https://sophistry.dev/reference/api/) · [Source](https://github.com/BenjaminLucier/sophistry/tree/main/packages/core) · MIT
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The animation model: an `Animation` is data plus a sampler with a known
|
|
3
|
+
* duration, not a running process. A runner (`timeline.ts`) samples the whole
|
|
4
|
+
* script at one absolute time per clock step, which keeps composition exact and
|
|
5
|
+
* makes fast-forward and scrubbing work. No canvas, no clock here.
|
|
6
|
+
*/
|
|
7
|
+
import type { Easing } from "../tween/easing.js";
|
|
8
|
+
/**
|
|
9
|
+
* Floating-point slack, in seconds, when comparing absolute times. Child
|
|
10
|
+
* offsets are sums of floats (`0.1 + 0.2`), so a child that "should" be exactly
|
|
11
|
+
* finished can land a few ulps short; without slack its last frame would be
|
|
12
|
+
* left at 0.99999999 of the way.
|
|
13
|
+
*/
|
|
14
|
+
export declare const EPSILON = 1e-9;
|
|
15
|
+
/**
|
|
16
|
+
* A lazy, seekable animation with a known length. Nothing runs when you build
|
|
17
|
+
* one; a runner ({@link timeline}, {@link play}) samples it. Implement the
|
|
18
|
+
* members only for a custom leaf (see {@link animation}).
|
|
19
|
+
*
|
|
20
|
+
* `seek(t)` writes the state for local time `t` and must not depend on what
|
|
21
|
+
* time was seen before. Composites restore children that are now ahead of the
|
|
22
|
+
* seek time to their start ({@link Animation.restore}), and write later
|
|
23
|
+
* children over earlier ones. {@link Animation.begin} runs the first time a
|
|
24
|
+
* child is entered, seeing the world as of its own start time, so relative
|
|
25
|
+
* animations capture what the previous step left; restoring does not re-arm.
|
|
26
|
+
* `repeat` and `forever` re-enter each cycle.
|
|
27
|
+
*
|
|
28
|
+
* @see {@link https://sophistry.dev/guides/timelines/#what-seeking-does}
|
|
29
|
+
* @see {@link https://sophistry.dev/guides/extending/#custom-animations}
|
|
30
|
+
* @category Animation composition & timelines
|
|
31
|
+
*/
|
|
32
|
+
export interface Animation {
|
|
33
|
+
/**
|
|
34
|
+
* Length in seconds of timeline time, including any leading `delay`.
|
|
35
|
+
* `Infinity` is allowed (`forever`); a runner then never finishes on its own.
|
|
36
|
+
*/
|
|
37
|
+
readonly duration: number;
|
|
38
|
+
/**
|
|
39
|
+
* The local time a reduced-motion run jumps to instead of playing: the
|
|
40
|
+
* state the animation comes to rest in. Defaults to {@link
|
|
41
|
+
* Animation.duration} when that is finite and to `0` when it is infinite
|
|
42
|
+
* (an endless loop holds its starting state). {@link compose} derives it
|
|
43
|
+
* from its children, so `sequence(fadeIn(a), forever(spin(b)))` rests at
|
|
44
|
+
* the end of the fade with the spin held at its start.
|
|
45
|
+
*/
|
|
46
|
+
readonly restAt?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Called when the animation is armed: the first time it is entered, and
|
|
49
|
+
* again for each fresh run (a new `repeat` cycle, a `timeline` replay).
|
|
50
|
+
* Capture start values here, with `peek()`.
|
|
51
|
+
* It is **not** called again when the animation is merely re-entered after
|
|
52
|
+
* a {@link Animation.restore}; the earlier capture stays valid.
|
|
53
|
+
*/
|
|
54
|
+
begin?(): void;
|
|
55
|
+
/**
|
|
56
|
+
* Writes the state for local time `t` (clamped to `[0, duration]` by the
|
|
57
|
+
* composites and by {@link animation}).
|
|
58
|
+
*/
|
|
59
|
+
seek(t: number): void;
|
|
60
|
+
/**
|
|
61
|
+
* Optional: writes the start state (what `seek(0)` would write for a leaf
|
|
62
|
+
* with no leading hold) **and keeps whatever {@link Animation.begin}
|
|
63
|
+
* captured**. Composites call it instead of `seek(0)` when a scrub rewinds
|
|
64
|
+
* to before the animation's start, and then skip `begin()` on re-entry. It
|
|
65
|
+
* matters for zero-length leaves (whose `seek` can only report the final
|
|
66
|
+
* value) and for `from`-style leaves (whose start state would otherwise be
|
|
67
|
+
* mistaken for the rest value). Does nothing if the animation was never
|
|
68
|
+
* entered. When omitted, composites fall back to `seek(0)` and re-arm the
|
|
69
|
+
* animation with `begin()` on re-entry (the pre-`restore` behaviour).
|
|
70
|
+
*/
|
|
71
|
+
restore?(): void;
|
|
72
|
+
/**
|
|
73
|
+
* Optional cleanup when the run is aborted while this animation is active
|
|
74
|
+
* (entered but not finished). The grow presets use it to snap back to rest.
|
|
75
|
+
* Presets that simply stop where they stand leave it undefined.
|
|
76
|
+
*/
|
|
77
|
+
abort?(): void;
|
|
78
|
+
}
|
|
79
|
+
/** The time a reduced-motion run of `animation` jumps to; see {@link Animation.restAt}. */
|
|
80
|
+
export declare function restTime(animation: Animation): number;
|
|
81
|
+
/**
|
|
82
|
+
* Normalises a requested seek time into `[0, duration]`, always finite.
|
|
83
|
+
*
|
|
84
|
+
* `NaN` and `-Infinity` mean the start (`0`); a finite or `+Infinity` time is
|
|
85
|
+
* clamped to `duration`. `+Infinity` on an *endless* animation has no end to
|
|
86
|
+
* land on, so it lands on `rest` (the reduced-motion rest state, finite by
|
|
87
|
+
* construction). Every `seek` path goes through this so a non-finite time can
|
|
88
|
+
* never reach arithmetic like `Infinity - Infinity`.
|
|
89
|
+
*/
|
|
90
|
+
export declare function sampleTime(t: number, duration: number, rest?: number): number;
|
|
91
|
+
/**
|
|
92
|
+
* Builds a custom leaf {@link Animation}.
|
|
93
|
+
*
|
|
94
|
+
* `seek` always receives a time clamped to `[0, duration]`, and `duration` is
|
|
95
|
+
* sanitised (negative or NaN becomes 0; `Infinity` is allowed). Use it for
|
|
96
|
+
* anything the track-driving builders ({@link driveTrack}, {@link driveProgress})
|
|
97
|
+
* do not cover.
|
|
98
|
+
*
|
|
99
|
+
* @param spec - The members of {@link Animation}.
|
|
100
|
+
* @returns The animation.
|
|
101
|
+
* @category Animation composition & timelines
|
|
102
|
+
*/
|
|
103
|
+
export declare function animation(spec: Animation): Animation;
|
|
104
|
+
/** Timing common to every eased leaf. */
|
|
105
|
+
export interface LeafTiming {
|
|
106
|
+
/**
|
|
107
|
+
* Seconds of eased motion; 0 lands immediately.
|
|
108
|
+
* @default 1
|
|
109
|
+
*/
|
|
110
|
+
duration?: number;
|
|
111
|
+
/**
|
|
112
|
+
* Seconds of leading hold inside the animation's own duration.
|
|
113
|
+
* @default 0
|
|
114
|
+
*/
|
|
115
|
+
delay?: number;
|
|
116
|
+
/**
|
|
117
|
+
* Easing curve name or function.
|
|
118
|
+
* @default `"smooth"`
|
|
119
|
+
*/
|
|
120
|
+
easing?: Easing;
|
|
121
|
+
}
|
|
122
|
+
/** What an eased leaf does at each sampled progress. */
|
|
123
|
+
export interface LeafHooks {
|
|
124
|
+
/** Capture start values (via `peek`). */
|
|
125
|
+
begin?: () => void;
|
|
126
|
+
/**
|
|
127
|
+
* Write state for eased progress `eased` (raw progress `raw`, uneased,
|
|
128
|
+
* 0..1).
|
|
129
|
+
*/
|
|
130
|
+
apply: (eased: number, raw: number) => void;
|
|
131
|
+
/** Cleanup when aborted while active. Only called if the leaf has begun. */
|
|
132
|
+
abort?: () => void;
|
|
133
|
+
/**
|
|
134
|
+
* Write the start state (progress 0) for the whole leading `delay` too,
|
|
135
|
+
* instead of staying silent until the delay ends. The grow presets use it
|
|
136
|
+
* so a delayed grow is hidden during its delay. Without it a delaying leaf
|
|
137
|
+
* does not touch the track until the delay is over (so it cannot clobber a
|
|
138
|
+
* concurrent animation of the same track), except to restore the start
|
|
139
|
+
* when it is rewound.
|
|
140
|
+
*/
|
|
141
|
+
holdStart?: boolean;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* The shared eased leaf: `[delay][duration of eased progress]`.
|
|
145
|
+
*
|
|
146
|
+
* Handles delay, zero-length animations (a zero-length `seek` reports only the
|
|
147
|
+
* final value; {@link Animation.restore} writes the start), easing, and lazy
|
|
148
|
+
* `begin` so a leaf can be seeked directly in a test without a composite
|
|
149
|
+
* around it.
|
|
150
|
+
*/
|
|
151
|
+
export declare function easedLeaf(timing: LeafTiming, hooks: LeafHooks): Animation;
|
|
152
|
+
/** A child placed at an offset inside a composite. */
|
|
153
|
+
export interface Placed {
|
|
154
|
+
animation: Animation;
|
|
155
|
+
/** Seconds after the composite's start at which the child begins. */
|
|
156
|
+
start: number;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Builds a composite from children placed at known offsets. `sequence`,
|
|
160
|
+
* `parallel` and `lagged` are all this with different offsets.
|
|
161
|
+
*
|
|
162
|
+
* Duration is `max(start + child.duration)`. See {@link Animation} for the
|
|
163
|
+
* seek semantics it implements.
|
|
164
|
+
*
|
|
165
|
+
* A steady-state seek costs O(active children + log n), not O(n): children
|
|
166
|
+
* are indexed by start and by end time, the active ones are kept in a list,
|
|
167
|
+
* and only a seek that moves *backwards* visits the children it crosses.
|
|
168
|
+
* The bookkeeping rests on two invariants that hold after every seek to
|
|
169
|
+
* `last`: a child that has been entered started at or before `last`, and a
|
|
170
|
+
* finished (DONE) child ended at or before `last`. So a forward seek can only
|
|
171
|
+
* enter children starting in `(last, now]`, and a backward one can only
|
|
172
|
+
* rewind children starting in `(now, last]` or reopen ones ending there.
|
|
173
|
+
*/
|
|
174
|
+
export declare function compose(children: Placed[]): Animation;
|
|
175
|
+
/**
|
|
176
|
+
* Where each cycle of a `repeat`/`forever` takes its start values from.
|
|
177
|
+
*
|
|
178
|
+
* - `"continue"`: from wherever the previous cycle left the tracks (the
|
|
179
|
+
* default). Relative animations accumulate.
|
|
180
|
+
* - `"fixed"`: from one capture taken when the repeat is first entered; every
|
|
181
|
+
* cycle restarts from it. Scrubbing is exact in both directions.
|
|
182
|
+
*
|
|
183
|
+
* @category Animation composition & timelines
|
|
184
|
+
*/
|
|
185
|
+
export type CycleStart = "continue" | "fixed";
|
|
186
|
+
/**
|
|
187
|
+
* Plays `inner` `times` times; the engine behind `repeat` and `forever`.
|
|
188
|
+
*
|
|
189
|
+
* Each cycle re-enters `inner`, so it captures its start values afresh from
|
|
190
|
+
* wherever the previous cycle left the tracks (a `forever` of
|
|
191
|
+
* `sequence(valueTo(a, 2), valueTo(a, 0))` loops without a jump, and a
|
|
192
|
+
* repeated relative move accumulates). A seek that jumps over cycles finishes
|
|
193
|
+
* each skipped cycle in turn so those captures are right (at most
|
|
194
|
+
* {@link MAX_REPLAYED_CYCLES} are replayed; older ones are skipped).
|
|
195
|
+
*
|
|
196
|
+
* Scrubbing *backwards* across a cycle boundary re-samples the earlier cycle
|
|
197
|
+
* with the start values captured for the most recent cycle, because the
|
|
198
|
+
* earlier capture is gone: exact for absolute animations, an offset for
|
|
199
|
+
* relative ones that accumulate.
|
|
200
|
+
*
|
|
201
|
+
* With `start: "fixed"` the animation is entered once and every cycle replays
|
|
202
|
+
* from that one capture (each new cycle first restores the start state, it
|
|
203
|
+
* does not recapture). Relative animations then repeat the same move instead
|
|
204
|
+
* of accumulating, and because no cycle depends on a previous one, a seek
|
|
205
|
+
* anywhere, in either direction, is exact.
|
|
206
|
+
*/
|
|
207
|
+
export declare function cycles(inner: Animation, times: number, start?: CycleStart): Animation;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creation animations — `draw` (Manim `Create`), `erase` (`Uncreate`), `write`, `drawBorderThenFill`.
|
|
3
|
+
*
|
|
4
|
+
* All of them drive a shape's `progress` track from 0 to 1; the renderer turns
|
|
5
|
+
* that into an arc-length reveal. A shape's polylines share one budget, spent in
|
|
6
|
+
* order, so a multi-part shape draws part by part rather than all at once.
|
|
7
|
+
*/
|
|
8
|
+
import type { Animatable } from "../tween/index.js";
|
|
9
|
+
import type { Animation, AnimOptions } from "./types.js";
|
|
10
|
+
/** @category Animation presets */
|
|
11
|
+
export interface DrawOptions extends AnimOptions {
|
|
12
|
+
/** Progress (0..1) to reset the track to before drawing; defaults to the track's current value. */
|
|
13
|
+
from?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Draws a shape on by tweening its `progress` track to 1, tip-first.
|
|
17
|
+
*
|
|
18
|
+
* Bind the track to a shape's `progress` prop; the renderer reveals the
|
|
19
|
+
* outline by arc length. Easing defaults to `"linear"` so the pen moves at a
|
|
20
|
+
* constant speed. Start the track at 0 (or pass `from`) for a full draw-on.
|
|
21
|
+
*
|
|
22
|
+
* @param progress - The shape's progress track, 0..1.
|
|
23
|
+
* @param options - Timing options plus `from`.
|
|
24
|
+
* @returns An {@link Animation}.
|
|
25
|
+
* @see {@link erase}
|
|
26
|
+
* @see {@link write}
|
|
27
|
+
*
|
|
28
|
+
* @category Animation presets
|
|
29
|
+
*/
|
|
30
|
+
export declare function draw(progress: Animatable<number>, options?: DrawOptions): Animation;
|
|
31
|
+
/**
|
|
32
|
+
* Erases a shape by tweening its `progress` track to 0.
|
|
33
|
+
*
|
|
34
|
+
* @param progress - The shape's progress track, 0..1.
|
|
35
|
+
* @param options - Timing options; `easing` defaults to `"linear"`.
|
|
36
|
+
* @returns An {@link Animation}.
|
|
37
|
+
*
|
|
38
|
+
* @category Animation presets
|
|
39
|
+
*/
|
|
40
|
+
export declare function erase(progress: Animatable<number>, options?: AnimOptions): Animation;
|
|
41
|
+
/**
|
|
42
|
+
* Options for {@link write}: {@link DrawOptions} plus the stagger between tracks.
|
|
43
|
+
*
|
|
44
|
+
* @category Animation presets
|
|
45
|
+
*/
|
|
46
|
+
export interface WriteOptions extends DrawOptions {
|
|
47
|
+
/**
|
|
48
|
+
* Seconds between consecutive starts. Ignored when `lagRatio` is given.
|
|
49
|
+
* @default 0.12
|
|
50
|
+
*/
|
|
51
|
+
lag?: number;
|
|
52
|
+
/** Manim's `lag_ratio`: start each when the previous is this fraction through. Takes precedence over `lag`. */
|
|
53
|
+
lagRatio?: number;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* `Write`: a staggered {@link draw} across several tracks, the way Manim
|
|
57
|
+
* draws one glyph after another.
|
|
58
|
+
*
|
|
59
|
+
* Pass one progress track per stroke or label, in drawing order. Each starts
|
|
60
|
+
* `lag` seconds after the previous one and runs for the full `duration`.
|
|
61
|
+
*
|
|
62
|
+
* @param progresses - One progress track (0..1) per element.
|
|
63
|
+
* @param options - Timing options plus the stagger: `lag`, seconds between starts (default 0.12), or `lagRatio` (see {@link lagged}). If both are given, `lagRatio` wins and `lag` is ignored.
|
|
64
|
+
* @returns An {@link Animation}.
|
|
65
|
+
* @category Animation presets
|
|
66
|
+
*/
|
|
67
|
+
export declare function write(progresses: Animatable<number>[], options?: WriteOptions): Animation;
|
|
68
|
+
/** @category Animation presets */
|
|
69
|
+
export interface UnwriteOptions extends AnimOptions {
|
|
70
|
+
/**
|
|
71
|
+
* Seconds between consecutive starts. Ignored when `lagRatio` is given.
|
|
72
|
+
* @default 0.12
|
|
73
|
+
*/
|
|
74
|
+
lag?: number;
|
|
75
|
+
/** Manim's `lag_ratio`: start each when the previous is this fraction through; takes precedence over `lag`. */
|
|
76
|
+
lagRatio?: number;
|
|
77
|
+
/**
|
|
78
|
+
* Erase from the end backwards, as Manim's `Unwrite` does. Writing runs left
|
|
79
|
+
* to right, so unwriting the same way looks like the text is being eaten
|
|
80
|
+
* from the front; going backwards reads as undoing it. Defaults to true.
|
|
81
|
+
*/
|
|
82
|
+
reverse?: boolean;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* `Unwrite` — `write` in reverse: a staggered `erase` across several tracks.
|
|
86
|
+
*
|
|
87
|
+
* The stagger runs from the last track to the first by default, so the stroke
|
|
88
|
+
* that was drawn last is the first to go.
|
|
89
|
+
*
|
|
90
|
+
* @category Animation presets
|
|
91
|
+
*/
|
|
92
|
+
export declare function unwrite(progresses: Animatable<number>[], options?: UnwriteOptions): Animation;
|
|
93
|
+
/**
|
|
94
|
+
* `DrawBorderThenFill`: traces the outline, then fades the fill in.
|
|
95
|
+
*
|
|
96
|
+
* The total `duration` (default 1.5 seconds) is split 65% on the outline and
|
|
97
|
+
* 35% on the fill. Bind the tracks to a shape's `progress` and `fillOpacity`.
|
|
98
|
+
*
|
|
99
|
+
* @param progress - Outline progress track, 0..1.
|
|
100
|
+
* @param fillOpacity - Fill opacity track, 0..1.
|
|
101
|
+
* @param options - Timing options plus `fillTo`, the final fill opacity (default 1).
|
|
102
|
+
* @returns An {@link Animation}.
|
|
103
|
+
*
|
|
104
|
+
* @category Animation presets
|
|
105
|
+
*/
|
|
106
|
+
export declare function drawBorderThenFill(progress: Animatable<number>, fillOpacity: Animatable<number>, options?: AnimOptions & {
|
|
107
|
+
fillTo?: number;
|
|
108
|
+
}): Animation;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Emphasis presets — `Indicate`, `Flash`, `Wiggle`, `Circumscribe`.
|
|
3
|
+
*
|
|
4
|
+
* These are the ones that are pure easing-curve tricks: each returns the track
|
|
5
|
+
* to exactly where it started, so they can be fired at any time without
|
|
6
|
+
* disturbing the scene's resting state.
|
|
7
|
+
*/
|
|
8
|
+
import type { Animatable } from "../tween/index.js";
|
|
9
|
+
import type { Animation, AnimOptions } from "./types.js";
|
|
10
|
+
/** @category Animation presets */
|
|
11
|
+
export interface IndicateOptions extends AnimOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Peak scale multiplier relative to the resting scale.
|
|
14
|
+
* @default 1.2
|
|
15
|
+
*/
|
|
16
|
+
factor?: number;
|
|
17
|
+
/** Colour track to flash to `highlight` and back; omit for a scale-only swell. */
|
|
18
|
+
color?: Animatable<string>;
|
|
19
|
+
/** CSS colour to flash to. Defaults to the theme's `palette.highlight`. */
|
|
20
|
+
highlight?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* `Indicate`: a quick swell and return, optionally with a colour flash.
|
|
24
|
+
*
|
|
25
|
+
* Scales up to `factor` times the resting scale and back, so the track ends
|
|
26
|
+
* where it began and the animation can be fired at any time. Duration defaults
|
|
27
|
+
* to 0.8 seconds.
|
|
28
|
+
*
|
|
29
|
+
* @param scale - Scale track to swell.
|
|
30
|
+
* @param options - Timing options plus {@link IndicateOptions} fields.
|
|
31
|
+
* @returns An {@link Animation}.
|
|
32
|
+
* @category Animation presets
|
|
33
|
+
*/
|
|
34
|
+
export declare function indicate(scale: Animatable<number>, options?: IndicateOptions): Animation;
|
|
35
|
+
/**
|
|
36
|
+
* `Flash`: a ring that expands outward while fading to transparent.
|
|
37
|
+
*
|
|
38
|
+
* Drive a circle whose radius and opacity are these two tracks. Opacity goes
|
|
39
|
+
* from 1 to 0; it is not restored afterwards.
|
|
40
|
+
*
|
|
41
|
+
* @param radius - Radius track in scene units.
|
|
42
|
+
* @param opacity - Opacity track, 0..1.
|
|
43
|
+
* @param options - Timing options (duration 0.6 s, easing `"out"` by
|
|
44
|
+
* default) plus `from` (start radius, default the track's value) and `to`
|
|
45
|
+
* (end radius, default 2.2 times the start).
|
|
46
|
+
* @returns An {@link Animation}.
|
|
47
|
+
*
|
|
48
|
+
* @category Animation presets
|
|
49
|
+
*/
|
|
50
|
+
export declare function flash(radius: Animatable<number>, opacity: Animatable<number>, options?: AnimOptions & {
|
|
51
|
+
to?: number;
|
|
52
|
+
from?: number;
|
|
53
|
+
}): Animation;
|
|
54
|
+
/**
|
|
55
|
+
* `Wiggle`: a damped rotational shake that settles back to rest.
|
|
56
|
+
*
|
|
57
|
+
* @param rotation - Rotation track, radians.
|
|
58
|
+
* @param options - Timing options (duration 0.7 s, linear) plus `amplitude`,
|
|
59
|
+
* the peak swing in radians (default 0.12), and `cycles`, the number of
|
|
60
|
+
* oscillations (default 3).
|
|
61
|
+
* @returns An {@link Animation}.
|
|
62
|
+
*
|
|
63
|
+
* @category Animation presets
|
|
64
|
+
*/
|
|
65
|
+
export declare function wiggle(rotation: Animatable<number>, options?: AnimOptions & {
|
|
66
|
+
amplitude?: number;
|
|
67
|
+
cycles?: number;
|
|
68
|
+
}): Animation;
|
|
69
|
+
/**
|
|
70
|
+
* A slow breathing pulse; useful as ambient emphasis under {@link forever}.
|
|
71
|
+
*
|
|
72
|
+
* @param scale - Scale track; returns to its starting value.
|
|
73
|
+
* @param options - Timing options (duration 1.6 s) plus `factor`, the peak
|
|
74
|
+
* multiplier (default 1.06).
|
|
75
|
+
* @returns An {@link Animation}.
|
|
76
|
+
* @category Animation presets
|
|
77
|
+
*/
|
|
78
|
+
export declare function pulse(scale: Animatable<number>, options?: AnimOptions & {
|
|
79
|
+
factor?: number;
|
|
80
|
+
}): Animation;
|
|
81
|
+
/**
|
|
82
|
+
* `Circumscribe`: draws a highlight shape around something, then erases it.
|
|
83
|
+
*
|
|
84
|
+
* Point it at the progress track of a rectangle or circle you keep hidden. The
|
|
85
|
+
* duration (default 1.2 seconds) is split evenly between drawing and erasing.
|
|
86
|
+
*
|
|
87
|
+
* @param progress - Progress track (0..1) of the highlight shape.
|
|
88
|
+
* @param options - Timing options; `easing` defaults to `"inOut"`.
|
|
89
|
+
* @returns An {@link Animation}.
|
|
90
|
+
*
|
|
91
|
+
* @category Animation presets
|
|
92
|
+
*/
|
|
93
|
+
export declare function circumscribe(progress: Animatable<number>, options?: AnimOptions): Animation;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fades. The whole category is one opacity tween, plus optional drift so
|
|
3
|
+
* `FadeIn(shift=UP)` has an equivalent.
|
|
4
|
+
*/
|
|
5
|
+
import type { Point } from "../geometry/index.js";
|
|
6
|
+
import type { Animatable } from "../tween/index.js";
|
|
7
|
+
import type { Animation, AnimOptions } from "./types.js";
|
|
8
|
+
/** @category Animation presets */
|
|
9
|
+
export interface FadeOptions extends AnimOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Opacity (0..1) that `fadeIn` ends on.
|
|
12
|
+
* @default 1
|
|
13
|
+
*/
|
|
14
|
+
to?: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Tweens an opacity track up to 1 (or `options.to`), easing out.
|
|
18
|
+
*
|
|
19
|
+
* It does not set the track to 0 first: the fade starts from the track's
|
|
20
|
+
* current value, so initialise the track to 0 for a fade from invisible.
|
|
21
|
+
*
|
|
22
|
+
* @param opacity - Opacity track, 0..1; pass `opacity()` to a shape's `opacity` prop.
|
|
23
|
+
* @param options - Timing options; `easing` defaults to `"out"`.
|
|
24
|
+
* @returns An {@link Animation}.
|
|
25
|
+
* @see {@link fadeOut}
|
|
26
|
+
* @see {@link fadeInFrom}
|
|
27
|
+
*
|
|
28
|
+
* @category Animation presets
|
|
29
|
+
*/
|
|
30
|
+
export declare function fadeIn(opacity: Animatable<number>, options?: FadeOptions): Animation;
|
|
31
|
+
/**
|
|
32
|
+
* Tweens an opacity track down to 0, easing in.
|
|
33
|
+
*
|
|
34
|
+
* @param opacity - Opacity track, 0..1.
|
|
35
|
+
* @param options - Timing options; `easing` defaults to `"in"`.
|
|
36
|
+
* @returns An {@link Animation}.
|
|
37
|
+
* @see {@link fadeIn}
|
|
38
|
+
*
|
|
39
|
+
* @category Animation presets
|
|
40
|
+
*/
|
|
41
|
+
export declare function fadeOut(opacity: Animatable<number>, options?: AnimOptions): Animation;
|
|
42
|
+
/**
|
|
43
|
+
* Tweens an opacity track to an arbitrary value.
|
|
44
|
+
*
|
|
45
|
+
* Identical to {@link valueTo}; it exists so "fade to half" reads naturally
|
|
46
|
+
* beside `fadeIn`/`fadeOut`. Easing defaults to `"smooth"`.
|
|
47
|
+
*
|
|
48
|
+
* @param opacity - Opacity track, 0..1.
|
|
49
|
+
* @param value - Target opacity.
|
|
50
|
+
* @param options - Timing options.
|
|
51
|
+
* @returns An {@link Animation}.
|
|
52
|
+
* @category Animation presets
|
|
53
|
+
*/
|
|
54
|
+
export declare function fadeTo(opacity: Animatable<number>, value: number, options?: AnimOptions): Animation;
|
|
55
|
+
/**
|
|
56
|
+
* `FadeIn(shift=...)`: fades in while sliding from an offset back to rest.
|
|
57
|
+
*
|
|
58
|
+
* When entered, the position is displaced by `offset` (and held there through
|
|
59
|
+
* any `delay`) and then tweened back to where it was, so the track ends where
|
|
60
|
+
* it started and composes with layout.
|
|
61
|
+
*
|
|
62
|
+
* @param opacity - Opacity track, 0..1.
|
|
63
|
+
* @param position - Position track in scene units.
|
|
64
|
+
* @param offset - Displacement in scene units to start from (e.g. `{ x: 0, y: -1 }`).
|
|
65
|
+
* @param options - Timing options; `easing` defaults to `"out"`.
|
|
66
|
+
* @returns An {@link Animation}.
|
|
67
|
+
*
|
|
68
|
+
* @category Animation presets
|
|
69
|
+
*/
|
|
70
|
+
export declare function fadeInFrom(opacity: Animatable<number>, position: Animatable<Point>, offset: Point, options?: FadeOptions): Animation;
|
|
71
|
+
/**
|
|
72
|
+
* `FadeOut(shift=...)`: fades out while drifting away by `offset`.
|
|
73
|
+
*
|
|
74
|
+
* @param opacity - Opacity track, 0..1.
|
|
75
|
+
* @param position - Position track in scene units; ends at its start plus `offset`.
|
|
76
|
+
* @param offset - Displacement in scene units.
|
|
77
|
+
* @param options - Timing options; `easing` defaults to `"in"`.
|
|
78
|
+
* @returns An {@link Animation}.
|
|
79
|
+
*
|
|
80
|
+
* @category Animation presets
|
|
81
|
+
*/
|
|
82
|
+
export declare function fadeOutTo(opacity: Animatable<number>, position: Animatable<Point>, offset: Point, options?: AnimOptions): Animation;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Growing presets (Manim's `growing`): bring a shape in by scale rather than by
|
|
3
|
+
* arc length. The rest value is captured on entry (`peek`), the start state is
|
|
4
|
+
* held through `delay`, and an aborted grow snaps back to rest so a cancelled
|
|
5
|
+
* script never leaves a shape half-size or invisible.
|
|
6
|
+
*/
|
|
7
|
+
import type { Bounds, Point } from "../geometry/index.js";
|
|
8
|
+
import type { Animatable } from "../tween/index.js";
|
|
9
|
+
import type { Animation, AnimOptions } from "./types.js";
|
|
10
|
+
/**
|
|
11
|
+
* `GrowFromCenter` — the shape swells from nothing about its own centre.
|
|
12
|
+
*
|
|
13
|
+
* Drives a scale track from 0 to wherever it was resting. The component's
|
|
14
|
+
* `origin` decides what "centre" means; left unset that is the shape's own
|
|
15
|
+
* bounding-box centre, which is exactly Manim's behaviour.
|
|
16
|
+
*
|
|
17
|
+
* This is also Manim's `GrowArrow`: set `origin={tail}` on an `arrow()` and the
|
|
18
|
+
* scale track pivots on the tail. It inflates a small complete arrow, head and
|
|
19
|
+
* all, where `draw()` draws a full-size one progressively.
|
|
20
|
+
*
|
|
21
|
+
* @param scale - Scale track; its value when the animation is entered is the resting scale.
|
|
22
|
+
* @param options - Timing options; duration 1 s and easing `"out"` by default.
|
|
23
|
+
* @returns An {@link Animation}.
|
|
24
|
+
* @category Animation presets
|
|
25
|
+
*/
|
|
26
|
+
export declare function growFromCenter(scale: Animatable<number>, options?: AnimOptions): Animation;
|
|
27
|
+
/**
|
|
28
|
+
* `ShrinkToCenter`: the inverse of {@link growFromCenter}; the scale collapses
|
|
29
|
+
* to 0.
|
|
30
|
+
*
|
|
31
|
+
* @param scale - Scale track.
|
|
32
|
+
* @param options - Timing options; duration 1 s and easing `"in"` by default.
|
|
33
|
+
* @returns An {@link Animation}.
|
|
34
|
+
*
|
|
35
|
+
* @category Animation presets
|
|
36
|
+
*/
|
|
37
|
+
export declare function shrinkToCenter(scale: Animatable<number>, options?: AnimOptions): Animation;
|
|
38
|
+
/**
|
|
39
|
+
* `GrowFromPoint` — the shape grows while travelling from `from` to its resting
|
|
40
|
+
* position, so it reads as having been thrown from somewhere.
|
|
41
|
+
*
|
|
42
|
+
* Built the same way as `fadeInFrom`: displace first, then tween both tracks
|
|
43
|
+
* back together. Because both resting values are captured on entry, this
|
|
44
|
+
* composes with layout — the shape lands wherever it would have been anyway.
|
|
45
|
+
*
|
|
46
|
+
* @param scale - Scale track.
|
|
47
|
+
* @param position - Position track in scene units.
|
|
48
|
+
* @param from - Scene-space point the shape starts at.
|
|
49
|
+
* @param options - Timing options; duration 1 s and easing `"out"` by default.
|
|
50
|
+
* @returns An {@link Animation}.
|
|
51
|
+
*
|
|
52
|
+
* @category Animation presets
|
|
53
|
+
*/
|
|
54
|
+
export declare function growFromPoint(scale: Animatable<number>, position: Animatable<Point>, from: Point, options?: AnimOptions): Animation;
|
|
55
|
+
/**
|
|
56
|
+
* Manim's `GrowFromEdge`: the shape unfolds from one edge or corner of its own
|
|
57
|
+
* box, which stays pinned. Any direction works (`{ x: 0.5, y: 1 }` is a point
|
|
58
|
+
* along the top edge). Pass the shape's resting box, `handle()?.localBounds()`.
|
|
59
|
+
*
|
|
60
|
+
* @param scale - Scale track.
|
|
61
|
+
* @param position - Position track.
|
|
62
|
+
* @param bounds - The shape's resting box, in the shape's local coordinates.
|
|
63
|
+
* @param direction - Anchor on the box, e.g. `{ x: -1, y: 0 }` for the left edge.
|
|
64
|
+
* @param options - Timing options; duration 1 s and easing `"out"` by default.
|
|
65
|
+
* @returns An {@link Animation}.
|
|
66
|
+
*
|
|
67
|
+
* @category Animation presets
|
|
68
|
+
*/
|
|
69
|
+
export declare function growFromEdge(scale: Animatable<number>, position: Animatable<Point>, bounds: Bounds, direction: Point, options?: AnimOptions): Animation;
|
|
70
|
+
/** @category Animation presets */
|
|
71
|
+
export interface SpinInOptions extends AnimOptions {
|
|
72
|
+
/**
|
|
73
|
+
* Turn to arrive through, in radians. Defaults to Manim's quarter turn.
|
|
74
|
+
* @default Math.PI / 2
|
|
75
|
+
*/
|
|
76
|
+
turn?: number;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* `SpinInFromNothing` — grows while rotating into place.
|
|
80
|
+
*
|
|
81
|
+
* The rotation *ends* at rest, so the shape settles at whatever angle the scene
|
|
82
|
+
* had it; only the approach spins. Both tracks are driven together, so easing
|
|
83
|
+
* applies to the pair and the spin can't outrun the growth.
|
|
84
|
+
*
|
|
85
|
+
* @param scale - Scale track.
|
|
86
|
+
* @param rotation - Rotation track, radians.
|
|
87
|
+
* @param options - Timing options plus `turn`; duration 1 s and easing `"out"` by default.
|
|
88
|
+
* @returns An {@link Animation}.
|
|
89
|
+
*
|
|
90
|
+
* @category Animation presets
|
|
91
|
+
*/
|
|
92
|
+
export declare function spinInFromNothing(scale: Animatable<number>, rotation: Animatable<number>, options?: SpinInOptions): Animation;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type { Animation, CycleStart, LeafHooks, LeafTiming, Placed, } from "./animation.js";
|
|
2
|
+
export { animation, compose, cycles, EPSILON, easedLeaf, restTime, sampleTime, } from "./animation.js";
|
|
3
|
+
export type { DrawOptions, UnwriteOptions, WriteOptions } from "./draw.js";
|
|
4
|
+
export { draw, drawBorderThenFill, erase, unwrite, write } from "./draw.js";
|
|
5
|
+
export type { IndicateOptions } from "./emphasis.js";
|
|
6
|
+
export { circumscribe, flash, indicate, pulse, wiggle } from "./emphasis.js";
|
|
7
|
+
export type { FadeOptions } from "./fade.js";
|
|
8
|
+
export { fadeIn, fadeInFrom, fadeOut, fadeOutTo, fadeTo } from "./fade.js";
|
|
9
|
+
export type { SpinInOptions } from "./growing.js";
|
|
10
|
+
export { growFromCenter, growFromEdge, growFromPoint, shrinkToCenter, spinInFromNothing, } from "./growing.js";
|
|
11
|
+
export type { ApplyWaveOptions, BlinkOptions, FocusOnOptions, } from "./indication.js";
|
|
12
|
+
export { applyWave, blink, focusOn, passingFlash, showPassingFlash, } from "./indication.js";
|
|
13
|
+
export type { MoveOptions } from "./move.js";
|
|
14
|
+
export { colorTo, moveAlong, moveBy, moveTo, rotateBy, rotateTo, scaleTo, valueTo, } from "./move.js";
|
|
15
|
+
export type { ApplyFunctionOptions, PhaseFlowOptions, PointMapOptions, } from "./movement.js";
|
|
16
|
+
export { applyComplexFunction, applyFunction, homotopy, phaseFlow, } from "./movement.js";
|
|
17
|
+
export type { LaggedOptions, RepeatOptions } from "./sequence.js";
|
|
18
|
+
export { forever, hold, lagged, parallel, repeat, sequence, } from "./sequence.js";
|
|
19
|
+
export type { ArcMotionOptions, CircleSlotsOptions, GridSlotsOptions, Motion, MotionContext, Presence, RowSlotsOptions, SlotItem, SlotLayout, SlotOpOptions, SlotPlan, Slots, SlotsOptions, } from "./slots.js";
|
|
20
|
+
export { arcMotion, circleSlots, createSlots, gridSlots, rowSlots, } from "./slots.js";
|
|
21
|
+
export type { SpeedSpec } from "./speed.js";
|
|
22
|
+
export { changeSpeed } from "./speed.js";
|
|
23
|
+
export type { FollowOptions, SpringToOptions } from "./spring.js";
|
|
24
|
+
export { follow, springTo } from "./spring.js";
|
|
25
|
+
export type { PlayContext, PlayResult, Timeline, TimelineInternals, } from "./timeline.js";
|
|
26
|
+
export { anySignal, play, splitPlayArguments, timeline, timelineInternals, } from "./timeline.js";
|
|
27
|
+
export type { MorphOptions } from "./transform.js";
|
|
28
|
+
export { morph, morphCurve, morphPath, morphWith } from "./transform.js";
|
|
29
|
+
export type { TweenOptions } from "./tween.js";
|
|
30
|
+
export { tween, wait } from "./tween.js";
|
|
31
|
+
export type { AnimOptions, DriveProgressOptions, DriveTrackOptions, } from "./types.js";
|
|
32
|
+
export { driveProgress, driveTrack } from "./types.js";
|