libraries-dev-svelte 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 +48 -0
- package/dist/bot-avatars/BotAvatar.svelte +368 -0
- package/dist/bot-avatars/BotAvatar.svelte.d.ts +4 -0
- package/dist/bot-avatars/color.d.ts +14 -0
- package/dist/bot-avatars/color.js +89 -0
- package/dist/bot-avatars/draw.d.ts +55 -0
- package/dist/bot-avatars/draw.js +495 -0
- package/dist/bot-avatars/engine.d.ts +138 -0
- package/dist/bot-avatars/engine.js +690 -0
- package/dist/bot-avatars/path-cache.d.ts +2 -0
- package/dist/bot-avatars/path-cache.js +10 -0
- package/dist/bot-avatars/plastic.d.ts +80 -0
- package/dist/bot-avatars/plastic.js +839 -0
- package/dist/bot-avatars/presets.d.ts +12 -0
- package/dist/bot-avatars/presets.js +34 -0
- package/dist/bot-avatars/shapes.d.ts +4 -0
- package/dist/bot-avatars/shapes.js +27 -0
- package/dist/bot-avatars/ticker.d.ts +8 -0
- package/dist/bot-avatars/ticker.js +52 -0
- package/dist/bot-avatars/types.d.ts +163 -0
- package/dist/bot-avatars/types.js +1 -0
- package/dist/gooey-radial-menu/GooeyRadialMenu.svelte +747 -0
- package/dist/gooey-radial-menu/GooeyRadialMenu.svelte.d.ts +7 -0
- package/dist/gooey-radial-menu/motion.d.ts +2 -0
- package/dist/gooey-radial-menu/motion.js +34 -0
- package/dist/gooey-radial-menu/shadow.d.ts +10 -0
- package/dist/gooey-radial-menu/shadow.js +54 -0
- package/dist/gooey-radial-menu/types.d.ts +28 -0
- package/dist/gooey-radial-menu/types.js +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +12 -0
- package/package.json +46 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { DrawConfig } from './draw';
|
|
2
|
+
/** The texture covers design units [-PAD, 100 + PAD]. */
|
|
3
|
+
export declare const PAD = 3;
|
|
4
|
+
export declare const SPAN: number;
|
|
5
|
+
/** the matcap's side, in cells */
|
|
6
|
+
export declare const MATCAP_SIZE = 64;
|
|
7
|
+
type V3 = [number, number, number];
|
|
8
|
+
export interface Form {
|
|
9
|
+
N: number;
|
|
10
|
+
/** bilinear cell in the matcap: index of the top-left cell … */
|
|
11
|
+
i00: Uint16Array;
|
|
12
|
+
/** … and the weights inside it, 0–255 */
|
|
13
|
+
wx: Uint8Array;
|
|
14
|
+
wy: Uint8Array;
|
|
15
|
+
/** baked occlusion × edge darkening, gamma-compensated, 0–255; 0 = not drawn */
|
|
16
|
+
ao: Uint8Array;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The form of one outline from its coverage raster (N × N, 0–255, over
|
|
20
|
+
* design units [-PAD, 100 + PAD]): a pillow height field, its normals as
|
|
21
|
+
* matcap cells, and baked occlusion; outside texels near the edge borrow
|
|
22
|
+
* their nearest inside texel so upscaling never bleeds transparent black.
|
|
23
|
+
*/
|
|
24
|
+
export declare function buildForm(cov: Uint8Array | Uint8ClampedArray, N: number, halfDepth: number): Form;
|
|
25
|
+
/** Coverage raster of the outline: N × N over design units [-PAD, 100 + PAD]. */
|
|
26
|
+
export declare function rasterize(path: Path2D, N: number): Uint8ClampedArray | null;
|
|
27
|
+
/** Build a form ahead of time (call from an idle callback at mount). */
|
|
28
|
+
export declare function warmPlastic(key: string, path: Path2D, devicePx?: number, depth?: number): void;
|
|
29
|
+
/** Texture size for an avatar `devicePx` wide (CSS px × device pixel ratio). */
|
|
30
|
+
export declare function tierFor(devicePx: number): number;
|
|
31
|
+
export interface Material {
|
|
32
|
+
shadow: number;
|
|
33
|
+
highlight: number;
|
|
34
|
+
spread: number;
|
|
35
|
+
rim: number;
|
|
36
|
+
}
|
|
37
|
+
export interface Frame {
|
|
38
|
+
L: V3;
|
|
39
|
+
V: V3;
|
|
40
|
+
H: V3;
|
|
41
|
+
U: V3;
|
|
42
|
+
W: V3;
|
|
43
|
+
A: V3;
|
|
44
|
+
B: V3;
|
|
45
|
+
}
|
|
46
|
+
/** Fill `out` (M × M × rgb, sRGB 0–255) with the lit sphere for body colour `c` (linear). */
|
|
47
|
+
export declare function buildMatcap(out: Float32Array, c: V3, f: Frame, p: Material): void;
|
|
48
|
+
/** Per frame: matcap lookup × baked AO into the texture's pixels. */
|
|
49
|
+
export declare function shadeTexels(form: Form, mc: Float32Array, px: Uint8ClampedArray, aoMul: Float32Array): void;
|
|
50
|
+
export interface Rig {
|
|
51
|
+
/** the rig's (floored) cos/sin of yaw and pitch, as used by the slice affines */
|
|
52
|
+
cy: number;
|
|
53
|
+
sy: number;
|
|
54
|
+
cp: number;
|
|
55
|
+
sp: number;
|
|
56
|
+
/** cos(yaw)·cos(pitch), unfloored: the front cap faces the viewer while positive */
|
|
57
|
+
facing: number;
|
|
58
|
+
roll: number;
|
|
59
|
+
halfDepth: number;
|
|
60
|
+
cap: number;
|
|
61
|
+
/** unit vector toward the light on screen */
|
|
62
|
+
lx: number;
|
|
63
|
+
ly: number;
|
|
64
|
+
/** the avatar box in device pixels (CSS px × dpr) */
|
|
65
|
+
dev: number;
|
|
66
|
+
/** the context's transform for body space (a, b, c, d, e, f): the
|
|
67
|
+
slices set theirs from it directly rather than through save/restore */
|
|
68
|
+
ctm: readonly number[];
|
|
69
|
+
/** no animation loop will follow: build the form now rather than on idle time */
|
|
70
|
+
still?: boolean;
|
|
71
|
+
}
|
|
72
|
+
/** Screen-space vectors into the cap's frame: un-roll, then the transpose
|
|
73
|
+
of the rig's rotation; the back cap is the front mirrored in z. */
|
|
74
|
+
export declare function capFrame(r: Rig): Frame;
|
|
75
|
+
/** A · B for canvas affines (a, b, c, d, e, f) */
|
|
76
|
+
export declare function mulAffine(A: readonly number[], B: readonly number[]): number[];
|
|
77
|
+
export declare function drawPlasticCap(ctx: CanvasRenderingContext2D, cfg: DrawConfig, rig: Rig, pal: {
|
|
78
|
+
base: string;
|
|
79
|
+
}, union: Path2D | null, mat: Material): boolean;
|
|
80
|
+
export {};
|