@smoove/core 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 +80 -0
- package/dist/animation/color.d.ts +9 -0
- package/dist/animation/color.d.ts.map +1 -0
- package/dist/animation/color.js +224 -0
- package/dist/animation/color.js.map +1 -0
- package/dist/animation/easing.d.ts +22 -0
- package/dist/animation/easing.d.ts.map +1 -0
- package/dist/animation/easing.js +59 -0
- package/dist/animation/easing.js.map +1 -0
- package/dist/animation/interpolate-colors.d.ts +7 -0
- package/dist/animation/interpolate-colors.d.ts.map +1 -0
- package/dist/animation/interpolate-colors.js +19 -0
- package/dist/animation/interpolate-colors.js.map +1 -0
- package/dist/animation/interpolate.d.ts +12 -0
- package/dist/animation/interpolate.d.ts.map +1 -0
- package/dist/animation/interpolate.js +65 -0
- package/dist/animation/interpolate.js.map +1 -0
- package/dist/audio/asset.d.ts +21 -0
- package/dist/audio/asset.d.ts.map +1 -0
- package/dist/audio/asset.js +2 -0
- package/dist/audio/asset.js.map +1 -0
- package/dist/audio/audio-driver.d.ts +34 -0
- package/dist/audio/audio-driver.d.ts.map +1 -0
- package/dist/audio/audio-driver.js +2 -0
- package/dist/audio/audio-driver.js.map +1 -0
- package/dist/audio/audio-for-preview.d.ts +12 -0
- package/dist/audio/audio-for-preview.d.ts.map +1 -0
- package/dist/audio/audio-for-preview.js +70 -0
- package/dist/audio/audio-for-preview.js.map +1 -0
- package/dist/audio/audio-for-rendering.d.ts +16 -0
- package/dist/audio/audio-for-rendering.d.ts.map +1 -0
- package/dist/audio/audio-for-rendering.js +32 -0
- package/dist/audio/audio-for-rendering.js.map +1 -0
- package/dist/audio/audio-source-browser.d.ts +30 -0
- package/dist/audio/audio-source-browser.d.ts.map +1 -0
- package/dist/audio/audio-source-browser.js +139 -0
- package/dist/audio/audio-source-browser.js.map +1 -0
- package/dist/audio/audio-source.d.ts +38 -0
- package/dist/audio/audio-source.d.ts.map +1 -0
- package/dist/audio/audio-source.js +2 -0
- package/dist/audio/audio-source.js.map +1 -0
- package/dist/audio/index.d.ts +45 -0
- package/dist/audio/index.d.ts.map +1 -0
- package/dist/audio/index.js +143 -0
- package/dist/audio/index.js.map +1 -0
- package/dist/audio/mixer.d.ts +43 -0
- package/dist/audio/mixer.d.ts.map +1 -0
- package/dist/audio/mixer.js +51 -0
- package/dist/audio/mixer.js.map +1 -0
- package/dist/audio/types.d.ts +31 -0
- package/dist/audio/types.d.ts.map +1 -0
- package/dist/audio/types.js +2 -0
- package/dist/audio/types.js.map +1 -0
- package/dist/block.d.ts +16 -0
- package/dist/block.d.ts.map +1 -0
- package/dist/block.js +173 -0
- package/dist/block.js.map +1 -0
- package/dist/composition.d.ts.map +1 -0
- package/dist/composition.js.map +1 -0
- package/dist/easing.d.ts +22 -0
- package/dist/easing.d.ts.map +1 -0
- package/dist/easing.js +59 -0
- package/dist/easing.js.map +1 -0
- package/dist/emitter.d.ts +7 -0
- package/dist/emitter.d.ts.map +1 -0
- package/dist/emitter.js +29 -0
- package/dist/emitter.js.map +1 -0
- package/dist/engine/composition.d.ts +182 -0
- package/dist/engine/composition.d.ts.map +1 -0
- package/dist/engine/composition.js +527 -0
- package/dist/engine/composition.js.map +1 -0
- package/dist/engine/emitter.d.ts +7 -0
- package/dist/engine/emitter.d.ts.map +1 -0
- package/dist/engine/emitter.js +29 -0
- package/dist/engine/emitter.js.map +1 -0
- package/dist/engine/environment.d.ts +30 -0
- package/dist/engine/environment.d.ts.map +1 -0
- package/dist/engine/environment.js +27 -0
- package/dist/engine/environment.js.map +1 -0
- package/dist/engine/offsets.d.ts +39 -0
- package/dist/engine/offsets.d.ts.map +1 -0
- package/dist/engine/offsets.js +54 -0
- package/dist/engine/offsets.js.map +1 -0
- package/dist/engine/runtime-defaults.d.ts +50 -0
- package/dist/engine/runtime-defaults.d.ts.map +1 -0
- package/dist/engine/runtime-defaults.js +77 -0
- package/dist/engine/runtime-defaults.js.map +1 -0
- package/dist/engine/sequence.d.ts +44 -0
- package/dist/engine/sequence.d.ts.map +1 -0
- package/dist/engine/sequence.js +101 -0
- package/dist/engine/sequence.js.map +1 -0
- package/dist/engine/series.d.ts +40 -0
- package/dist/engine/series.d.ts.map +1 -0
- package/dist/engine/series.js +58 -0
- package/dist/engine/series.js.map +1 -0
- package/dist/engine/signal.d.ts +10 -0
- package/dist/engine/signal.d.ts.map +1 -0
- package/dist/engine/signal.js +39 -0
- package/dist/engine/signal.js.map +1 -0
- package/dist/environment.d.ts.map +1 -0
- package/dist/environment.js.map +1 -0
- package/dist/flex-engine.d.ts +31 -0
- package/dist/flex-engine.d.ts.map +1 -0
- package/dist/flex-engine.js +186 -0
- package/dist/flex-engine.js.map +1 -0
- package/dist/flex-types.d.ts +165 -0
- package/dist/flex-types.d.ts.map +1 -0
- package/dist/flex-types.js +2 -0
- package/dist/flex-types.js.map +1 -0
- package/dist/flex.d.ts +26 -0
- package/dist/flex.d.ts.map +1 -0
- package/dist/flex.js +179 -0
- package/dist/flex.js.map +1 -0
- package/dist/image.d.ts +10 -0
- package/dist/image.d.ts.map +1 -0
- package/dist/image.js +156 -0
- package/dist/image.js.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/interpolate-colors.d.ts +7 -0
- package/dist/interpolate-colors.d.ts.map +1 -0
- package/dist/interpolate-colors.js +240 -0
- package/dist/interpolate-colors.js.map +1 -0
- package/dist/interpolate.d.ts +12 -0
- package/dist/interpolate.d.ts.map +1 -0
- package/dist/interpolate.js +65 -0
- package/dist/interpolate.js.map +1 -0
- package/dist/layout/block.d.ts +54 -0
- package/dist/layout/block.d.ts.map +1 -0
- package/dist/layout/block.js +186 -0
- package/dist/layout/block.js.map +1 -0
- package/dist/layout/contract.d.ts +41 -0
- package/dist/layout/contract.d.ts.map +1 -0
- package/dist/layout/contract.js +8 -0
- package/dist/layout/contract.js.map +1 -0
- package/dist/layout/flex/engine.d.ts +31 -0
- package/dist/layout/flex/engine.d.ts.map +1 -0
- package/dist/layout/flex/engine.js +186 -0
- package/dist/layout/flex/engine.js.map +1 -0
- package/dist/layout/flex/flex.d.ts +31 -0
- package/dist/layout/flex/flex.d.ts.map +1 -0
- package/dist/layout/flex/flex.js +175 -0
- package/dist/layout/flex/flex.js.map +1 -0
- package/dist/layout/flex/mixin.d.ts +52 -0
- package/dist/layout/flex/mixin.d.ts.map +1 -0
- package/dist/layout/flex/mixin.js +114 -0
- package/dist/layout/flex/mixin.js.map +1 -0
- package/dist/layout/flex/types.d.ts +31 -0
- package/dist/layout/flex/types.d.ts.map +1 -0
- package/dist/layout/flex/types.js +2 -0
- package/dist/layout/flex/types.js.map +1 -0
- package/dist/layout/image.d.ts +46 -0
- package/dist/layout/image.d.ts.map +1 -0
- package/dist/layout/image.js +198 -0
- package/dist/layout/image.js.map +1 -0
- package/dist/layout/shapes.d.ts +72 -0
- package/dist/layout/shapes.d.ts.map +1 -0
- package/dist/layout/shapes.js +29 -0
- package/dist/layout/shapes.js.map +1 -0
- package/dist/layout/text/font.d.ts +92 -0
- package/dist/layout/text/font.d.ts.map +1 -0
- package/dist/layout/text/font.js +166 -0
- package/dist/layout/text/font.js.map +1 -0
- package/dist/layout/text/geometry.d.ts +31 -0
- package/dist/layout/text/geometry.d.ts.map +1 -0
- package/dist/layout/text/geometry.js +81 -0
- package/dist/layout/text/geometry.js.map +1 -0
- package/dist/layout/text/text.d.ts +98 -0
- package/dist/layout/text/text.d.ts.map +1 -0
- package/dist/layout/text/text.js +676 -0
- package/dist/layout/text/text.js.map +1 -0
- package/dist/layout/text/types.d.ts +103 -0
- package/dist/layout/text/types.d.ts.map +1 -0
- package/dist/layout/text/types.js +2 -0
- package/dist/layout/text/types.js.map +1 -0
- package/dist/media/audio/asset.d.ts +21 -0
- package/dist/media/audio/asset.d.ts.map +1 -0
- package/dist/media/audio/asset.js +2 -0
- package/dist/media/audio/asset.js.map +1 -0
- package/dist/media/audio/audio-driver.d.ts +34 -0
- package/dist/media/audio/audio-driver.d.ts.map +1 -0
- package/dist/media/audio/audio-driver.js +2 -0
- package/dist/media/audio/audio-driver.js.map +1 -0
- package/dist/media/audio/audio-for-preview.d.ts +47 -0
- package/dist/media/audio/audio-for-preview.d.ts.map +1 -0
- package/dist/media/audio/audio-for-preview.js +232 -0
- package/dist/media/audio/audio-for-preview.js.map +1 -0
- package/dist/media/audio/audio-for-rendering.d.ts +16 -0
- package/dist/media/audio/audio-for-rendering.d.ts.map +1 -0
- package/dist/media/audio/audio-for-rendering.js +32 -0
- package/dist/media/audio/audio-for-rendering.js.map +1 -0
- package/dist/media/audio/audio-source-browser.d.ts +30 -0
- package/dist/media/audio/audio-source-browser.d.ts.map +1 -0
- package/dist/media/audio/audio-source-browser.js +139 -0
- package/dist/media/audio/audio-source-browser.js.map +1 -0
- package/dist/media/audio/audio-source-mediabunny.d.ts +45 -0
- package/dist/media/audio/audio-source-mediabunny.d.ts.map +1 -0
- package/dist/media/audio/audio-source-mediabunny.js +79 -0
- package/dist/media/audio/audio-source-mediabunny.js.map +1 -0
- package/dist/media/audio/audio-source.d.ts +38 -0
- package/dist/media/audio/audio-source.d.ts.map +1 -0
- package/dist/media/audio/audio-source.js +2 -0
- package/dist/media/audio/audio-source.js.map +1 -0
- package/dist/media/audio/index.d.ts +57 -0
- package/dist/media/audio/index.d.ts.map +1 -0
- package/dist/media/audio/index.js +170 -0
- package/dist/media/audio/index.js.map +1 -0
- package/dist/media/audio/mixer.d.ts +43 -0
- package/dist/media/audio/mixer.d.ts.map +1 -0
- package/dist/media/audio/mixer.js +51 -0
- package/dist/media/audio/mixer.js.map +1 -0
- package/dist/media/audio/shared-audio-context.d.ts +30 -0
- package/dist/media/audio/shared-audio-context.d.ts.map +1 -0
- package/dist/media/audio/shared-audio-context.js +68 -0
- package/dist/media/audio/shared-audio-context.js.map +1 -0
- package/dist/media/audio/types.d.ts +31 -0
- package/dist/media/audio/types.d.ts.map +1 -0
- package/dist/media/audio/types.js +2 -0
- package/dist/media/audio/types.js.map +1 -0
- package/dist/media/media-marker.d.ts +26 -0
- package/dist/media/media-marker.d.ts.map +1 -0
- package/dist/media/media-marker.js +26 -0
- package/dist/media/media-marker.js.map +1 -0
- package/dist/media/media-time.d.ts +17 -0
- package/dist/media/media-time.d.ts.map +1 -0
- package/dist/media/media-time.js +17 -0
- package/dist/media/media-time.js.map +1 -0
- package/dist/media/video/driver.d.ts +31 -0
- package/dist/media/video/driver.d.ts.map +1 -0
- package/dist/media/video/driver.js +3 -0
- package/dist/media/video/driver.js.map +1 -0
- package/dist/media/video/index.d.ts +66 -0
- package/dist/media/video/index.d.ts.map +1 -0
- package/dist/media/video/index.js +372 -0
- package/dist/media/video/index.js.map +1 -0
- package/dist/media/video/types.d.ts +36 -0
- package/dist/media/video/types.d.ts.map +1 -0
- package/dist/media/video/types.js +2 -0
- package/dist/media/video/types.js.map +1 -0
- package/dist/media/video/video-for-preview.d.ts +17 -0
- package/dist/media/video/video-for-preview.d.ts.map +1 -0
- package/dist/media/video/video-for-preview.js +30 -0
- package/dist/media/video/video-for-preview.js.map +1 -0
- package/dist/media/video/video-for-rendering.d.ts +17 -0
- package/dist/media/video/video-for-rendering.d.ts.map +1 -0
- package/dist/media/video/video-for-rendering.js +59 -0
- package/dist/media/video/video-for-rendering.js.map +1 -0
- package/dist/media/video/video-source-browser.d.ts +37 -0
- package/dist/media/video/video-source-browser.d.ts.map +1 -0
- package/dist/media/video/video-source-browser.js +171 -0
- package/dist/media/video/video-source-browser.js.map +1 -0
- package/dist/media/video/video-source-mediabunny.d.ts +69 -0
- package/dist/media/video/video-source-mediabunny.d.ts.map +1 -0
- package/dist/media/video/video-source-mediabunny.js +236 -0
- package/dist/media/video/video-source-mediabunny.js.map +1 -0
- package/dist/media/video/video-source.d.ts +48 -0
- package/dist/media/video/video-source.d.ts.map +1 -0
- package/dist/media/video/video-source.js +2 -0
- package/dist/media/video/video-source.js.map +1 -0
- package/dist/media-marker.d.ts +19 -0
- package/dist/media-marker.d.ts.map +1 -0
- package/dist/media-marker.js +19 -0
- package/dist/media-marker.js.map +1 -0
- package/dist/media-time.d.ts +17 -0
- package/dist/media-time.d.ts.map +1 -0
- package/dist/media-time.js +17 -0
- package/dist/media-time.js.map +1 -0
- package/dist/signal.d.ts +10 -0
- package/dist/signal.d.ts.map +1 -0
- package/dist/signal.js +39 -0
- package/dist/signal.js.map +1 -0
- package/dist/text.d.ts +91 -0
- package/dist/text.d.ts.map +1 -0
- package/dist/text.js +704 -0
- package/dist/text.js.map +1 -0
- package/dist/video/driver.d.ts +31 -0
- package/dist/video/driver.d.ts.map +1 -0
- package/dist/video/driver.js +3 -0
- package/dist/video/driver.js.map +1 -0
- package/dist/video/index.d.ts +45 -0
- package/dist/video/index.d.ts.map +1 -0
- package/dist/video/index.js +276 -0
- package/dist/video/index.js.map +1 -0
- package/dist/video/types.d.ts +35 -0
- package/dist/video/types.d.ts.map +1 -0
- package/dist/video/types.js +2 -0
- package/dist/video/types.js.map +1 -0
- package/dist/video/video-for-preview.d.ts +12 -0
- package/dist/video/video-for-preview.d.ts.map +1 -0
- package/dist/video/video-for-preview.js +73 -0
- package/dist/video/video-for-preview.js.map +1 -0
- package/dist/video/video-for-rendering.d.ts +16 -0
- package/dist/video/video-for-rendering.d.ts.map +1 -0
- package/dist/video/video-for-rendering.js +45 -0
- package/dist/video/video-for-rendering.js.map +1 -0
- package/dist/video/video-source-browser.d.ts +37 -0
- package/dist/video/video-source-browser.d.ts.map +1 -0
- package/dist/video/video-source-browser.js +171 -0
- package/dist/video/video-source-browser.js.map +1 -0
- package/dist/video/video-source.d.ts +48 -0
- package/dist/video/video-source.d.ts.map +1 -0
- package/dist/video/video-source.js +2 -0
- package/dist/video/video-source.js.map +1 -0
- package/package.json +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 shemi
|
|
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
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# @smoove/core
|
|
2
|
+
|
|
3
|
+
Remotion-style timeline-driven animation for [Konva](https://konvajs.org).
|
|
4
|
+
|
|
5
|
+
A **Composition** is a `Konva.Stage` that owns a frame clock (fps +
|
|
6
|
+
duration). A **Sequence** is a `Konva.Layer` scoped to a frame range: its
|
|
7
|
+
updaters run and its layer paints only while the playhead is in range. The
|
|
8
|
+
engine is agnostic — `play()` uses `requestAnimationFrame` in the browser;
|
|
9
|
+
on the server, step frames manually with `setFrame(n)` for offline
|
|
10
|
+
rendering.
|
|
11
|
+
|
|
12
|
+
Core also ships a built-in flexbox layout system (`Flex`, `Block`), a
|
|
13
|
+
rich `Text` node, `Image`/`Video`/`Audio` media nodes, `interpolate` +
|
|
14
|
+
`Easing` animation helpers, and a flex-aware wrapper for every Konva shape
|
|
15
|
+
(`Rect`, `Circle`, `Star`, ...) — so an app imports its whole drawing
|
|
16
|
+
vocabulary from one place.
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
pnpm add @smoove/core konva
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`konva` is a peer dependency, so you pin the version. The package is
|
|
25
|
+
ESM-only.
|
|
26
|
+
|
|
27
|
+
## Quick example
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { Circle, Composition, Easing, interpolate, Sequence } from "@smoove/core";
|
|
31
|
+
|
|
32
|
+
const comp = new Composition({
|
|
33
|
+
id: "main",
|
|
34
|
+
fps: 30,
|
|
35
|
+
durationInFrames: 300,
|
|
36
|
+
container: "root",
|
|
37
|
+
width: 800,
|
|
38
|
+
height: 600,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// A sequence covering the whole composition, like a "root" layer.
|
|
42
|
+
const main = new Sequence({ from: 0, durationInFrames: 300 });
|
|
43
|
+
const circle = new Circle({ x: 100, y: 300, radius: 40, fill: "tomato" });
|
|
44
|
+
main.add(circle);
|
|
45
|
+
comp.add(main);
|
|
46
|
+
|
|
47
|
+
main.register((frame) => {
|
|
48
|
+
circle.x(interpolate(frame, [0, 300], [100, 700], { easing: Easing.inOut(Easing.quad) }));
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// A sequence with its own layer, only painted while in range.
|
|
52
|
+
const flash = new Sequence({ from: 90, durationInFrames: 60 });
|
|
53
|
+
comp.add(flash);
|
|
54
|
+
flash.register((localFrame) => {
|
|
55
|
+
flash.opacity(1 - localFrame / 60);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
comp.play();
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Chain scenes back-to-back with `Series`, and overlap them with cross-fades,
|
|
62
|
+
wipes, and WebGL shader transitions via
|
|
63
|
+
[`@smoove/transitions`](https://www.npmjs.com/package/@smoove/transitions).
|
|
64
|
+
|
|
65
|
+
## Ecosystem
|
|
66
|
+
|
|
67
|
+
- [`@smoove/player`](https://www.npmjs.com/package/@smoove/player) — `<smoove-player>` web-component player with controls
|
|
68
|
+
- [`@smoove/transitions`](https://www.npmjs.com/package/@smoove/transitions) — Remotion-style `TransitionSeries` scene transitions
|
|
69
|
+
- [`@smoove/renderer`](https://www.npmjs.com/package/@smoove/renderer) — headless Node video renderer (skia-canvas + Mediabunny)
|
|
70
|
+
- [`@smoove/studio`](https://www.npmjs.com/package/@smoove/studio) — composable React studio UI
|
|
71
|
+
- [`@smoove/google-fonts`](https://www.npmjs.com/package/@smoove/google-fonts) — typed, tree-shakeable Google Fonts
|
|
72
|
+
- [`@smoove/vite`](https://www.npmjs.com/package/@smoove/vite) — Vite plugin for the studio
|
|
73
|
+
|
|
74
|
+
## Docs
|
|
75
|
+
|
|
76
|
+
Full documentation lives at [smoove.dev](https://smoove.dev).
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
MIT
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type RGBA = {
|
|
2
|
+
r: number;
|
|
3
|
+
g: number;
|
|
4
|
+
b: number;
|
|
5
|
+
a: number;
|
|
6
|
+
};
|
|
7
|
+
/** Parse a CSS color string (named, hex, `rgb[a]()`, `hsl[a]()`) into RGBA components. */
|
|
8
|
+
export declare const parseColor: (input: string) => RGBA;
|
|
9
|
+
//# sourceMappingURL=color.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../src/animation/color.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAmLlE,0FAA0F;AAC1F,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,KAAG,IAiD1C,CAAC"}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
// CSS named colors (CSS Color Module Level 4).
|
|
2
|
+
const NAMED_COLORS = {
|
|
3
|
+
aliceblue: "#f0f8ff",
|
|
4
|
+
antiquewhite: "#faebd7",
|
|
5
|
+
aqua: "#00ffff",
|
|
6
|
+
aquamarine: "#7fffd4",
|
|
7
|
+
azure: "#f0ffff",
|
|
8
|
+
beige: "#f5f5dc",
|
|
9
|
+
bisque: "#ffe4c4",
|
|
10
|
+
black: "#000000",
|
|
11
|
+
blanchedalmond: "#ffebcd",
|
|
12
|
+
blue: "#0000ff",
|
|
13
|
+
blueviolet: "#8a2be2",
|
|
14
|
+
brown: "#a52a2a",
|
|
15
|
+
burlywood: "#deb887",
|
|
16
|
+
cadetblue: "#5f9ea0",
|
|
17
|
+
chartreuse: "#7fff00",
|
|
18
|
+
chocolate: "#d2691e",
|
|
19
|
+
coral: "#ff7f50",
|
|
20
|
+
cornflowerblue: "#6495ed",
|
|
21
|
+
cornsilk: "#fff8dc",
|
|
22
|
+
crimson: "#dc143c",
|
|
23
|
+
cyan: "#00ffff",
|
|
24
|
+
darkblue: "#00008b",
|
|
25
|
+
darkcyan: "#008b8b",
|
|
26
|
+
darkgoldenrod: "#b8860b",
|
|
27
|
+
darkgray: "#a9a9a9",
|
|
28
|
+
darkgreen: "#006400",
|
|
29
|
+
darkgrey: "#a9a9a9",
|
|
30
|
+
darkkhaki: "#bdb76b",
|
|
31
|
+
darkmagenta: "#8b008b",
|
|
32
|
+
darkolivegreen: "#556b2f",
|
|
33
|
+
darkorange: "#ff8c00",
|
|
34
|
+
darkorchid: "#9932cc",
|
|
35
|
+
darkred: "#8b0000",
|
|
36
|
+
darksalmon: "#e9967a",
|
|
37
|
+
darkseagreen: "#8fbc8f",
|
|
38
|
+
darkslateblue: "#483d8b",
|
|
39
|
+
darkslategray: "#2f4f4f",
|
|
40
|
+
darkslategrey: "#2f4f4f",
|
|
41
|
+
darkturquoise: "#00ced1",
|
|
42
|
+
darkviolet: "#9400d3",
|
|
43
|
+
deeppink: "#ff1493",
|
|
44
|
+
deepskyblue: "#00bfff",
|
|
45
|
+
dimgray: "#696969",
|
|
46
|
+
dimgrey: "#696969",
|
|
47
|
+
dodgerblue: "#1e90ff",
|
|
48
|
+
firebrick: "#b22222",
|
|
49
|
+
floralwhite: "#fffaf0",
|
|
50
|
+
forestgreen: "#228b22",
|
|
51
|
+
fuchsia: "#ff00ff",
|
|
52
|
+
gainsboro: "#dcdcdc",
|
|
53
|
+
ghostwhite: "#f8f8ff",
|
|
54
|
+
gold: "#ffd700",
|
|
55
|
+
goldenrod: "#daa520",
|
|
56
|
+
gray: "#808080",
|
|
57
|
+
green: "#008000",
|
|
58
|
+
greenyellow: "#adff2f",
|
|
59
|
+
grey: "#808080",
|
|
60
|
+
honeydew: "#f0fff0",
|
|
61
|
+
hotpink: "#ff69b4",
|
|
62
|
+
indianred: "#cd5c5c",
|
|
63
|
+
indigo: "#4b0082",
|
|
64
|
+
ivory: "#fffff0",
|
|
65
|
+
khaki: "#f0e68c",
|
|
66
|
+
lavender: "#e6e6fa",
|
|
67
|
+
lavenderblush: "#fff0f5",
|
|
68
|
+
lawngreen: "#7cfc00",
|
|
69
|
+
lemonchiffon: "#fffacd",
|
|
70
|
+
lightblue: "#add8e6",
|
|
71
|
+
lightcoral: "#f08080",
|
|
72
|
+
lightcyan: "#e0ffff",
|
|
73
|
+
lightgoldenrodyellow: "#fafad2",
|
|
74
|
+
lightgray: "#d3d3d3",
|
|
75
|
+
lightgreen: "#90ee90",
|
|
76
|
+
lightgrey: "#d3d3d3",
|
|
77
|
+
lightpink: "#ffb6c1",
|
|
78
|
+
lightsalmon: "#ffa07a",
|
|
79
|
+
lightseagreen: "#20b2aa",
|
|
80
|
+
lightskyblue: "#87cefa",
|
|
81
|
+
lightslategray: "#778899",
|
|
82
|
+
lightslategrey: "#778899",
|
|
83
|
+
lightsteelblue: "#b0c4de",
|
|
84
|
+
lightyellow: "#ffffe0",
|
|
85
|
+
lime: "#00ff00",
|
|
86
|
+
limegreen: "#32cd32",
|
|
87
|
+
linen: "#faf0e6",
|
|
88
|
+
magenta: "#ff00ff",
|
|
89
|
+
maroon: "#800000",
|
|
90
|
+
mediumaquamarine: "#66cdaa",
|
|
91
|
+
mediumblue: "#0000cd",
|
|
92
|
+
mediumorchid: "#ba55d3",
|
|
93
|
+
mediumpurple: "#9370db",
|
|
94
|
+
mediumseagreen: "#3cb371",
|
|
95
|
+
mediumslateblue: "#7b68ee",
|
|
96
|
+
mediumspringgreen: "#00fa9a",
|
|
97
|
+
mediumturquoise: "#48d1cc",
|
|
98
|
+
mediumvioletred: "#c71585",
|
|
99
|
+
midnightblue: "#191970",
|
|
100
|
+
mintcream: "#f5fffa",
|
|
101
|
+
mistyrose: "#ffe4e1",
|
|
102
|
+
moccasin: "#ffe4b5",
|
|
103
|
+
navajowhite: "#ffdead",
|
|
104
|
+
navy: "#000080",
|
|
105
|
+
oldlace: "#fdf5e6",
|
|
106
|
+
olive: "#808000",
|
|
107
|
+
olivedrab: "#6b8e23",
|
|
108
|
+
orange: "#ffa500",
|
|
109
|
+
orangered: "#ff4500",
|
|
110
|
+
orchid: "#da70d6",
|
|
111
|
+
palegoldenrod: "#eee8aa",
|
|
112
|
+
palegreen: "#98fb98",
|
|
113
|
+
paleturquoise: "#afeeee",
|
|
114
|
+
palevioletred: "#db7093",
|
|
115
|
+
papayawhip: "#ffefd5",
|
|
116
|
+
peachpuff: "#ffdab9",
|
|
117
|
+
peru: "#cd853f",
|
|
118
|
+
pink: "#ffc0cb",
|
|
119
|
+
plum: "#dda0dd",
|
|
120
|
+
powderblue: "#b0e0e6",
|
|
121
|
+
purple: "#800080",
|
|
122
|
+
rebeccapurple: "#663399",
|
|
123
|
+
red: "#ff0000",
|
|
124
|
+
rosybrown: "#bc8f8f",
|
|
125
|
+
royalblue: "#4169e1",
|
|
126
|
+
saddlebrown: "#8b4513",
|
|
127
|
+
salmon: "#fa8072",
|
|
128
|
+
sandybrown: "#f4a460",
|
|
129
|
+
seagreen: "#2e8b57",
|
|
130
|
+
seashell: "#fff5ee",
|
|
131
|
+
sienna: "#a0522d",
|
|
132
|
+
silver: "#c0c0c0",
|
|
133
|
+
skyblue: "#87ceeb",
|
|
134
|
+
slateblue: "#6a5acd",
|
|
135
|
+
slategray: "#708090",
|
|
136
|
+
slategrey: "#708090",
|
|
137
|
+
snow: "#fffafa",
|
|
138
|
+
springgreen: "#00ff7f",
|
|
139
|
+
steelblue: "#4682b4",
|
|
140
|
+
tan: "#d2b48c",
|
|
141
|
+
teal: "#008080",
|
|
142
|
+
thistle: "#d8bfd8",
|
|
143
|
+
tomato: "#ff6347",
|
|
144
|
+
transparent: "#00000000",
|
|
145
|
+
turquoise: "#40e0d0",
|
|
146
|
+
violet: "#ee82ee",
|
|
147
|
+
wheat: "#f5deb3",
|
|
148
|
+
white: "#ffffff",
|
|
149
|
+
whitesmoke: "#f5f5f5",
|
|
150
|
+
yellow: "#ffff00",
|
|
151
|
+
yellowgreen: "#9acd32",
|
|
152
|
+
};
|
|
153
|
+
const hueToRgb = (p, q, t) => {
|
|
154
|
+
let h = t;
|
|
155
|
+
if (h < 0)
|
|
156
|
+
h += 1;
|
|
157
|
+
if (h > 1)
|
|
158
|
+
h -= 1;
|
|
159
|
+
if (h < 1 / 6)
|
|
160
|
+
return p + (q - p) * 6 * h;
|
|
161
|
+
if (h < 1 / 2)
|
|
162
|
+
return q;
|
|
163
|
+
if (h < 2 / 3)
|
|
164
|
+
return p + (q - p) * (2 / 3 - h) * 6;
|
|
165
|
+
return p;
|
|
166
|
+
};
|
|
167
|
+
const hslToRgb = (h, s, l) => {
|
|
168
|
+
if (s === 0) {
|
|
169
|
+
const v = Math.round(l * 255);
|
|
170
|
+
return [v, v, v];
|
|
171
|
+
}
|
|
172
|
+
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
173
|
+
const p = 2 * l - q;
|
|
174
|
+
return [
|
|
175
|
+
Math.round(hueToRgb(p, q, h + 1 / 3) * 255),
|
|
176
|
+
Math.round(hueToRgb(p, q, h) * 255),
|
|
177
|
+
Math.round(hueToRgb(p, q, h - 1 / 3) * 255),
|
|
178
|
+
];
|
|
179
|
+
};
|
|
180
|
+
/** Parse a CSS color string (named, hex, `rgb[a]()`, `hsl[a]()`) into RGBA components. */
|
|
181
|
+
export const parseColor = (input) => {
|
|
182
|
+
let color = input.trim().toLowerCase();
|
|
183
|
+
const named = NAMED_COLORS[color];
|
|
184
|
+
if (named)
|
|
185
|
+
color = named;
|
|
186
|
+
if (color.startsWith("#")) {
|
|
187
|
+
const hex = color.slice(1);
|
|
188
|
+
if (hex.length === 3 || hex.length === 4) {
|
|
189
|
+
const r = Number.parseInt(hex.charAt(0) + hex.charAt(0), 16);
|
|
190
|
+
const g = Number.parseInt(hex.charAt(1) + hex.charAt(1), 16);
|
|
191
|
+
const b = Number.parseInt(hex.charAt(2) + hex.charAt(2), 16);
|
|
192
|
+
const a = hex.length === 4 ? Number.parseInt(hex.charAt(3) + hex.charAt(3), 16) / 255 : 1;
|
|
193
|
+
return { r, g, b, a };
|
|
194
|
+
}
|
|
195
|
+
if (hex.length === 6 || hex.length === 8) {
|
|
196
|
+
const r = Number.parseInt(hex.slice(0, 2), 16);
|
|
197
|
+
const g = Number.parseInt(hex.slice(2, 4), 16);
|
|
198
|
+
const b = Number.parseInt(hex.slice(4, 6), 16);
|
|
199
|
+
const a = hex.length === 8 ? Number.parseInt(hex.slice(6, 8), 16) / 255 : 1;
|
|
200
|
+
return { r, g, b, a };
|
|
201
|
+
}
|
|
202
|
+
throw new Error(`interpolateColors(): invalid hex color "${input}"`);
|
|
203
|
+
}
|
|
204
|
+
const rgbMatch = color.match(/^rgba?\(\s*(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)\s*(?:,\s*(-?\d+(?:\.\d+)?)\s*)?\)$/);
|
|
205
|
+
if (rgbMatch) {
|
|
206
|
+
return {
|
|
207
|
+
r: Number(rgbMatch[1]),
|
|
208
|
+
g: Number(rgbMatch[2]),
|
|
209
|
+
b: Number(rgbMatch[3]),
|
|
210
|
+
a: rgbMatch[4] !== undefined ? Number(rgbMatch[4]) : 1,
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
const hslMatch = color.match(/^hsla?\(\s*(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*(?:,\s*(-?\d+(?:\.\d+)?)\s*)?\)$/);
|
|
214
|
+
if (hslMatch) {
|
|
215
|
+
const h = (((Number(hslMatch[1]) % 360) + 360) % 360) / 360;
|
|
216
|
+
const s = Number(hslMatch[2]) / 100;
|
|
217
|
+
const l = Number(hslMatch[3]) / 100;
|
|
218
|
+
const [r, g, b] = hslToRgb(h, s, l);
|
|
219
|
+
const a = hslMatch[4] !== undefined ? Number(hslMatch[4]) : 1;
|
|
220
|
+
return { r, g, b, a };
|
|
221
|
+
}
|
|
222
|
+
throw new Error(`interpolateColors(): unsupported color format "${input}"`);
|
|
223
|
+
};
|
|
224
|
+
//# sourceMappingURL=color.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.js","sourceRoot":"","sources":["../../src/animation/color.ts"],"names":[],"mappings":"AAEA,+CAA+C;AAC/C,MAAM,YAAY,GAA2B;IAC3C,SAAS,EAAE,SAAS;IACpB,YAAY,EAAE,SAAS;IACvB,IAAI,EAAE,SAAS;IACf,UAAU,EAAE,SAAS;IACrB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,SAAS;IACjB,KAAK,EAAE,SAAS;IAChB,cAAc,EAAE,SAAS;IACzB,IAAI,EAAE,SAAS;IACf,U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,CAAC;IAED,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAC1B,mHAAmH,CACpH,CAAC;IACF,IAAI,QAAQ,EAAE,CAAC;QACb,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;QAC5D,MAAM,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;QACpC,MAAM,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;QACpC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACpC,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9D,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IACxB,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,kDAAkD,KAAK,GAAG,CAAC,CAAC;AAC9E,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
type EasingFn = (t: number) => number;
|
|
2
|
+
export declare const Easing: {
|
|
3
|
+
linear: EasingFn;
|
|
4
|
+
ease: EasingFn;
|
|
5
|
+
quad: EasingFn;
|
|
6
|
+
cubic: EasingFn;
|
|
7
|
+
poly: (n: number) => EasingFn;
|
|
8
|
+
sin: EasingFn;
|
|
9
|
+
circle: EasingFn;
|
|
10
|
+
exp: EasingFn;
|
|
11
|
+
elastic: (bounciness?: number) => EasingFn;
|
|
12
|
+
back: (s?: number) => EasingFn;
|
|
13
|
+
bounce: EasingFn;
|
|
14
|
+
bezier: (x1: number, y1: number, x2: number, y2: number) => EasingFn;
|
|
15
|
+
step0: EasingFn;
|
|
16
|
+
step1: EasingFn;
|
|
17
|
+
in: (easing: EasingFn) => EasingFn;
|
|
18
|
+
out: (easing: EasingFn) => EasingFn;
|
|
19
|
+
inOut: (easing: EasingFn) => EasingFn;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=easing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"easing.d.ts","sourceRoot":"","sources":["../../src/animation/easing.ts"],"names":[],"mappings":"AAEA,KAAK,QAAQ,GAAG,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;AAoEtC,eAAO,MAAM,MAAM;;;;;cAzDb,MAAM,KAAG,QAAQ;;;;sCAWH,QAAQ;0BAOX,QAAQ;;iBAkBL,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,KAAG,QAAQ;;;iBAO/C,QAAQ,KAAG,QAAQ;kBAGlC,QAAQ,KAAG,QAAQ;oBAKnB,QAAQ,KAAG,QAAQ;CAwB7B,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import BezierEasing from "bezier-easing";
|
|
2
|
+
const linear = (t) => t;
|
|
3
|
+
const ease = BezierEasing(0.42, 0, 1, 1);
|
|
4
|
+
const quad = (t) => t * t;
|
|
5
|
+
const cubic = (t) => t * t * t;
|
|
6
|
+
const poly = (n) => (t) => t ** n;
|
|
7
|
+
const sin = (t) => 1 - Math.cos((t * Math.PI) / 2);
|
|
8
|
+
const circle = (t) => 1 - Math.sqrt(1 - t * t);
|
|
9
|
+
const exp = (t) => 2 ** (10 * (t - 1));
|
|
10
|
+
const elastic = (bounciness = 1) => (t) => {
|
|
11
|
+
const p = bounciness * Math.PI;
|
|
12
|
+
return 1 - Math.cos((t * Math.PI) / 2) ** 3 * Math.cos(t * p);
|
|
13
|
+
};
|
|
14
|
+
const back = (s = 1.70158) => (t) => t * t * ((s + 1) * t - s);
|
|
15
|
+
const bounce = (t) => {
|
|
16
|
+
if (t < 1 / 2.75)
|
|
17
|
+
return 7.5625 * t * t;
|
|
18
|
+
if (t < 2 / 2.75) {
|
|
19
|
+
const t2 = t - 1.5 / 2.75;
|
|
20
|
+
return 7.5625 * t2 * t2 + 0.75;
|
|
21
|
+
}
|
|
22
|
+
if (t < 2.5 / 2.75) {
|
|
23
|
+
const t2 = t - 2.25 / 2.75;
|
|
24
|
+
return 7.5625 * t2 * t2 + 0.9375;
|
|
25
|
+
}
|
|
26
|
+
const t2 = t - 2.625 / 2.75;
|
|
27
|
+
return 7.5625 * t2 * t2 + 0.984375;
|
|
28
|
+
};
|
|
29
|
+
const bezier = (x1, y1, x2, y2) => BezierEasing(x1, y1, x2, y2);
|
|
30
|
+
const step0 = (t) => (t > 0 ? 1 : 0);
|
|
31
|
+
const step1 = (t) => (t >= 1 ? 1 : 0);
|
|
32
|
+
// `in` is reserved — Remotion's API uses it as a method on `Easing`; identity here.
|
|
33
|
+
const inEasing = (easing) => easing;
|
|
34
|
+
const out = (easing) => (t) => 1 - easing(1 - t);
|
|
35
|
+
const inOut = (easing) => (t) => {
|
|
36
|
+
if (t < 0.5)
|
|
37
|
+
return easing(t * 2) / 2;
|
|
38
|
+
return 1 - easing((1 - t) * 2) / 2;
|
|
39
|
+
};
|
|
40
|
+
export const Easing = {
|
|
41
|
+
linear,
|
|
42
|
+
ease,
|
|
43
|
+
quad,
|
|
44
|
+
cubic,
|
|
45
|
+
poly,
|
|
46
|
+
sin,
|
|
47
|
+
circle,
|
|
48
|
+
exp,
|
|
49
|
+
elastic,
|
|
50
|
+
back,
|
|
51
|
+
bounce,
|
|
52
|
+
bezier,
|
|
53
|
+
step0,
|
|
54
|
+
step1,
|
|
55
|
+
in: inEasing,
|
|
56
|
+
out,
|
|
57
|
+
inOut,
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=easing.js.map
|
|
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CAAC,CAAC,CAAC;AAC/C,MAAM,KAAK,GAAa,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAEhD,oFAAoF;AACpF,MAAM,QAAQ,GAAG,CAAC,MAAgB,EAAY,EAAE,CAAC,MAAM,CAAC;AAExD,MAAM,GAAG,GACP,CAAC,MAAgB,EAAY,EAAE,CAC/B,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAEtB,MAAM,KAAK,GACT,CAAC,MAAgB,EAAY,EAAE,CAC/B,CAAC,CAAC,EAAE,EAAE;IACJ,IAAI,CAAC,GAAG,GAAG;QAAE,OAAO,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;AACrC,CAAC,CAAC;AAEJ,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,MAAM;IACN,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,GAAG;IACH,MAAM;IACN,GAAG;IACH,OAAO;IACP,IAAI;IACJ,MAAM;IACN,MAAM;IACN,KAAK;IACL,KAAK;IACL,EAAE,EAAE,QAAQ;IACZ,GAAG;IACH,KAAK;CACN,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interpolates between a list of colors. API-compatible with Remotion's
|
|
3
|
+
* `interpolateColors`. Returns an `rgba(r, g, b, a)` string. Extrapolation
|
|
4
|
+
* is clamped on both sides.
|
|
5
|
+
*/
|
|
6
|
+
export declare const interpolateColors: (input: number, inputRange: readonly number[], outputRange: readonly string[]) => string;
|
|
7
|
+
//# sourceMappingURL=interpolate-colors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interpolate-colors.d.ts","sourceRoot":"","sources":["../../src/animation/interpolate-colors.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAC5B,OAAO,MAAM,EACb,YAAY,SAAS,MAAM,EAAE,EAC7B,aAAa,SAAS,MAAM,EAAE,KAC7B,MAuCF,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { parseColor } from "./color.js";
|
|
2
|
+
import { interpolate } from "./interpolate.js";
|
|
3
|
+
/**
|
|
4
|
+
* Interpolates between a list of colors. API-compatible with Remotion's
|
|
5
|
+
* `interpolateColors`. Returns an `rgba(r, g, b, a)` string. Extrapolation
|
|
6
|
+
* is clamped on both sides.
|
|
7
|
+
*/
|
|
8
|
+
export const interpolateColors = (input, inputRange, outputRange) => {
|
|
9
|
+
if (inputRange.length !== outputRange.length) {
|
|
10
|
+
throw new Error("interpolateColors(): inputRange and outputRange must have the same length");
|
|
11
|
+
}
|
|
12
|
+
const parsed = outputRange.map(parseColor);
|
|
13
|
+
const r = Math.round(interpolate(input, inputRange, parsed.map((c) => c.r), { extrapolateLeft: "clamp", extrapolateRight: "clamp" }));
|
|
14
|
+
const g = Math.round(interpolate(input, inputRange, parsed.map((c) => c.g), { extrapolateLeft: "clamp", extrapolateRight: "clamp" }));
|
|
15
|
+
const b = Math.round(interpolate(input, inputRange, parsed.map((c) => c.b), { extrapolateLeft: "clamp", extrapolateRight: "clamp" }));
|
|
16
|
+
const a = interpolate(input, inputRange, parsed.map((c) => c.a), { extrapolateLeft: "clamp", extrapolateRight: "clamp" });
|
|
17
|
+
return `rgba(${r}, ${g}, ${b}, ${a})`;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=interpolate-colors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interpolate-colors.js","sourceRoot":"","sources":["../../src/animation/interpolate-colors.ts"],"names":[],"mappings":"AAAA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AAC,CAAC,EACtB,EAAE,eAAe,EAAE,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,CACxD,CAAC;IAEF,OAAO,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;AACxC,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type ExtrapolateType = "extend" | "identity" | "clamp" | "wrap";
|
|
2
|
+
export type InterpolateOptions = {
|
|
3
|
+
easing?: (input: number) => number;
|
|
4
|
+
extrapolateLeft?: ExtrapolateType;
|
|
5
|
+
extrapolateRight?: ExtrapolateType;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Maps `input` from `inputRange` onto `outputRange`. API-compatible with
|
|
9
|
+
* Remotion's `interpolate`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const interpolate: (input: number, inputRange: readonly number[], outputRange: readonly number[], options?: InterpolateOptions) => number;
|
|
12
|
+
//# sourceMappingURL=interpolate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interpolate.d.ts","sourceRoot":"","sources":["../../src/animation/interpolate.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC;AAEvE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACnC,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,gBAAgB,CAAC,EAAE,eAAe,CAAC;CACpC,CAAC;AAgDF;;;GAGG;AACH,eAAO,MAAM,WAAW,GACtB,OAAO,MAAM,EACb,YAAY,SAAS,MAAM,EAAE,EAC7B,aAAa,SAAS,MAAM,EAAE,EAC9B,UAAU,kBAAkB,KAC3B,MAiCF,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
const findRange = (input, inputRange) => {
|
|
2
|
+
let i = 1;
|
|
3
|
+
for (; i < inputRange.length - 1; i++) {
|
|
4
|
+
if (inputRange[i] >= input)
|
|
5
|
+
break;
|
|
6
|
+
}
|
|
7
|
+
return i - 1;
|
|
8
|
+
};
|
|
9
|
+
const interpolateSegment = (input, inputMin, inputMax, outputMin, outputMax, easing, extrapolateLeft, extrapolateRight) => {
|
|
10
|
+
let result = input;
|
|
11
|
+
if (result < inputMin) {
|
|
12
|
+
if (extrapolateLeft === "identity")
|
|
13
|
+
return result;
|
|
14
|
+
if (extrapolateLeft === "clamp")
|
|
15
|
+
result = inputMin;
|
|
16
|
+
else if (extrapolateLeft === "wrap") {
|
|
17
|
+
const range = inputMax - inputMin;
|
|
18
|
+
result = ((((result - inputMin) % range) + range) % range) + inputMin;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (result > inputMax) {
|
|
22
|
+
if (extrapolateRight === "identity")
|
|
23
|
+
return result;
|
|
24
|
+
if (extrapolateRight === "clamp")
|
|
25
|
+
result = inputMax;
|
|
26
|
+
else if (extrapolateRight === "wrap") {
|
|
27
|
+
const range = inputMax - inputMin;
|
|
28
|
+
result = ((((result - inputMin) % range) + range) % range) + inputMin;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (outputMin === outputMax)
|
|
32
|
+
return outputMin;
|
|
33
|
+
// Normalize and ease.
|
|
34
|
+
let t = (result - inputMin) / (inputMax - inputMin);
|
|
35
|
+
t = easing(t);
|
|
36
|
+
return outputMin + t * (outputMax - outputMin);
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Maps `input` from `inputRange` onto `outputRange`. API-compatible with
|
|
40
|
+
* Remotion's `interpolate`.
|
|
41
|
+
*/
|
|
42
|
+
export const interpolate = (input, inputRange, outputRange, options) => {
|
|
43
|
+
if (typeof input !== "number") {
|
|
44
|
+
throw new TypeError("interpolate(): input must be a number");
|
|
45
|
+
}
|
|
46
|
+
if (inputRange.length < 2 || outputRange.length < 2) {
|
|
47
|
+
throw new Error("interpolate(): inputRange and outputRange must have at least 2 elements");
|
|
48
|
+
}
|
|
49
|
+
if (inputRange.length !== outputRange.length) {
|
|
50
|
+
throw new Error("interpolate(): inputRange and outputRange must have the same length");
|
|
51
|
+
}
|
|
52
|
+
for (let i = 1; i < inputRange.length; i++) {
|
|
53
|
+
if (!(inputRange[i] > inputRange[i - 1])) {
|
|
54
|
+
throw new Error("interpolate(): inputRange must be strictly monotonically increasing");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (Number.isNaN(input))
|
|
58
|
+
return input;
|
|
59
|
+
const easing = options?.easing ?? ((n) => n);
|
|
60
|
+
const extrapolateLeft = options?.extrapolateLeft ?? "extend";
|
|
61
|
+
const extrapolateRight = options?.extrapolateRight ?? "extend";
|
|
62
|
+
const i = findRange(input, inputRange);
|
|
63
|
+
return interpolateSegment(input, inputRange[i], inputRange[i + 1], outputRange[i], outputRange[i + 1], easing, extrapolateLeft, extrapolateRight);
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=interpolate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interpolate.js","sourceRoot":"","sources":["../../src/animation/interpolate.ts"],"names":[],"mappings":"AAQA,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,UAA6B,EAAU,EAAE;IACzE,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,IAAK,UAAU,CAAC,CAAC,CAAY,IAAI,KAAK;YAAE,MAAM;IAChD,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,CAAC;AACf,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CACzB,KAAa,EACb,QAAgB,EAChB,QAAgB,EAChB,SAAiB,EACjB,SAAiB,EACjB,MAA6B,EAC7B,eAAgC,EAChC,gBAAiC,EACzB,EAAE;IACV,IAAI,MAAM,GAAG,KAAK,CAA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CAAC,GAAG,CAAC,CAAW,EAC5B,MAAM,EACN,eAAe,EACf,gBAAgB,CACjB,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A single audio playback sample captured during offline rendering — one per
|
|
3
|
+
* {@link Audio} per rendered frame. The engine never decodes audio while
|
|
4
|
+
* capturing canvas frames; instead the {@link RenderingAudioDriver} records
|
|
5
|
+
* these so an external pass (e.g. ffmpeg) can mux the audio track afterward.
|
|
6
|
+
*/
|
|
7
|
+
export type AudioAsset = {
|
|
8
|
+
/** Stable id of the source {@link Audio} node. */
|
|
9
|
+
id: string;
|
|
10
|
+
src: string;
|
|
11
|
+
/** Global composition frame this sample is for. */
|
|
12
|
+
frame: number;
|
|
13
|
+
/** Position into the source media, in seconds (from {@link getMediaTime}). */
|
|
14
|
+
mediaTime: number;
|
|
15
|
+
/** Effective level at this frame — `master × intrinsic`, 0..1. */
|
|
16
|
+
volume: number;
|
|
17
|
+
/** Effective mute at this frame — `masterMuted || intrinsicMuted`. */
|
|
18
|
+
muted: boolean;
|
|
19
|
+
playbackRate: number;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=asset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset.d.ts","sourceRoot":"","sources":["../../src/audio/asset.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,kDAAkD;IAClD,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,SAAS,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,MAAM,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,KAAK,EAAE,OAAO,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset.js","sourceRoot":"","sources":["../../src/audio/asset.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Composition } from "../composition.js";
|
|
2
|
+
import type { MediaTiming } from "../media-time.js";
|
|
3
|
+
import type { AudioSource } from "./audio-source.js";
|
|
4
|
+
/**
|
|
5
|
+
* What an audio driver needs from the host {@link Audio}: the media source, the
|
|
6
|
+
* resolved timing, the owning composition (for play state + asset collection),
|
|
7
|
+
* the source identity, and getters for the effective audio level so a render
|
|
8
|
+
* driver can record it. No `redraw` — audio paints nothing.
|
|
9
|
+
*/
|
|
10
|
+
export type AudioDriverContext = {
|
|
11
|
+
readonly source: AudioSource;
|
|
12
|
+
readonly timing: MediaTiming;
|
|
13
|
+
readonly comp: Composition;
|
|
14
|
+
readonly id: string;
|
|
15
|
+
readonly src: string;
|
|
16
|
+
/** Effective level (master × intrinsic), 0..1, at the current frame. */
|
|
17
|
+
effectiveVolume(): number;
|
|
18
|
+
/** Effective mute (masterMuted || intrinsicMuted) at the current frame. */
|
|
19
|
+
effectiveMuted(): boolean;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Strategy that maps the composition's current frame onto the audio. Mirrors
|
|
23
|
+
* {@link VideoDriver}: a realtime preview driver and a deterministic render
|
|
24
|
+
* driver (which collects assets rather than playing).
|
|
25
|
+
*/
|
|
26
|
+
export interface AudioDriver {
|
|
27
|
+
/** Called by Sequence each tick while the audio is on-stage (`localFrame` = frame - sequence.from). */
|
|
28
|
+
tick(localFrame: number): void;
|
|
29
|
+
/** Called by Sequence when the audio leaves range. */
|
|
30
|
+
deactivate(): void;
|
|
31
|
+
/** Release any subscriptions; called on `Audio.destroy()`. */
|
|
32
|
+
dispose(): void;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=audio-driver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audio-driver.d.ts","sourceRoot":"","sources":["../../src/audio/audio-driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,eAAe,IAAI,MAAM,CAAC;IAC1B,2EAA2E;IAC3E,cAAc,IAAI,OAAO,CAAC;CAC3B,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,uGAAuG;IACvG,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,sDAAsD;IACtD,UAAU,IAAI,IAAI,CAAC;IACnB,8DAA8D;IAC9D,OAAO,IAAI,IAAI,CAAC;CACjB"}
|