@vib3code/sdk 2.0.1
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/CHANGELOG.md +118 -0
- package/DOCS/BLUEPRINT_EXECUTION_PLAN_2026-01-07.md +34 -0
- package/DOCS/CI_TESTING.md +38 -0
- package/DOCS/CLI_ONBOARDING.md +75 -0
- package/DOCS/CONTROL_REFERENCE.md +64 -0
- package/DOCS/DEV_TRACK_ANALYSIS.md +77 -0
- package/DOCS/DEV_TRACK_PLAN_2026-01-07.md +42 -0
- package/DOCS/DEV_TRACK_SESSION_2026-01-31.md +220 -0
- package/DOCS/ENV_SETUP.md +189 -0
- package/DOCS/EXPORT_FORMATS.md +417 -0
- package/DOCS/GPU_DISPOSAL_GUIDE.md +21 -0
- package/DOCS/LICENSING_TIERS.md +275 -0
- package/DOCS/MASTER_PLAN_2026-01-31.md +570 -0
- package/DOCS/OBS_SETUP_GUIDE.md +98 -0
- package/DOCS/PROJECT_SETUP.md +66 -0
- package/DOCS/RENDERER_LIFECYCLE.md +40 -0
- package/DOCS/REPO_MANIFEST.md +121 -0
- package/DOCS/SESSION_014_PLAN.md +195 -0
- package/DOCS/SESSION_LOG_2026-01-07.md +56 -0
- package/DOCS/STRATEGIC_BLUEPRINT_2026-01-07.md +72 -0
- package/DOCS/SYSTEM_AUDIT_2026-01-30.md +738 -0
- package/DOCS/SYSTEM_INVENTORY.md +520 -0
- package/DOCS/TELEMETRY_EXPORTS.md +34 -0
- package/DOCS/WEBGPU_STATUS.md +38 -0
- package/DOCS/XR_BENCHMARKS.md +608 -0
- package/LICENSE +21 -0
- package/README.md +426 -0
- package/docs/.nojekyll +0 -0
- package/docs/01-dissolution_of_euclidean_hegemony.html +346 -0
- package/docs/02-hyperspatial_ego_death.html +346 -0
- package/docs/03-post_cartesian_sublime.html +346 -0
- package/docs/04-crystalline_void_meditation.html +346 -0
- package/docs/05-quantum_decoherence_ballet.html +346 -0
- package/docs/06-dissolution_of_euclidean_hegemony.html +346 -0
- package/docs/07-hyperspatial_ego_death.html +346 -0
- package/docs/08-post_cartesian_sublime.html +346 -0
- package/docs/09-crystalline_void_meditation.html +346 -0
- package/docs/10-quantum_decoherence_ballet.html +346 -0
- package/docs/11-dissolution_of_euclidean_hegemony.html +346 -0
- package/docs/12-hyperspatial_ego_death.html +346 -0
- package/docs/13-post_cartesian_sublime.html +346 -0
- package/docs/index.html +794 -0
- package/docs/test-hub.html +441 -0
- package/docs/url-state.js +102 -0
- package/docs/vib3-exports/01-quantum-quantum-tetrahedron-lattice.html +489 -0
- package/docs/vib3-exports/02-quantum-quantum-hypersphere-matrix.html +489 -0
- package/docs/vib3-exports/03-quantum-quantum-hypertetra-fractal.html +489 -0
- package/docs/vib3-exports/04-faceted-faceted-crystal-structure.html +407 -0
- package/docs/vib3-exports/05-faceted-faceted-klein-bottle.html +407 -0
- package/docs/vib3-exports/06-faceted-faceted-hypertetra-torus.html +407 -0
- package/docs/vib3-exports/07-holographic-holographic-wave-field.html +457 -0
- package/docs/vib3-exports/08-holographic-holographic-hypersphere-sphere.html +457 -0
- package/docs/vib3-exports/09-holographic-holographic-hypertetra-crystal.html +457 -0
- package/docs/vib3-exports/index.html +238 -0
- package/docs/webgpu-live.html +702 -0
- package/package.json +367 -0
- package/src/advanced/AIPresetGenerator.js +777 -0
- package/src/advanced/MIDIController.js +703 -0
- package/src/advanced/OffscreenWorker.js +1051 -0
- package/src/advanced/WebGPUCompute.js +1051 -0
- package/src/advanced/WebXRRenderer.js +680 -0
- package/src/agent/cli/AgentCLI.js +615 -0
- package/src/agent/cli/index.js +14 -0
- package/src/agent/index.js +73 -0
- package/src/agent/mcp/MCPServer.js +950 -0
- package/src/agent/mcp/index.js +9 -0
- package/src/agent/mcp/tools.js +548 -0
- package/src/agent/telemetry/EventStream.js +669 -0
- package/src/agent/telemetry/Instrumentation.js +618 -0
- package/src/agent/telemetry/TelemetryExporters.js +427 -0
- package/src/agent/telemetry/TelemetryService.js +464 -0
- package/src/agent/telemetry/index.js +52 -0
- package/src/benchmarks/BenchmarkRunner.js +381 -0
- package/src/benchmarks/MetricsCollector.js +299 -0
- package/src/benchmarks/index.js +9 -0
- package/src/benchmarks/scenes.js +259 -0
- package/src/cli/index.js +675 -0
- package/src/config/ApiConfig.js +88 -0
- package/src/core/CanvasManager.js +217 -0
- package/src/core/ErrorReporter.js +117 -0
- package/src/core/ParameterMapper.js +333 -0
- package/src/core/Parameters.js +396 -0
- package/src/core/RendererContracts.js +200 -0
- package/src/core/UnifiedResourceManager.js +370 -0
- package/src/core/VIB3Engine.js +636 -0
- package/src/core/renderers/FacetedRendererAdapter.js +32 -0
- package/src/core/renderers/HolographicRendererAdapter.js +29 -0
- package/src/core/renderers/QuantumRendererAdapter.js +29 -0
- package/src/core/renderers/RendererLifecycleManager.js +63 -0
- package/src/creative/ColorPresetsSystem.js +980 -0
- package/src/creative/ParameterTimeline.js +1061 -0
- package/src/creative/PostProcessingPipeline.js +1113 -0
- package/src/creative/TransitionAnimator.js +683 -0
- package/src/export/CSSExporter.js +226 -0
- package/src/export/CardGeneratorBase.js +279 -0
- package/src/export/ExportManager.js +580 -0
- package/src/export/FacetedCardGenerator.js +279 -0
- package/src/export/HolographicCardGenerator.js +543 -0
- package/src/export/LottieExporter.js +552 -0
- package/src/export/QuantumCardGenerator.js +315 -0
- package/src/export/SVGExporter.js +519 -0
- package/src/export/ShaderExporter.js +903 -0
- package/src/export/TradingCardGenerator.js +3055 -0
- package/src/export/TradingCardManager.js +181 -0
- package/src/export/VIB3PackageExporter.js +559 -0
- package/src/export/index.js +14 -0
- package/src/export/systems/TradingCardSystemFaceted.js +494 -0
- package/src/export/systems/TradingCardSystemHolographic.js +452 -0
- package/src/export/systems/TradingCardSystemQuantum.js +411 -0
- package/src/faceted/FacetedSystem.js +963 -0
- package/src/features/CollectionManager.js +433 -0
- package/src/gallery/CollectionManager.js +240 -0
- package/src/gallery/GallerySystem.js +485 -0
- package/src/geometry/GeometryFactory.js +314 -0
- package/src/geometry/GeometryLibrary.js +72 -0
- package/src/geometry/buffers/BufferBuilder.js +338 -0
- package/src/geometry/buffers/index.js +18 -0
- package/src/geometry/generators/Crystal.js +420 -0
- package/src/geometry/generators/Fractal.js +298 -0
- package/src/geometry/generators/KleinBottle.js +197 -0
- package/src/geometry/generators/Sphere.js +192 -0
- package/src/geometry/generators/Tesseract.js +160 -0
- package/src/geometry/generators/Tetrahedron.js +225 -0
- package/src/geometry/generators/Torus.js +304 -0
- package/src/geometry/generators/Wave.js +341 -0
- package/src/geometry/index.js +142 -0
- package/src/geometry/warp/HypersphereCore.js +211 -0
- package/src/geometry/warp/HypertetraCore.js +386 -0
- package/src/geometry/warp/index.js +57 -0
- package/src/holograms/HolographicVisualizer.js +1073 -0
- package/src/holograms/RealHolographicSystem.js +966 -0
- package/src/holograms/variantRegistry.js +69 -0
- package/src/integrations/FigmaPlugin.js +854 -0
- package/src/integrations/OBSMode.js +754 -0
- package/src/integrations/ThreeJsPackage.js +660 -0
- package/src/integrations/TouchDesignerExport.js +552 -0
- package/src/integrations/frameworks/Vib3React.js +591 -0
- package/src/integrations/frameworks/Vib3Svelte.js +654 -0
- package/src/integrations/frameworks/Vib3Vue.js +628 -0
- package/src/llm/LLMParameterInterface.js +240 -0
- package/src/llm/LLMParameterUI.js +577 -0
- package/src/math/Mat4x4.js +708 -0
- package/src/math/Projection.js +341 -0
- package/src/math/Rotor4D.js +637 -0
- package/src/math/Vec4.js +476 -0
- package/src/math/constants.js +164 -0
- package/src/math/index.js +68 -0
- package/src/math/projections.js +54 -0
- package/src/math/rotations.js +196 -0
- package/src/quantum/QuantumEngine.js +906 -0
- package/src/quantum/QuantumVisualizer.js +1103 -0
- package/src/reactivity/ReactivityConfig.js +499 -0
- package/src/reactivity/ReactivityManager.js +586 -0
- package/src/reactivity/SpatialInputSystem.js +1783 -0
- package/src/reactivity/index.js +93 -0
- package/src/render/CommandBuffer.js +465 -0
- package/src/render/MultiCanvasBridge.js +340 -0
- package/src/render/RenderCommand.js +514 -0
- package/src/render/RenderResourceRegistry.js +523 -0
- package/src/render/RenderState.js +552 -0
- package/src/render/RenderTarget.js +512 -0
- package/src/render/ShaderLoader.js +253 -0
- package/src/render/ShaderProgram.js +599 -0
- package/src/render/UnifiedRenderBridge.js +496 -0
- package/src/render/backends/WebGLBackend.js +1108 -0
- package/src/render/backends/WebGPUBackend.js +1409 -0
- package/src/render/commands/CommandBufferExecutor.js +607 -0
- package/src/render/commands/RenderCommandBuffer.js +661 -0
- package/src/render/commands/index.js +17 -0
- package/src/render/index.js +367 -0
- package/src/scene/Disposable.js +498 -0
- package/src/scene/MemoryPool.js +618 -0
- package/src/scene/Node4D.js +697 -0
- package/src/scene/ResourceManager.js +599 -0
- package/src/scene/Scene4D.js +540 -0
- package/src/scene/index.js +98 -0
- package/src/schemas/error.schema.json +84 -0
- package/src/schemas/extension.schema.json +88 -0
- package/src/schemas/index.js +214 -0
- package/src/schemas/parameters.schema.json +142 -0
- package/src/schemas/tool-pack.schema.json +44 -0
- package/src/schemas/tool-response.schema.json +127 -0
- package/src/shaders/common/fullscreen.vert.glsl +5 -0
- package/src/shaders/common/fullscreen.vert.wgsl +17 -0
- package/src/shaders/common/geometry24.glsl +65 -0
- package/src/shaders/common/geometry24.wgsl +54 -0
- package/src/shaders/common/rotation4d.glsl +85 -0
- package/src/shaders/common/rotation4d.wgsl +86 -0
- package/src/shaders/common/uniforms.glsl +44 -0
- package/src/shaders/common/uniforms.wgsl +48 -0
- package/src/shaders/faceted/faceted.frag.glsl +129 -0
- package/src/shaders/faceted/faceted.frag.wgsl +164 -0
- package/src/shaders/holographic/holographic.frag.glsl +406 -0
- package/src/shaders/holographic/holographic.frag.wgsl +185 -0
- package/src/shaders/quantum/quantum.frag.glsl +513 -0
- package/src/shaders/quantum/quantum.frag.wgsl +361 -0
- package/src/testing/ParallelTestFramework.js +519 -0
- package/src/testing/__snapshots__/exportFormats.test.js.snap +24 -0
- package/src/testing/exportFormats.test.js +8 -0
- package/src/testing/projections.test.js +14 -0
- package/src/testing/rotations.test.js +37 -0
- package/src/ui/InteractivityMenu.js +516 -0
- package/src/ui/StatusManager.js +96 -0
- package/src/ui/adaptive/renderers/webgpu/BufferLayout.ts +252 -0
- package/src/ui/adaptive/renderers/webgpu/PolytopeInstanceBuffer.ts +144 -0
- package/src/ui/adaptive/renderers/webgpu/TripleBufferedUniform.ts +170 -0
- package/src/ui/adaptive/renderers/webgpu/WebGPURenderer.ts +735 -0
- package/src/ui/adaptive/renderers/webgpu/index.ts +112 -0
- package/src/variations/VariationManager.js +431 -0
- package/src/viewer/AudioReactivity.js +505 -0
- package/src/viewer/CardBending.js +481 -0
- package/src/viewer/GalleryUI.js +832 -0
- package/src/viewer/ReactivityManager.js +590 -0
- package/src/viewer/TradingCardExporter.js +600 -0
- package/src/viewer/ViewerPortal.js +374 -0
- package/src/viewer/index.js +12 -0
- package/src/wasm/WasmLoader.js +296 -0
- package/src/wasm/index.js +132 -0
- package/tools/agentic/mcpTools.js +88 -0
- package/tools/cli/agent-cli.js +92 -0
- package/tools/export/formats.js +24 -0
- package/tools/math/rotation-baseline.mjs +64 -0
- package/tools/shader-sync-verify.js +937 -0
- package/tools/telemetry/manifestPipeline.js +141 -0
- package/tools/telemetry/telemetryEvents.js +35 -0
- package/types/adaptive-sdk.d.ts +185 -0
- package/types/advanced/AIPresetGenerator.d.ts +81 -0
- package/types/advanced/MIDIController.d.ts +100 -0
- package/types/advanced/OffscreenWorker.d.ts +82 -0
- package/types/advanced/WebGPUCompute.d.ts +52 -0
- package/types/advanced/WebXRRenderer.d.ts +77 -0
- package/types/advanced/index.d.ts +46 -0
- package/types/core/ErrorReporter.d.ts +50 -0
- package/types/core/VIB3Engine.d.ts +204 -0
- package/types/creative/ColorPresetsSystem.d.ts +91 -0
- package/types/creative/ParameterTimeline.d.ts +74 -0
- package/types/creative/PostProcessingPipeline.d.ts +109 -0
- package/types/creative/TransitionAnimator.d.ts +71 -0
- package/types/creative/index.d.ts +35 -0
- package/types/integrations/FigmaPlugin.d.ts +46 -0
- package/types/integrations/OBSMode.d.ts +74 -0
- package/types/integrations/ThreeJsPackage.d.ts +62 -0
- package/types/integrations/TouchDesignerExport.d.ts +36 -0
- package/types/integrations/Vib3React.d.ts +74 -0
- package/types/integrations/Vib3Svelte.d.ts +63 -0
- package/types/integrations/Vib3Vue.d.ts +55 -0
- package/types/integrations/index.d.ts +52 -0
- package/types/reactivity/SpatialInputSystem.d.ts +173 -0
- package/types/reactivity/index.d.ts +394 -0
- package/types/render/CommandBuffer.d.ts +169 -0
- package/types/render/RenderCommand.d.ts +312 -0
- package/types/render/RenderState.d.ts +279 -0
- package/types/render/RenderTarget.d.ts +254 -0
- package/types/render/ShaderProgram.d.ts +277 -0
- package/types/render/UnifiedRenderBridge.d.ts +143 -0
- package/types/render/WebGLBackend.d.ts +168 -0
- package/types/render/WebGPUBackend.d.ts +186 -0
- package/types/render/index.d.ts +141 -0
|
@@ -0,0 +1,552 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LottieExporter - Export VIB3+ animations as Lottie JSON
|
|
3
|
+
*
|
|
4
|
+
* Generates Lottie-compatible JSON for use in After Effects,
|
|
5
|
+
* web players, and mobile applications.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { Vec4 } from '../math/Vec4.js';
|
|
9
|
+
import { Rotor4D } from '../math/Rotor4D.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Default export options
|
|
13
|
+
*/
|
|
14
|
+
const DEFAULT_OPTIONS = {
|
|
15
|
+
fps: 60,
|
|
16
|
+
duration: 5, // seconds
|
|
17
|
+
width: 512,
|
|
18
|
+
height: 512,
|
|
19
|
+
quality: 'normal', // 'draft', 'normal', 'high'
|
|
20
|
+
includeMetadata: true
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Geometry names for metadata
|
|
25
|
+
*/
|
|
26
|
+
const GEOMETRY_NAMES = [
|
|
27
|
+
'Tetrahedron', 'Hypercube', 'Sphere', 'Torus',
|
|
28
|
+
'Klein Bottle', 'Fractal', 'Wave', 'Crystal'
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Export parameters to Lottie JSON format
|
|
33
|
+
*
|
|
34
|
+
* @param {object} params - VIB3+ parameters
|
|
35
|
+
* @param {object} options - Export options
|
|
36
|
+
* @returns {object} Lottie JSON object
|
|
37
|
+
*/
|
|
38
|
+
export function exportLottie(params, options = {}) {
|
|
39
|
+
const opts = { ...DEFAULT_OPTIONS, ...options };
|
|
40
|
+
const { fps, duration, width, height, quality, includeMetadata } = opts;
|
|
41
|
+
|
|
42
|
+
const totalFrames = fps * duration;
|
|
43
|
+
|
|
44
|
+
// Extract parameters
|
|
45
|
+
const system = params.system || 'quantum';
|
|
46
|
+
const geometry = params.geometry ?? 0;
|
|
47
|
+
const hue = params.hue ?? 200;
|
|
48
|
+
const saturation = params.saturation ?? 0.7;
|
|
49
|
+
const intensity = params.intensity ?? 0.8;
|
|
50
|
+
const speed = params.speed ?? 1;
|
|
51
|
+
const chaos = params.chaos ?? 0;
|
|
52
|
+
const morphFactor = params.morphFactor ?? 0;
|
|
53
|
+
const dimension = params.dimension ?? 3.5;
|
|
54
|
+
|
|
55
|
+
// Generate keyframes based on rotation
|
|
56
|
+
const rotationKeyframes = generateRotationKeyframes(params, totalFrames, speed);
|
|
57
|
+
|
|
58
|
+
// Generate geometry shapes
|
|
59
|
+
const shapes = generateLottieShapes(params, opts);
|
|
60
|
+
|
|
61
|
+
// Build Lottie structure
|
|
62
|
+
const lottie = {
|
|
63
|
+
v: '5.7.0',
|
|
64
|
+
fr: fps,
|
|
65
|
+
ip: 0,
|
|
66
|
+
op: totalFrames,
|
|
67
|
+
w: width,
|
|
68
|
+
h: height,
|
|
69
|
+
nm: `VIB3+ ${GEOMETRY_NAMES[geometry % 8] || 'Geometry'}`,
|
|
70
|
+
ddd: 0,
|
|
71
|
+
assets: [],
|
|
72
|
+
layers: [
|
|
73
|
+
// Background layer
|
|
74
|
+
{
|
|
75
|
+
ddd: 0,
|
|
76
|
+
ind: 1,
|
|
77
|
+
ty: 1, // Solid
|
|
78
|
+
nm: 'Background',
|
|
79
|
+
sr: 1,
|
|
80
|
+
ks: {
|
|
81
|
+
o: { a: 0, k: 100 },
|
|
82
|
+
r: { a: 0, k: 0 },
|
|
83
|
+
p: { a: 0, k: [width / 2, height / 2, 0] },
|
|
84
|
+
a: { a: 0, k: [width / 2, height / 2, 0] },
|
|
85
|
+
s: { a: 0, k: [100, 100, 100] }
|
|
86
|
+
},
|
|
87
|
+
ao: 0,
|
|
88
|
+
sw: width,
|
|
89
|
+
sh: height,
|
|
90
|
+
sc: hslToHex(hue, saturation * 30, 10 + intensity * 5),
|
|
91
|
+
ip: 0,
|
|
92
|
+
op: totalFrames,
|
|
93
|
+
st: 0,
|
|
94
|
+
bm: 0
|
|
95
|
+
},
|
|
96
|
+
// Geometry layer
|
|
97
|
+
{
|
|
98
|
+
ddd: 0,
|
|
99
|
+
ind: 2,
|
|
100
|
+
ty: 4, // Shape layer
|
|
101
|
+
nm: 'Geometry',
|
|
102
|
+
sr: 1,
|
|
103
|
+
ks: {
|
|
104
|
+
o: { a: 0, k: 100 },
|
|
105
|
+
r: rotationKeyframes,
|
|
106
|
+
p: { a: 0, k: [width / 2, height / 2, 0] },
|
|
107
|
+
a: { a: 0, k: [0, 0, 0] },
|
|
108
|
+
s: generateScaleKeyframes(morphFactor, totalFrames)
|
|
109
|
+
},
|
|
110
|
+
ao: 0,
|
|
111
|
+
shapes: shapes,
|
|
112
|
+
ip: 0,
|
|
113
|
+
op: totalFrames,
|
|
114
|
+
st: 0,
|
|
115
|
+
bm: 0
|
|
116
|
+
},
|
|
117
|
+
// Glow effect layer
|
|
118
|
+
{
|
|
119
|
+
ddd: 0,
|
|
120
|
+
ind: 3,
|
|
121
|
+
ty: 4,
|
|
122
|
+
nm: 'Glow',
|
|
123
|
+
sr: 1,
|
|
124
|
+
ks: {
|
|
125
|
+
o: generateOpacityKeyframes(chaos, totalFrames),
|
|
126
|
+
r: { a: 0, k: 0 },
|
|
127
|
+
p: { a: 0, k: [width / 2, height / 2, 0] },
|
|
128
|
+
a: { a: 0, k: [0, 0, 0] },
|
|
129
|
+
s: { a: 0, k: [120, 120, 100] }
|
|
130
|
+
},
|
|
131
|
+
ao: 0,
|
|
132
|
+
shapes: generateGlowShapes(params, opts),
|
|
133
|
+
ip: 0,
|
|
134
|
+
op: totalFrames,
|
|
135
|
+
st: 0,
|
|
136
|
+
bm: 1 // Add blend mode
|
|
137
|
+
}
|
|
138
|
+
],
|
|
139
|
+
markers: []
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// Add metadata
|
|
143
|
+
if (includeMetadata) {
|
|
144
|
+
lottie.meta = {
|
|
145
|
+
generator: '@vib3code/sdk',
|
|
146
|
+
version: '1.9.0',
|
|
147
|
+
system: system,
|
|
148
|
+
geometry: geometry,
|
|
149
|
+
exportedAt: new Date().toISOString()
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return lottie;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Generate rotation keyframes
|
|
158
|
+
*/
|
|
159
|
+
function generateRotationKeyframes(params, totalFrames, speed) {
|
|
160
|
+
const rotations = (params.rot4dXW ?? 0) + (params.rot4dYW ?? 0);
|
|
161
|
+
|
|
162
|
+
if (Math.abs(rotations) < 0.01) {
|
|
163
|
+
// Static rotation
|
|
164
|
+
return { a: 0, k: 0 };
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Animated rotation
|
|
168
|
+
return {
|
|
169
|
+
a: 1,
|
|
170
|
+
k: [
|
|
171
|
+
{
|
|
172
|
+
i: { x: [0.667], y: [1] },
|
|
173
|
+
o: { x: [0.333], y: [0] },
|
|
174
|
+
t: 0,
|
|
175
|
+
s: [0]
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
t: totalFrames,
|
|
179
|
+
s: [360 * speed]
|
|
180
|
+
}
|
|
181
|
+
]
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Generate scale keyframes for morph effect
|
|
187
|
+
*/
|
|
188
|
+
function generateScaleKeyframes(morphFactor, totalFrames) {
|
|
189
|
+
if (morphFactor < 0.01) {
|
|
190
|
+
return { a: 0, k: [100, 100, 100] };
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const scalePulse = 100 + morphFactor * 10;
|
|
194
|
+
|
|
195
|
+
return {
|
|
196
|
+
a: 1,
|
|
197
|
+
k: [
|
|
198
|
+
{
|
|
199
|
+
i: { x: [0.667], y: [1] },
|
|
200
|
+
o: { x: [0.333], y: [0] },
|
|
201
|
+
t: 0,
|
|
202
|
+
s: [100, 100, 100]
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
i: { x: [0.667], y: [1] },
|
|
206
|
+
o: { x: [0.333], y: [0] },
|
|
207
|
+
t: totalFrames / 2,
|
|
208
|
+
s: [scalePulse, scalePulse, 100]
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
t: totalFrames,
|
|
212
|
+
s: [100, 100, 100]
|
|
213
|
+
}
|
|
214
|
+
]
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Generate opacity keyframes for glow
|
|
220
|
+
*/
|
|
221
|
+
function generateOpacityKeyframes(chaos, totalFrames) {
|
|
222
|
+
if (chaos < 0.01) {
|
|
223
|
+
return { a: 0, k: 30 };
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
return {
|
|
227
|
+
a: 1,
|
|
228
|
+
k: [
|
|
229
|
+
{
|
|
230
|
+
i: { x: [0.667], y: [1] },
|
|
231
|
+
o: { x: [0.333], y: [0] },
|
|
232
|
+
t: 0,
|
|
233
|
+
s: [20]
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
i: { x: [0.667], y: [1] },
|
|
237
|
+
o: { x: [0.333], y: [0] },
|
|
238
|
+
t: totalFrames * 0.25,
|
|
239
|
+
s: [40 + chaos * 30]
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
i: { x: [0.667], y: [1] },
|
|
243
|
+
o: { x: [0.333], y: [0] },
|
|
244
|
+
t: totalFrames * 0.5,
|
|
245
|
+
s: [20]
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
i: { x: [0.667], y: [1] },
|
|
249
|
+
o: { x: [0.333], y: [0] },
|
|
250
|
+
t: totalFrames * 0.75,
|
|
251
|
+
s: [50 + chaos * 20]
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
t: totalFrames,
|
|
255
|
+
s: [20]
|
|
256
|
+
}
|
|
257
|
+
]
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Generate Lottie shape groups from geometry
|
|
263
|
+
*/
|
|
264
|
+
function generateLottieShapes(params, opts) {
|
|
265
|
+
const { width, height, quality } = opts;
|
|
266
|
+
const hue = params.hue ?? 200;
|
|
267
|
+
const saturation = params.saturation ?? 0.7;
|
|
268
|
+
const intensity = params.intensity ?? 0.8;
|
|
269
|
+
const geometry = params.geometry ?? 0;
|
|
270
|
+
const gridDensity = params.gridDensity ?? 16;
|
|
271
|
+
|
|
272
|
+
const shapes = [];
|
|
273
|
+
const centerX = 0;
|
|
274
|
+
const centerY = 0;
|
|
275
|
+
|
|
276
|
+
// Determine point count based on quality
|
|
277
|
+
const pointMultiplier = quality === 'high' ? 2 : quality === 'draft' ? 0.5 : 1;
|
|
278
|
+
const pointCount = Math.floor(gridDensity * pointMultiplier);
|
|
279
|
+
|
|
280
|
+
// Generate base geometry shape
|
|
281
|
+
const baseIndex = geometry % 8;
|
|
282
|
+
|
|
283
|
+
// Create shape group
|
|
284
|
+
const shapeGroup = {
|
|
285
|
+
ty: 'gr',
|
|
286
|
+
it: [],
|
|
287
|
+
nm: 'Geometry Group',
|
|
288
|
+
np: 3,
|
|
289
|
+
cix: 2,
|
|
290
|
+
bm: 0,
|
|
291
|
+
ix: 1,
|
|
292
|
+
mn: 'ADBE Vector Group'
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
// Add ellipses for each geometry point
|
|
296
|
+
const scale = Math.min(width, height) * 0.35;
|
|
297
|
+
const points = generateGeometryVertices(baseIndex, pointCount);
|
|
298
|
+
|
|
299
|
+
for (let i = 0; i < points.length; i++) {
|
|
300
|
+
const point = points[i];
|
|
301
|
+
const pointHue = (hue + i * 10) % 360;
|
|
302
|
+
|
|
303
|
+
// Add ellipse shape
|
|
304
|
+
shapeGroup.it.push({
|
|
305
|
+
ty: 'el',
|
|
306
|
+
s: { a: 0, k: [10, 10] },
|
|
307
|
+
p: { a: 0, k: [point.x * scale, point.y * scale] },
|
|
308
|
+
nm: `Point ${i}`,
|
|
309
|
+
mn: 'ADBE Vector Shape - Ellipse'
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// Add fill
|
|
314
|
+
shapeGroup.it.push({
|
|
315
|
+
ty: 'fl',
|
|
316
|
+
c: { a: 0, k: hslToRgbArray(hue, saturation, 0.4 + intensity * 0.3) },
|
|
317
|
+
o: { a: 0, k: 80 },
|
|
318
|
+
r: 1,
|
|
319
|
+
bm: 0,
|
|
320
|
+
nm: 'Fill',
|
|
321
|
+
mn: 'ADBE Vector Graphic - Fill'
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
// Add stroke
|
|
325
|
+
shapeGroup.it.push({
|
|
326
|
+
ty: 'st',
|
|
327
|
+
c: { a: 0, k: hslToRgbArray((hue + 180) % 360, saturation, 0.6) },
|
|
328
|
+
o: { a: 0, k: 50 },
|
|
329
|
+
w: { a: 0, k: 1.5 },
|
|
330
|
+
lc: 2,
|
|
331
|
+
lj: 2,
|
|
332
|
+
bm: 0,
|
|
333
|
+
nm: 'Stroke',
|
|
334
|
+
mn: 'ADBE Vector Graphic - Stroke'
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
// Add transform
|
|
338
|
+
shapeGroup.it.push({
|
|
339
|
+
ty: 'tr',
|
|
340
|
+
p: { a: 0, k: [0, 0] },
|
|
341
|
+
a: { a: 0, k: [0, 0] },
|
|
342
|
+
s: { a: 0, k: [100, 100] },
|
|
343
|
+
r: { a: 0, k: 0 },
|
|
344
|
+
o: { a: 0, k: 100 },
|
|
345
|
+
sk: { a: 0, k: 0 },
|
|
346
|
+
sa: { a: 0, k: 0 },
|
|
347
|
+
nm: 'Transform'
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
shapes.push(shapeGroup);
|
|
351
|
+
|
|
352
|
+
return shapes;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Generate glow shapes
|
|
357
|
+
*/
|
|
358
|
+
function generateGlowShapes(params, opts) {
|
|
359
|
+
const hue = params.hue ?? 200;
|
|
360
|
+
const saturation = params.saturation ?? 0.7;
|
|
361
|
+
const intensity = params.intensity ?? 0.8;
|
|
362
|
+
const { width, height } = opts;
|
|
363
|
+
|
|
364
|
+
return [
|
|
365
|
+
{
|
|
366
|
+
ty: 'gr',
|
|
367
|
+
it: [
|
|
368
|
+
{
|
|
369
|
+
ty: 'el',
|
|
370
|
+
s: { a: 0, k: [width * 0.6, height * 0.6] },
|
|
371
|
+
p: { a: 0, k: [0, 0] },
|
|
372
|
+
nm: 'Glow Ellipse'
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
ty: 'gf',
|
|
376
|
+
o: { a: 0, k: 100 },
|
|
377
|
+
r: 1,
|
|
378
|
+
bm: 0,
|
|
379
|
+
g: {
|
|
380
|
+
p: 3,
|
|
381
|
+
k: {
|
|
382
|
+
a: 0,
|
|
383
|
+
k: [
|
|
384
|
+
0, ...hslToRgbArray(hue, saturation, 0.5 + intensity * 0.3),
|
|
385
|
+
0.5, ...hslToRgbArray((hue + 30) % 360, saturation * 0.8, 0.4),
|
|
386
|
+
1, 0, 0, 0, 0
|
|
387
|
+
]
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
s: { a: 0, k: [0, 0] },
|
|
391
|
+
e: { a: 0, k: [width * 0.3, height * 0.3] },
|
|
392
|
+
t: 2, // Radial gradient
|
|
393
|
+
nm: 'Gradient Fill'
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
ty: 'tr',
|
|
397
|
+
p: { a: 0, k: [0, 0] },
|
|
398
|
+
a: { a: 0, k: [0, 0] },
|
|
399
|
+
s: { a: 0, k: [100, 100] },
|
|
400
|
+
r: { a: 0, k: 0 },
|
|
401
|
+
o: { a: 0, k: 100 },
|
|
402
|
+
nm: 'Transform'
|
|
403
|
+
}
|
|
404
|
+
],
|
|
405
|
+
nm: 'Glow Group',
|
|
406
|
+
bm: 0
|
|
407
|
+
}
|
|
408
|
+
];
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Generate geometry vertices for shapes
|
|
413
|
+
*/
|
|
414
|
+
function generateGeometryVertices(baseIndex, count) {
|
|
415
|
+
const vertices = [];
|
|
416
|
+
|
|
417
|
+
switch (baseIndex) {
|
|
418
|
+
case 0: // Tetrahedron
|
|
419
|
+
vertices.push({ x: 0, y: -0.8 });
|
|
420
|
+
vertices.push({ x: -0.7, y: 0.4 });
|
|
421
|
+
vertices.push({ x: 0.7, y: 0.4 });
|
|
422
|
+
break;
|
|
423
|
+
|
|
424
|
+
case 1: // Hypercube (square projection)
|
|
425
|
+
for (let i = 0; i < 4; i++) {
|
|
426
|
+
const angle = (i / 4) * Math.PI * 2 + Math.PI / 4;
|
|
427
|
+
vertices.push({
|
|
428
|
+
x: Math.cos(angle) * 0.6,
|
|
429
|
+
y: Math.sin(angle) * 0.6
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
for (let i = 0; i < 4; i++) {
|
|
433
|
+
const angle = (i / 4) * Math.PI * 2 + Math.PI / 4;
|
|
434
|
+
vertices.push({
|
|
435
|
+
x: Math.cos(angle) * 0.3,
|
|
436
|
+
y: Math.sin(angle) * 0.3
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
break;
|
|
440
|
+
|
|
441
|
+
case 2: // Sphere (circle of points)
|
|
442
|
+
for (let i = 0; i < count; i++) {
|
|
443
|
+
const angle = (i / count) * Math.PI * 2;
|
|
444
|
+
vertices.push({
|
|
445
|
+
x: Math.cos(angle) * 0.7,
|
|
446
|
+
y: Math.sin(angle) * 0.7
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
break;
|
|
450
|
+
|
|
451
|
+
case 3: // Torus (double ring)
|
|
452
|
+
for (let i = 0; i < count / 2; i++) {
|
|
453
|
+
const angle = (i / (count / 2)) * Math.PI * 2;
|
|
454
|
+
vertices.push({
|
|
455
|
+
x: Math.cos(angle) * 0.5,
|
|
456
|
+
y: Math.sin(angle) * 0.5
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
for (let i = 0; i < count / 2; i++) {
|
|
460
|
+
const angle = (i / (count / 2)) * Math.PI * 2;
|
|
461
|
+
vertices.push({
|
|
462
|
+
x: Math.cos(angle) * 0.3,
|
|
463
|
+
y: Math.sin(angle) * 0.3
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
break;
|
|
467
|
+
|
|
468
|
+
default: // Generic radial pattern
|
|
469
|
+
for (let i = 0; i < count; i++) {
|
|
470
|
+
const angle = (i / count) * Math.PI * 2;
|
|
471
|
+
const radius = 0.4 + (i % 3) * 0.15;
|
|
472
|
+
vertices.push({
|
|
473
|
+
x: Math.cos(angle) * radius,
|
|
474
|
+
y: Math.sin(angle) * radius
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
return vertices;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Convert HSL to hex color
|
|
484
|
+
*/
|
|
485
|
+
function hslToHex(h, s, l) {
|
|
486
|
+
const rgb = hslToRgb(h, s, l);
|
|
487
|
+
const toHex = (n) => Math.round(n * 255).toString(16).padStart(2, '0');
|
|
488
|
+
return `#${toHex(rgb[0])}${toHex(rgb[1])}${toHex(rgb[2])}`;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Convert HSL to RGB array [0-1]
|
|
493
|
+
*/
|
|
494
|
+
function hslToRgbArray(h, s, l) {
|
|
495
|
+
const rgb = hslToRgb(h, s, l);
|
|
496
|
+
return rgb;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* Convert HSL to RGB
|
|
501
|
+
*/
|
|
502
|
+
function hslToRgb(h, s, l) {
|
|
503
|
+
h = h / 360;
|
|
504
|
+
s = Math.min(1, Math.max(0, s));
|
|
505
|
+
l = Math.min(1, Math.max(0, l));
|
|
506
|
+
|
|
507
|
+
let r, g, b;
|
|
508
|
+
|
|
509
|
+
if (s === 0) {
|
|
510
|
+
r = g = b = l;
|
|
511
|
+
} else {
|
|
512
|
+
const hue2rgb = (p, q, t) => {
|
|
513
|
+
if (t < 0) t += 1;
|
|
514
|
+
if (t > 1) t -= 1;
|
|
515
|
+
if (t < 1/6) return p + (q - p) * 6 * t;
|
|
516
|
+
if (t < 1/2) return q;
|
|
517
|
+
if (t < 2/3) return p + (q - p) * (2/3 - t) * 6;
|
|
518
|
+
return p;
|
|
519
|
+
};
|
|
520
|
+
|
|
521
|
+
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
522
|
+
const p = 2 * l - q;
|
|
523
|
+
r = hue2rgb(p, q, h + 1/3);
|
|
524
|
+
g = hue2rgb(p, q, h);
|
|
525
|
+
b = hue2rgb(p, q, h - 1/3);
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
return [r, g, b];
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* Export Lottie to file (browser environment)
|
|
533
|
+
*/
|
|
534
|
+
export function downloadLottie(params, options = {}, filename = 'vib3-animation.json') {
|
|
535
|
+
const lottie = exportLottie(params, options);
|
|
536
|
+
const json = JSON.stringify(lottie, null, 2);
|
|
537
|
+
const blob = new Blob([json], { type: 'application/json' });
|
|
538
|
+
const url = URL.createObjectURL(blob);
|
|
539
|
+
|
|
540
|
+
const link = document.createElement('a');
|
|
541
|
+
link.href = url;
|
|
542
|
+
link.download = filename;
|
|
543
|
+
link.click();
|
|
544
|
+
|
|
545
|
+
URL.revokeObjectURL(url);
|
|
546
|
+
return lottie;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
export default {
|
|
550
|
+
exportLottie,
|
|
551
|
+
downloadLottie
|
|
552
|
+
};
|