manim-web 0.15.0 → 0.16.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/dist/a11y/ariaNarration.d.ts +70 -0
- package/dist/a11y/ariaNarration.d.ts.map +1 -0
- package/dist/a11y/captions.d.ts +71 -0
- package/dist/a11y/captions.d.ts.map +1 -0
- package/dist/a11y/reducedMotion.d.ts +68 -0
- package/dist/a11y/reducedMotion.d.ts.map +1 -0
- package/dist/core/Scene.d.ts.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/integrations/react.js +17 -17
- package/dist/integrations/vue.js +16 -16
- package/dist/manim-web.browser.js +2146 -1879
- package/dist/mobjects/graphing/VectorField.d.ts +53 -2
- package/dist/mobjects/graphing/VectorField.d.ts.map +1 -1
- package/dist/mobjects/graphing/index.d.ts +1 -1
- package/dist/mobjects/graphing/index.d.ts.map +1 -1
- package/dist/mobjects/text/Text.d.ts.map +1 -1
- package/dist/mobjects/text/textTexture.d.ts +33 -0
- package/dist/mobjects/text/textTexture.d.ts.map +1 -0
- package/dist/{src-Da4luuzD.js → src-CIYJhSa5.js} +2128 -1861
- package/dist/utils/oklab.d.ts +75 -0
- package/dist/utils/oklab.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Oklab and Oklch perceptual color interpolation.
|
|
3
|
+
*
|
|
4
|
+
* manim-web interpolates colors in the stored sRGB space (see
|
|
5
|
+
* {@link interpolateColor} in `./color`). That space is not perceptually
|
|
6
|
+
* uniform, so a straight blend of two saturated colors passes through a muddy,
|
|
7
|
+
* desaturated midpoint. Oklab is a perceptually-uniform color space by Björn
|
|
8
|
+
* Ottosson; its polar form Oklch separates lightness, chroma and hue. A blend
|
|
9
|
+
* in either space keeps the midpoint bright and vivid.
|
|
10
|
+
*
|
|
11
|
+
* This module is opt-in. The default interpolation space does not change.
|
|
12
|
+
* manim-web still models a color as a `#rrggbb` hex string, so the public
|
|
13
|
+
* helpers here take and return hex strings, matching `interpolateColor`.
|
|
14
|
+
*
|
|
15
|
+
* The math follows Björn Ottosson's reference implementation:
|
|
16
|
+
* - sRGB companding (gamma) to and from linear light.
|
|
17
|
+
* - The two 3x3 matrices between linear sRGB and the LMS cone responses.
|
|
18
|
+
* - The cube-root nonlinearity on the LMS values.
|
|
19
|
+
* See https://bottosson.github.io/posts/oklab/ for the source matrices.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* An Oklab color as `[L, a, b]`.
|
|
23
|
+
*
|
|
24
|
+
* `L` is perceptual lightness in 0.0..1.0. `a` is the green-red axis and `b` is
|
|
25
|
+
* the blue-yellow axis; both are roughly in -0.4..0.4 for in-gamut sRGB colors.
|
|
26
|
+
*/
|
|
27
|
+
export type Oklab = [number, number, number];
|
|
28
|
+
/**
|
|
29
|
+
* An Oklch color as `[L, C, h]`, the polar form of Oklab.
|
|
30
|
+
*
|
|
31
|
+
* `L` is perceptual lightness in 0.0..1.0. `C` is chroma (>= 0). `h` is hue in
|
|
32
|
+
* degrees, in 0.0..360.0.
|
|
33
|
+
*/
|
|
34
|
+
export type Oklch = [number, number, number];
|
|
35
|
+
/** Convert a color (hex string) to Oklab `[L, a, b]`. */
|
|
36
|
+
export declare function colorToOklab(color: string): Oklab;
|
|
37
|
+
/**
|
|
38
|
+
* Convert an Oklab `[L, a, b]` array to a color (hex string).
|
|
39
|
+
*
|
|
40
|
+
* Channels that fall outside the sRGB gamut are clamped to 0..255.
|
|
41
|
+
*/
|
|
42
|
+
export declare function oklabToColor(lab: Oklab): string;
|
|
43
|
+
/** Convert an Oklab `[L, a, b]` array to Oklch `[L, C, h]` (hue in degrees). */
|
|
44
|
+
export declare function oklabToOklch(lab: Oklab): Oklch;
|
|
45
|
+
/** Convert an Oklch `[L, C, h]` array (hue in degrees) to Oklab `[L, a, b]`. */
|
|
46
|
+
export declare function oklchToOklab(lch: Oklch): Oklab;
|
|
47
|
+
/** Convert a color (hex string) to Oklch `[L, C, h]` (hue in degrees). */
|
|
48
|
+
export declare function colorToOklch(color: string): Oklch;
|
|
49
|
+
/**
|
|
50
|
+
* Convert an Oklch `[L, C, h]` array (hue in degrees) to a color (hex string).
|
|
51
|
+
*
|
|
52
|
+
* Channels that fall outside the sRGB gamut are clamped to 0..255.
|
|
53
|
+
*/
|
|
54
|
+
export declare function oklchToColor(lch: Oklch): string;
|
|
55
|
+
/**
|
|
56
|
+
* Interpolate two colors in Oklab space and return the result as a hex string.
|
|
57
|
+
*
|
|
58
|
+
* This is the perceptual counterpart of {@link interpolateColor}. `alpha` of
|
|
59
|
+
* 0.0 yields `color1`, 1.0 yields `color2`. The midpoint stays bright and
|
|
60
|
+
* vivid instead of passing through a muddy linear-RGB blend.
|
|
61
|
+
*/
|
|
62
|
+
export declare function interpolateColorOklab(color1: string, color2: string, alpha: number): string;
|
|
63
|
+
/**
|
|
64
|
+
* Interpolate two colors in Oklch space and return the result as a hex string.
|
|
65
|
+
*
|
|
66
|
+
* This blends lightness and chroma linearly, and hue along the shortest arc of
|
|
67
|
+
* the color circle. `alpha` of 0.0 yields `color1`, 1.0 yields `color2`. The
|
|
68
|
+
* result tracks a natural hue sweep, so a red-to-green blend stays saturated
|
|
69
|
+
* through orange instead of graying out.
|
|
70
|
+
*
|
|
71
|
+
* When one endpoint is achromatic (chroma near 0), its hue is undefined, so the
|
|
72
|
+
* hue of the other endpoint is used to avoid an arbitrary sweep.
|
|
73
|
+
*/
|
|
74
|
+
export declare function interpolateColorOklch(color1: string, color2: string, alpha: number): string;
|
|
75
|
+
//# sourceMappingURL=oklab.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oklab.d.ts","sourceRoot":"","sources":["../../src/utils/oklab.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAyBH;;;;;GAKG;AACH,MAAM,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AA0D7C,yDAAyD;AACzD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,CAIjD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,KAAK,GAAG,MAAM,CAQ/C;AAED,gFAAgF;AAChF,wBAAgB,YAAY,CAAC,GAAG,EAAE,KAAK,GAAG,KAAK,CAQ9C;AAED,gFAAgF;AAChF,wBAAgB,YAAY,CAAC,GAAG,EAAE,KAAK,GAAG,KAAK,CAI9C;AAED,0EAA0E;AAC1E,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,CAEjD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,KAAK,GAAG,MAAM,CAE/C;AAOD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAI3F;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAsB3F"}
|