@3driseai/3drise-viewer 0.1.39 → 0.1.41
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/animationsV2/ClipsRuntime.d.ts +30 -0
- package/dist/animationsV2/ClipsRuntime.d.ts.map +1 -1
- package/dist/animationsV2/ClipsRuntime.js +185 -14
- package/dist/animationsV2/clipUtils.d.ts +15 -0
- package/dist/animationsV2/clipUtils.d.ts.map +1 -1
- package/dist/animationsV2/clipUtils.js +39 -2
- package/dist/animationsV2/normalize.d.ts.map +1 -1
- package/dist/animationsV2/normalize.js +4 -0
- package/dist/animationsV2/types.d.ts +12 -0
- package/dist/animationsV2/types.d.ts.map +1 -1
- package/dist/api/sceneHandle.d.ts +40 -3
- package/dist/api/sceneHandle.d.ts.map +1 -1
- package/dist/api/sceneHandle.js +40 -0
- package/dist/components/AnimatedObject.d.ts.map +1 -1
- package/dist/components/AnimatedObject.js +6 -2
- package/dist/components/EnabledContext.d.ts +12 -0
- package/dist/components/EnabledContext.d.ts.map +1 -0
- package/dist/components/EnabledContext.js +12 -0
- package/dist/components/GalleryObject.d.ts +13 -0
- package/dist/components/GalleryObject.d.ts.map +1 -0
- package/dist/components/GalleryObject.js +46 -0
- package/dist/components/ImageObject.d.ts +9 -0
- package/dist/components/ImageObject.d.ts.map +1 -0
- package/dist/components/ImageObject.js +26 -0
- package/dist/components/ObjectNode.d.ts.map +1 -1
- package/dist/components/ObjectNode.js +17 -6
- package/dist/components/ObjectsRenderer.d.ts.map +1 -1
- package/dist/components/ObjectsRenderer.js +9 -0
- package/dist/components/ProjectLoader.d.ts +2 -0
- package/dist/components/ProjectLoader.d.ts.map +1 -1
- package/dist/components/ProjectLoader.js +2 -2
- package/dist/components/SceneBuilder.d.ts +10 -0
- package/dist/components/SceneBuilder.d.ts.map +1 -1
- package/dist/components/SceneBuilder.js +3 -2
- package/dist/components/gallery/BasicCarouselGallery.d.ts +18 -0
- package/dist/components/gallery/BasicCarouselGallery.d.ts.map +1 -0
- package/dist/components/gallery/BasicCarouselGallery.js +9 -0
- package/dist/components/gallery/ContourLinesGallery.d.ts +18 -0
- package/dist/components/gallery/ContourLinesGallery.d.ts.map +1 -0
- package/dist/components/gallery/ContourLinesGallery.js +9 -0
- package/dist/components/gallery/DepthLayersGallery.d.ts +18 -0
- package/dist/components/gallery/DepthLayersGallery.d.ts.map +1 -0
- package/dist/components/gallery/DepthLayersGallery.js +9 -0
- package/dist/components/gallery/EngravingGallery.d.ts +18 -0
- package/dist/components/gallery/EngravingGallery.d.ts.map +1 -0
- package/dist/components/gallery/EngravingGallery.js +9 -0
- package/dist/components/gallery/FlowLinesGallery.d.ts +18 -0
- package/dist/components/gallery/FlowLinesGallery.d.ts.map +1 -0
- package/dist/components/gallery/FlowLinesGallery.js +9 -0
- package/dist/components/gallery/FoldGallery.d.ts +18 -0
- package/dist/components/gallery/FoldGallery.d.ts.map +1 -0
- package/dist/components/gallery/FoldGallery.js +9 -0
- package/dist/components/gallery/GlassPanesGallery.d.ts +18 -0
- package/dist/components/gallery/GlassPanesGallery.d.ts.map +1 -0
- package/dist/components/gallery/GlassPanesGallery.js +9 -0
- package/dist/components/gallery/HaloGallery.d.ts +18 -0
- package/dist/components/gallery/HaloGallery.d.ts.map +1 -0
- package/dist/components/gallery/HaloGallery.js +9 -0
- package/dist/components/gallery/LightThreadsGallery.d.ts +18 -0
- package/dist/components/gallery/LightThreadsGallery.d.ts.map +1 -0
- package/dist/components/gallery/LightThreadsGallery.js +9 -0
- package/dist/components/gallery/LoomGallery.d.ts +18 -0
- package/dist/components/gallery/LoomGallery.d.ts.map +1 -0
- package/dist/components/gallery/LoomGallery.js +9 -0
- package/dist/components/gallery/PaperLanternsGallery.d.ts +18 -0
- package/dist/components/gallery/PaperLanternsGallery.d.ts.map +1 -0
- package/dist/components/gallery/PaperLanternsGallery.js +9 -0
- package/dist/components/gallery/ParticleShiftGallery.d.ts +18 -0
- package/dist/components/gallery/ParticleShiftGallery.d.ts.map +1 -0
- package/dist/components/gallery/ParticleShiftGallery.js +9 -0
- package/dist/components/gallery/PinscreenGallery.d.ts +18 -0
- package/dist/components/gallery/PinscreenGallery.d.ts.map +1 -0
- package/dist/components/gallery/PinscreenGallery.js +9 -0
- package/dist/components/gallery/PopUpGallery.d.ts +18 -0
- package/dist/components/gallery/PopUpGallery.d.ts.map +1 -0
- package/dist/components/gallery/PopUpGallery.js +9 -0
- package/dist/components/gallery/PrismSplitGallery.d.ts +18 -0
- package/dist/components/gallery/PrismSplitGallery.d.ts.map +1 -0
- package/dist/components/gallery/PrismSplitGallery.js +9 -0
- package/dist/components/gallery/RidgelinesGallery.d.ts +18 -0
- package/dist/components/gallery/RidgelinesGallery.d.ts.map +1 -0
- package/dist/components/gallery/RidgelinesGallery.js +9 -0
- package/dist/components/gallery/ShadowBoxGallery.d.ts +18 -0
- package/dist/components/gallery/ShadowBoxGallery.d.ts.map +1 -0
- package/dist/components/gallery/ShadowBoxGallery.js +9 -0
- package/dist/components/gallery/SilkGallery.d.ts +18 -0
- package/dist/components/gallery/SilkGallery.d.ts.map +1 -0
- package/dist/components/gallery/SilkGallery.js +9 -0
- package/dist/components/gallery/SlatsGallery.d.ts +18 -0
- package/dist/components/gallery/SlatsGallery.d.ts.map +1 -0
- package/dist/components/gallery/SlatsGallery.js +9 -0
- package/dist/components/gallery/StrataGallery.d.ts +18 -0
- package/dist/components/gallery/StrataGallery.d.ts.map +1 -0
- package/dist/components/gallery/StrataGallery.js +9 -0
- package/dist/components/gallery/TerracesGallery.d.ts +18 -0
- package/dist/components/gallery/TerracesGallery.d.ts.map +1 -0
- package/dist/components/gallery/TerracesGallery.js +9 -0
- package/dist/components/gallery/WireReliefGallery.d.ts +18 -0
- package/dist/components/gallery/WireReliefGallery.d.ts.map +1 -0
- package/dist/components/gallery/WireReliefGallery.js +9 -0
- package/dist/components/gallery/index.d.ts +46 -0
- package/dist/components/gallery/index.d.ts.map +1 -0
- package/dist/components/gallery/index.js +22 -0
- package/dist/components/gallery/kit/GalleryVariant.d.ts +68 -0
- package/dist/components/gallery/kit/GalleryVariant.d.ts.map +1 -0
- package/dist/components/gallery/kit/GalleryVariant.js +231 -0
- package/dist/components/gallery/kit/feeds.d.ts +7 -0
- package/dist/components/gallery/kit/feeds.d.ts.map +1 -0
- package/dist/components/gallery/kit/feeds.js +83 -0
- package/dist/components/gallery/kit/galleryKit.d.ts +118 -0
- package/dist/components/gallery/kit/galleryKit.d.ts.map +1 -0
- package/dist/components/gallery/kit/galleryKit.js +298 -0
- package/dist/components/gallery/kit/lookBase.d.ts +157 -0
- package/dist/components/gallery/kit/lookBase.d.ts.map +1 -0
- package/dist/components/gallery/kit/lookBase.js +211 -0
- package/dist/components/gallery/kit/pictures.d.ts +14 -0
- package/dist/components/gallery/kit/pictures.d.ts.map +1 -0
- package/dist/components/gallery/kit/pictures.js +81 -0
- package/dist/components/gallery/looks/basicCarousel.d.ts +177 -0
- package/dist/components/gallery/looks/basicCarousel.d.ts.map +1 -0
- package/dist/components/gallery/looks/basicCarousel.js +315 -0
- package/dist/components/gallery/looks/contourLines.d.ts +153 -0
- package/dist/components/gallery/looks/contourLines.d.ts.map +1 -0
- package/dist/components/gallery/looks/contourLines.js +91 -0
- package/dist/components/gallery/looks/depthLayers.d.ts +155 -0
- package/dist/components/gallery/looks/depthLayers.d.ts.map +1 -0
- package/dist/components/gallery/looks/depthLayers.js +87 -0
- package/dist/components/gallery/looks/engraving.d.ts +162 -0
- package/dist/components/gallery/looks/engraving.d.ts.map +1 -0
- package/dist/components/gallery/looks/engraving.js +96 -0
- package/dist/components/gallery/looks/flowLines.d.ts +180 -0
- package/dist/components/gallery/looks/flowLines.d.ts.map +1 -0
- package/dist/components/gallery/looks/flowLines.js +113 -0
- package/dist/components/gallery/looks/fold.d.ts +209 -0
- package/dist/components/gallery/looks/fold.d.ts.map +1 -0
- package/dist/components/gallery/looks/fold.js +155 -0
- package/dist/components/gallery/looks/glassPanes.d.ts +133 -0
- package/dist/components/gallery/looks/glassPanes.d.ts.map +1 -0
- package/dist/components/gallery/looks/glassPanes.js +208 -0
- package/dist/components/gallery/looks/halo.d.ts +100 -0
- package/dist/components/gallery/looks/halo.d.ts.map +1 -0
- package/dist/components/gallery/looks/halo.js +119 -0
- package/dist/components/gallery/looks/lightThreads.d.ts +199 -0
- package/dist/components/gallery/looks/lightThreads.d.ts.map +1 -0
- package/dist/components/gallery/looks/lightThreads.js +246 -0
- package/dist/components/gallery/looks/loom.d.ts +238 -0
- package/dist/components/gallery/looks/loom.d.ts.map +1 -0
- package/dist/components/gallery/looks/loom.js +256 -0
- package/dist/components/gallery/looks/paperLanterns.d.ts +181 -0
- package/dist/components/gallery/looks/paperLanterns.d.ts.map +1 -0
- package/dist/components/gallery/looks/paperLanterns.js +399 -0
- package/dist/components/gallery/looks/particleShift.d.ts +193 -0
- package/dist/components/gallery/looks/particleShift.d.ts.map +1 -0
- package/dist/components/gallery/looks/particleShift.js +282 -0
- package/dist/components/gallery/looks/pinscreen.d.ts +175 -0
- package/dist/components/gallery/looks/pinscreen.d.ts.map +1 -0
- package/dist/components/gallery/looks/pinscreen.js +96 -0
- package/dist/components/gallery/looks/popUp.d.ts +206 -0
- package/dist/components/gallery/looks/popUp.d.ts.map +1 -0
- package/dist/components/gallery/looks/popUp.js +132 -0
- package/dist/components/gallery/looks/prismSplit.d.ts +151 -0
- package/dist/components/gallery/looks/prismSplit.d.ts.map +1 -0
- package/dist/components/gallery/looks/prismSplit.js +84 -0
- package/dist/components/gallery/looks/ridgelines.d.ts +179 -0
- package/dist/components/gallery/looks/ridgelines.d.ts.map +1 -0
- package/dist/components/gallery/looks/ridgelines.js +111 -0
- package/dist/components/gallery/looks/shadowBox.d.ts +152 -0
- package/dist/components/gallery/looks/shadowBox.d.ts.map +1 -0
- package/dist/components/gallery/looks/shadowBox.js +82 -0
- package/dist/components/gallery/looks/silk.d.ts +140 -0
- package/dist/components/gallery/looks/silk.d.ts.map +1 -0
- package/dist/components/gallery/looks/silk.js +346 -0
- package/dist/components/gallery/looks/slats.d.ts +176 -0
- package/dist/components/gallery/looks/slats.d.ts.map +1 -0
- package/dist/components/gallery/looks/slats.js +93 -0
- package/dist/components/gallery/looks/strata.d.ts +172 -0
- package/dist/components/gallery/looks/strata.d.ts.map +1 -0
- package/dist/components/gallery/looks/strata.js +88 -0
- package/dist/components/gallery/looks/terraces.d.ts +168 -0
- package/dist/components/gallery/looks/terraces.d.ts.map +1 -0
- package/dist/components/gallery/looks/terraces.js +91 -0
- package/dist/components/gallery/looks/wireRelief.d.ts +153 -0
- package/dist/components/gallery/looks/wireRelief.d.ts.map +1 -0
- package/dist/components/gallery/looks/wireRelief.js +128 -0
- package/dist/components/image/ContourImage.d.ts +7 -0
- package/dist/components/image/ContourImage.d.ts.map +1 -0
- package/dist/components/image/ContourImage.js +6 -0
- package/dist/components/image/EngravingImage.d.ts +7 -0
- package/dist/components/image/EngravingImage.d.ts.map +1 -0
- package/dist/components/image/EngravingImage.js +6 -0
- package/dist/components/image/FrostImage.d.ts +7 -0
- package/dist/components/image/FrostImage.d.ts.map +1 -0
- package/dist/components/image/FrostImage.js +6 -0
- package/dist/components/image/LenticularImage.d.ts +7 -0
- package/dist/components/image/LenticularImage.d.ts.map +1 -0
- package/dist/components/image/LenticularImage.js +6 -0
- package/dist/components/image/PinscreenImage.d.ts +7 -0
- package/dist/components/image/PinscreenImage.d.ts.map +1 -0
- package/dist/components/image/PinscreenImage.js +6 -0
- package/dist/components/image/PrismImage.d.ts +7 -0
- package/dist/components/image/PrismImage.d.ts.map +1 -0
- package/dist/components/image/PrismImage.js +6 -0
- package/dist/components/image/ProjectorImage.d.ts +7 -0
- package/dist/components/image/ProjectorImage.d.ts.map +1 -0
- package/dist/components/image/ProjectorImage.js +6 -0
- package/dist/components/image/ReliefImage.d.ts +7 -0
- package/dist/components/image/ReliefImage.d.ts.map +1 -0
- package/dist/components/image/ReliefImage.js +6 -0
- package/dist/components/image/RollImage.d.ts +7 -0
- package/dist/components/image/RollImage.d.ts.map +1 -0
- package/dist/components/image/RollImage.js +6 -0
- package/dist/components/image/ShardsImage.d.ts +126 -0
- package/dist/components/image/ShardsImage.d.ts.map +1 -0
- package/dist/components/image/ShardsImage.js +470 -0
- package/dist/components/image/core/contour.d.ts +126 -0
- package/dist/components/image/core/contour.d.ts.map +1 -0
- package/dist/components/image/core/contour.js +123 -0
- package/dist/components/image/core/engraving.d.ts +135 -0
- package/dist/components/image/core/engraving.d.ts.map +1 -0
- package/dist/components/image/core/engraving.js +163 -0
- package/dist/components/image/core/frost.d.ts +126 -0
- package/dist/components/image/core/frost.d.ts.map +1 -0
- package/dist/components/image/core/frost.js +156 -0
- package/dist/components/image/core/imageCore.d.ts +110 -0
- package/dist/components/image/core/imageCore.d.ts.map +1 -0
- package/dist/components/image/core/imageCore.js +269 -0
- package/dist/components/image/core/lenticular.d.ts +129 -0
- package/dist/components/image/core/lenticular.d.ts.map +1 -0
- package/dist/components/image/core/lenticular.js +132 -0
- package/dist/components/image/core/pinscreen.d.ts +126 -0
- package/dist/components/image/core/pinscreen.d.ts.map +1 -0
- package/dist/components/image/core/pinscreen.js +147 -0
- package/dist/components/image/core/prism.d.ts +120 -0
- package/dist/components/image/core/prism.d.ts.map +1 -0
- package/dist/components/image/core/prism.js +164 -0
- package/dist/components/image/core/projector.d.ts +135 -0
- package/dist/components/image/core/projector.d.ts.map +1 -0
- package/dist/components/image/core/projector.js +225 -0
- package/dist/components/image/core/relief.d.ts +111 -0
- package/dist/components/image/core/relief.d.ts.map +1 -0
- package/dist/components/image/core/relief.js +94 -0
- package/dist/components/image/core/roll.d.ts +114 -0
- package/dist/components/image/core/roll.d.ts.map +1 -0
- package/dist/components/image/core/roll.js +116 -0
- package/dist/components/image/imageVariant.d.ts +46 -0
- package/dist/components/image/imageVariant.d.ts.map +1 -0
- package/dist/components/image/imageVariant.js +128 -0
- package/dist/components/image/index.d.ts +22 -0
- package/dist/components/image/index.d.ts.map +1 -0
- package/dist/components/image/index.js +10 -0
- package/dist/components/image/pictureCycle.d.ts +15 -0
- package/dist/components/image/pictureCycle.d.ts.map +1 -0
- package/dist/components/image/pictureCycle.js +82 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +4 -0
- package/dist/components/volumetricClouds/VolumetricCloudsPass.d.ts +9 -7
- package/dist/components/volumetricClouds/VolumetricCloudsPass.d.ts.map +1 -1
- package/dist/components/volumetricClouds/VolumetricCloudsPass.js +39 -27
- package/dist/constants.d.ts +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +18 -5
- package/dist/galleryRuntime.d.ts +57 -0
- package/dist/galleryRuntime.d.ts.map +1 -0
- package/dist/galleryRuntime.js +105 -0
- package/dist/hooks/useConfigLive.d.ts +1 -1
- package/dist/hooks/useConfigLive.d.ts.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/keyPad/KeyPadControls.d.ts +16 -0
- package/dist/keyPad/KeyPadControls.d.ts.map +1 -0
- package/dist/keyPad/KeyPadControls.js +176 -0
- package/dist/keyPad/index.d.ts +16 -0
- package/dist/keyPad/index.d.ts.map +1 -0
- package/dist/keyPad/index.js +8 -0
- package/dist/keyPad/keyBindings.d.ts +43 -0
- package/dist/keyPad/keyBindings.d.ts.map +1 -0
- package/dist/keyPad/keyBindings.js +92 -0
- package/dist/keyPad/keyPadAnimation.d.ts +28 -0
- package/dist/keyPad/keyPadAnimation.d.ts.map +1 -0
- package/dist/keyPad/keyPadAnimation.js +131 -0
- package/dist/keyPad/keyPadMotion.d.ts +68 -0
- package/dist/keyPad/keyPadMotion.d.ts.map +1 -0
- package/dist/keyPad/keyPadMotion.js +283 -0
- package/dist/keyPad/keyPadStore.d.ts +25 -0
- package/dist/keyPad/keyPadStore.d.ts.map +1 -0
- package/dist/keyPad/keyPadStore.js +63 -0
- package/dist/keyPad/types.d.ts +23 -0
- package/dist/keyPad/types.d.ts.map +1 -0
- package/dist/keyPad/types.js +9 -0
- package/dist/operations/catalogue/motionTrail.d.ts.map +1 -1
- package/dist/operations/catalogue/motionTrail.js +8 -1
- package/dist/operations/catalogue/visibility.d.ts.map +1 -1
- package/dist/operations/catalogue/visibility.js +23 -1
- package/dist/shaders/clouds/CloudResolveMaterial.d.ts +2 -1
- package/dist/shaders/clouds/CloudResolveMaterial.d.ts.map +1 -1
- package/dist/shaders/clouds/CloudResolveMaterial.js +37 -12
- package/dist/shaders/clouds/CloudVolumeMaterial.d.ts +4 -0
- package/dist/shaders/clouds/CloudVolumeMaterial.d.ts.map +1 -1
- package/dist/shaders/clouds/CloudVolumeMaterial.js +15 -3
- package/dist/triggers/kinds/gallery.d.ts +2 -0
- package/dist/triggers/kinds/gallery.d.ts.map +1 -0
- package/dist/triggers/kinds/gallery.js +39 -0
- package/dist/triggers/kinds/index.d.ts +1 -0
- package/dist/triggers/kinds/index.d.ts.map +1 -1
- package/dist/triggers/kinds/index.js +1 -0
- package/dist/ui/UiAnchorUpdater.d.ts.map +1 -1
- package/dist/ui/UiAnchorUpdater.js +2 -1
- package/dist/utils/cursorPicking.d.ts.map +1 -1
- package/dist/utils/cursorPicking.js +2 -1
- package/dist/utils/shownInScene.d.ts +13 -0
- package/dist/utils/shownInScene.d.ts.map +1 -0
- package/dist/utils/shownInScene.js +16 -0
- package/package.json +2 -2
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// The approved lab module, verbatim but for its import paths and the lab's picture loader (Claude outputs/gallery-lab/
|
|
2
|
+
// flowlines.mjs). Plain JS-shaped code (the viewer compiles non-strict); typed at its one door, kit/GalleryVariant.tsx. Its own DEFAULTS only fill knobs the
|
|
3
|
+
// core defaults (DEFAULT_GALLERY_OBJECTS.flowLines) do not carry; its own autoplay is never used.
|
|
4
|
+
// flowlines — "Flow Lines". Every picture is a field of fine lines that flow like water through it: the level sets
|
|
5
|
+
// of a stream function made of the line spacing, the picture's own brightness (the lines bend around its forms) and
|
|
6
|
+
// a slow meander (domain-warped noise drifting in time), anti-aliased with fwidth. Along each line runs a soft dash
|
|
7
|
+
// pattern moving with the flow, faster where the picture is bright. An inactive picture is thin grey dashed lines
|
|
8
|
+
// drifting. When it becomes the active one a soft wave crosses it: behind the wave the dashes close into solid lines,
|
|
9
|
+
// the lines thicken and take the picture's colour until they meet and the picture is whole; the flow keeps moving in
|
|
10
|
+
// its fine grain. The cursor parts the lines around it. Self-coloured.
|
|
11
|
+
import * as THREE from 'three';
|
|
12
|
+
import { BASE_DEFAULTS, BASE_GUI_MOTION, BASE_GUI_TAIL, LAYOUT_GUI, baseUniforms, applyBase, baseGlsl, instanced, shaderMaterial, makeGallery, withLean, fragHead } from '../kit/lookBase.js';
|
|
13
|
+
export const catalog = { key: 'flowLines', name: 'Flow Lines', camera: { position: [0.3, 0.15, 4.6], target: [0, 0, 0] },
|
|
14
|
+
description: 'Pictures as fine lines flowing like water around their own forms: inactive ones are thin grey dashed lines drifting, the active one closes the dashes and thickens the lines into the picture in full colour behind a soft wave; the cursor parts the lines. Use for wellness, nature, music and calm showcases.',
|
|
15
|
+
tags: ['gallery', 'flow', 'lines', 'streamlines', 'calm', 'interactive'] };
|
|
16
|
+
export const DEFAULTS = {
|
|
17
|
+
...BASE_DEFAULTS, type: 'flowLines', aspect: 1.4, width: 2.2,
|
|
18
|
+
lines: 64, bend: 2.2, meander: 0.6, flow: 0.35, dashes: 9, hairline: 0.22, smoothing: 2.4, changeTime: 2.2, dim: 0.6,
|
|
19
|
+
pointerMode: 'part', pointerRadius: 0.5, part: 1.6,
|
|
20
|
+
};
|
|
21
|
+
export const STRUCTURAL = ['imageUrls', 'aspect', 'width'];
|
|
22
|
+
export const POINTER_MODES = ['part'];
|
|
23
|
+
export const GUI = [
|
|
24
|
+
{ key: 'lean', min: 0, max: 3, step: 0.01, tip: 'The gallery turns toward the cursor' },
|
|
25
|
+
{ key: 'aspect', min: 0.6, max: 2.5, step: 0.01 }, { key: 'width', min: 1, max: 4, step: 0.01 },
|
|
26
|
+
...LAYOUT_GUI, ...BASE_GUI_MOTION,
|
|
27
|
+
{ key: 'lines', min: 16, max: 200, step: 1, tip: 'Lines across the picture' }, { key: 'bend', min: 0, max: 6, step: 0.01, tip: 'How much the picture’s forms bend the lines' },
|
|
28
|
+
{ key: 'meander', min: 0, max: 2, step: 0.01, tip: 'Slow meander of the lines' }, { key: 'flow', min: 0, max: 2, step: 0.01, tip: 'Speed of the flow along the lines' },
|
|
29
|
+
{ key: 'dashes', min: 0, max: 30, step: 0.5, tip: 'Dashes per picture width along an inactive line (0 = solid)' },
|
|
30
|
+
{ key: 'hairline', min: 0.05, max: 0.8, step: 0.01, tip: 'Width of an inactive line, as a share of a bright line' },
|
|
31
|
+
{ key: 'smoothing', min: 0, max: 5, step: 0.1, tip: 'How much the brightness is smoothed before it bends the lines' },
|
|
32
|
+
{ key: 'pointerMode', options: ['none', ...POINTER_MODES] }, ...BASE_GUI_TAIL, { key: 'part', min: 0, max: 4, step: 0.01, tip: 'How strongly the cursor parts the lines' },
|
|
33
|
+
];
|
|
34
|
+
export const PRESETS = [
|
|
35
|
+
{ name: 'Flow', description: 'The default.', patch: {} },
|
|
36
|
+
{ name: 'Silk water', description: 'Many fine lines, slow and smooth.', patch: { lines: 120, meander: 0.35, flow: 0.2, hairline: 0.16 } },
|
|
37
|
+
{ name: 'Current', description: 'Few strong lines, quick flow.', patch: { lines: 36, flow: 0.9, dashes: 5, bend: 3 } },
|
|
38
|
+
];
|
|
39
|
+
export function createUniforms() {
|
|
40
|
+
return { ...baseUniforms(), uLines: { value: 64 }, uBend: { value: 2.2 }, uMeander: { value: 0.6 }, uFlowT: { value: 0 }, uDashes: { value: 9 }, uHair: { value: 0.22 }, uSmooth: { value: 2.4 }, uPart: { value: 1.6 } };
|
|
41
|
+
}
|
|
42
|
+
export function applyConfig(u, c) {
|
|
43
|
+
const set = applyBase(u, c, POINTER_MODES);
|
|
44
|
+
set('uLines', c.lines);
|
|
45
|
+
set('uBend', c.bend);
|
|
46
|
+
set('uMeander', c.meander);
|
|
47
|
+
set('uDashes', c.dashes);
|
|
48
|
+
set('uHair', c.hairline);
|
|
49
|
+
set('uSmooth', c.smoothing);
|
|
50
|
+
set('uPart', c.part);
|
|
51
|
+
}
|
|
52
|
+
const vert = /* glsl */ `
|
|
53
|
+
attribute vec4 aI;
|
|
54
|
+
${baseGlsl}
|
|
55
|
+
varying vec2 vUv; varying vec2 vP; varying float vImg; varying float vAct; varying float vAlpha;
|
|
56
|
+
void main(){
|
|
57
|
+
float img = aI.x; vec2 g = position.xy + 0.5;
|
|
58
|
+
vec2 p = vec2(position.x * uW, position.y * uH);
|
|
59
|
+
vUv = g; vP = p; vImg = img; vAct = actOf(img); vAlpha = fadeAt(img);
|
|
60
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(placeAt(img, vec3(p, 0.0)), 1.0);
|
|
61
|
+
}
|
|
62
|
+
`;
|
|
63
|
+
const frag = /* glsl */ `
|
|
64
|
+
${fragHead}
|
|
65
|
+
precision highp sampler2DArray;
|
|
66
|
+
uniform sampler2DArray uTex;
|
|
67
|
+
${baseGlsl}
|
|
68
|
+
uniform float uLines, uBend, uMeander, uFlowT, uDashes, uHair, uSmooth, uPart;
|
|
69
|
+
varying vec2 vUv; varying vec2 vP; varying float vImg; varying float vAct; varying float vAlpha;
|
|
70
|
+
float h21(vec2 p){ p = fract(p * vec2(123.34, 456.21)); p += dot(p, p + 45.32); return fract(p.x * p.y); }
|
|
71
|
+
float vnoise(vec2 p){ vec2 i = floor(p), f = fract(p); vec2 w = f * f * (3.0 - 2.0 * f);
|
|
72
|
+
return mix(mix(h21(i), h21(i + vec2(1, 0)), w.x), mix(h21(i + vec2(0, 1)), h21(i + vec2(1, 1)), w.x), w.y); }
|
|
73
|
+
void main(){
|
|
74
|
+
vec3 pic = texture(uTex, vec3(vUv, vImg)).rgb;
|
|
75
|
+
float L = lumOf(textureLod(uTex, vec3(vUv, vImg), uSmooth).rgb);
|
|
76
|
+
float s = waveAt(vAct, vUv);
|
|
77
|
+
// the stream function: spacing + the picture's forms + a slow drifting meander (+ the cursor parting it)
|
|
78
|
+
vec2 q = vP * 1.1;
|
|
79
|
+
vec2 warp = vec2(vnoise(q + vec2(0.0, uTime * 0.05)), vnoise(q + vec2(5.2, -uTime * 0.04)));
|
|
80
|
+
float m = maskAt(vP);
|
|
81
|
+
float psi = vP.y * uLines / uH + uBend * L + uMeander * (vnoise(q * 1.3 + warp * 1.5 + uTime * 0.03) - 0.5) * 3.0
|
|
82
|
+
+ uPart * m * sign(vP.y - uPointer.y);
|
|
83
|
+
float dist = abs(fract(psi) - 0.5);
|
|
84
|
+
float px = max(fwidth(psi), 1e-4);
|
|
85
|
+
float bright = lumOf(pic);
|
|
86
|
+
float width = mix(0.5 * uHair * (0.3 + 0.7 * bright), 0.56, s * s);
|
|
87
|
+
float line = 1.0 - smoothstep(width - px, width + px, dist);
|
|
88
|
+
// dashes moving along the flow, closing into solid lines as the picture comes in
|
|
89
|
+
float along = vP.x / uW * uDashes - uFlowT * (0.4 + L) + h21(vec2(floor(psi), 3.7)) * 7.0; // each line its own dash phase: no columns
|
|
90
|
+
float dash = uDashes < 0.01 ? 1.0 : smoothstep(0.12, 0.22, abs(fract(along) - 0.5)); // ~a third of each dash period is a gap
|
|
91
|
+
dash = mix(dash, 1.0, smoothstep(0.0, 0.6, s));
|
|
92
|
+
vec3 c = mix(fadedOf(pic) * 1.3, pic, s);
|
|
93
|
+
float a = line * dash * vAlpha * uOpacity;
|
|
94
|
+
if (a < 0.003) discard;
|
|
95
|
+
gl_FragColor = vec4(c * uIntensity * a, a);
|
|
96
|
+
#include <tonemapping_fragment>
|
|
97
|
+
#include <colorspace_fragment>
|
|
98
|
+
}
|
|
99
|
+
`;
|
|
100
|
+
export function build(u, c) { return withLean(buildGallery(u, c), c); }
|
|
101
|
+
function buildGallery(u, c) {
|
|
102
|
+
const W = c.width, H = W / c.aspect;
|
|
103
|
+
const geo = instanced(new THREE.PlaneGeometry(1, 1, 1, 1), 1, () => [0, 0]);
|
|
104
|
+
const mat = shaderMaterial(u, vert, frag);
|
|
105
|
+
const mesh = new THREE.Mesh(geo, mat);
|
|
106
|
+
mesh.frustumCulled = false;
|
|
107
|
+
mesh.raycast = () => { };
|
|
108
|
+
// the flow's phase is integrated on the CPU, so changing its speed never makes the dashes jump
|
|
109
|
+
const g = makeGallery(u, c, { W, H, meshes: [mesh], setCount: (n) => { geo.instanceCount = n; }, extra: (dt) => { u.uFlowT.value += dt * (g?.cfg.flow ?? c.flow); } });
|
|
110
|
+
const apply = g.apply;
|
|
111
|
+
g.apply = (k) => { apply(k); applyConfig(u, k); };
|
|
112
|
+
return g;
|
|
113
|
+
}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
export declare const FOLD_TYPES: string[];
|
|
3
|
+
export declare const catalog: {
|
|
4
|
+
key: string;
|
|
5
|
+
name: string;
|
|
6
|
+
camera: {
|
|
7
|
+
position: number[];
|
|
8
|
+
target: number[];
|
|
9
|
+
};
|
|
10
|
+
description: string;
|
|
11
|
+
tags: string[];
|
|
12
|
+
};
|
|
13
|
+
export declare const DEFAULTS: {
|
|
14
|
+
type: string;
|
|
15
|
+
aspect: number;
|
|
16
|
+
width: number;
|
|
17
|
+
panels: number;
|
|
18
|
+
foldType: string;
|
|
19
|
+
folded: number;
|
|
20
|
+
creases: number;
|
|
21
|
+
rollRadius: number;
|
|
22
|
+
crumple: number;
|
|
23
|
+
roughness: number;
|
|
24
|
+
paperColor: string;
|
|
25
|
+
changeTime: number;
|
|
26
|
+
dim: number;
|
|
27
|
+
pointerMode: string;
|
|
28
|
+
pointerRadius: number;
|
|
29
|
+
press: number;
|
|
30
|
+
enabled: boolean;
|
|
31
|
+
lean: number;
|
|
32
|
+
imageUrls: any[];
|
|
33
|
+
autoplay: number;
|
|
34
|
+
intensity: number;
|
|
35
|
+
opacity: number;
|
|
36
|
+
layout: string;
|
|
37
|
+
spacing: number;
|
|
38
|
+
depth: number;
|
|
39
|
+
visible: number;
|
|
40
|
+
shape: number;
|
|
41
|
+
stiffness: number;
|
|
42
|
+
damping: number;
|
|
43
|
+
throwing: number;
|
|
44
|
+
wave: number;
|
|
45
|
+
slant: number;
|
|
46
|
+
pointerStrength: number;
|
|
47
|
+
};
|
|
48
|
+
export declare const STRUCTURAL: string[];
|
|
49
|
+
export declare const POINTER_MODES: string[];
|
|
50
|
+
export declare const GUI: ({
|
|
51
|
+
key: string;
|
|
52
|
+
options: string[];
|
|
53
|
+
tip: string;
|
|
54
|
+
min?: undefined;
|
|
55
|
+
max?: undefined;
|
|
56
|
+
step?: undefined;
|
|
57
|
+
} | {
|
|
58
|
+
key: string;
|
|
59
|
+
min: number;
|
|
60
|
+
max: number;
|
|
61
|
+
step: number;
|
|
62
|
+
} | {
|
|
63
|
+
key: string;
|
|
64
|
+
options: string[];
|
|
65
|
+
color?: undefined;
|
|
66
|
+
} | {
|
|
67
|
+
key: string;
|
|
68
|
+
color: boolean;
|
|
69
|
+
options?: undefined;
|
|
70
|
+
})[];
|
|
71
|
+
export declare const PRESETS: ({
|
|
72
|
+
name: string;
|
|
73
|
+
description: string;
|
|
74
|
+
patch: {
|
|
75
|
+
foldType?: undefined;
|
|
76
|
+
panels?: undefined;
|
|
77
|
+
folded?: undefined;
|
|
78
|
+
rollRadius?: undefined;
|
|
79
|
+
crumple?: undefined;
|
|
80
|
+
creases?: undefined;
|
|
81
|
+
};
|
|
82
|
+
} | {
|
|
83
|
+
name: string;
|
|
84
|
+
description: string;
|
|
85
|
+
patch: {
|
|
86
|
+
foldType: string;
|
|
87
|
+
panels: number;
|
|
88
|
+
folded: number;
|
|
89
|
+
rollRadius?: undefined;
|
|
90
|
+
crumple?: undefined;
|
|
91
|
+
creases?: undefined;
|
|
92
|
+
};
|
|
93
|
+
} | {
|
|
94
|
+
name: string;
|
|
95
|
+
description: string;
|
|
96
|
+
patch: {
|
|
97
|
+
foldType: string;
|
|
98
|
+
rollRadius: number;
|
|
99
|
+
panels?: undefined;
|
|
100
|
+
folded?: undefined;
|
|
101
|
+
crumple?: undefined;
|
|
102
|
+
creases?: undefined;
|
|
103
|
+
};
|
|
104
|
+
} | {
|
|
105
|
+
name: string;
|
|
106
|
+
description: string;
|
|
107
|
+
patch: {
|
|
108
|
+
foldType: string;
|
|
109
|
+
crumple: number;
|
|
110
|
+
panels: number;
|
|
111
|
+
folded?: undefined;
|
|
112
|
+
rollRadius?: undefined;
|
|
113
|
+
creases?: undefined;
|
|
114
|
+
};
|
|
115
|
+
} | {
|
|
116
|
+
name: string;
|
|
117
|
+
description: string;
|
|
118
|
+
patch: {
|
|
119
|
+
panels: number;
|
|
120
|
+
folded: number;
|
|
121
|
+
creases: number;
|
|
122
|
+
foldType?: undefined;
|
|
123
|
+
rollRadius?: undefined;
|
|
124
|
+
crumple?: undefined;
|
|
125
|
+
};
|
|
126
|
+
})[];
|
|
127
|
+
export declare function createUniforms(): {
|
|
128
|
+
uF: {
|
|
129
|
+
value: number;
|
|
130
|
+
};
|
|
131
|
+
uType: {
|
|
132
|
+
value: number;
|
|
133
|
+
};
|
|
134
|
+
uFold: {
|
|
135
|
+
value: number;
|
|
136
|
+
};
|
|
137
|
+
uCrease: {
|
|
138
|
+
value: number;
|
|
139
|
+
};
|
|
140
|
+
uRoll: {
|
|
141
|
+
value: number;
|
|
142
|
+
};
|
|
143
|
+
uCrumple: {
|
|
144
|
+
value: number;
|
|
145
|
+
};
|
|
146
|
+
uPress: {
|
|
147
|
+
value: number;
|
|
148
|
+
};
|
|
149
|
+
uPaper: {
|
|
150
|
+
value: THREE.Color;
|
|
151
|
+
};
|
|
152
|
+
uTex: {
|
|
153
|
+
value: any;
|
|
154
|
+
};
|
|
155
|
+
uS: {
|
|
156
|
+
value: number;
|
|
157
|
+
};
|
|
158
|
+
uCount: {
|
|
159
|
+
value: number;
|
|
160
|
+
};
|
|
161
|
+
uTime: {
|
|
162
|
+
value: number;
|
|
163
|
+
};
|
|
164
|
+
uAct: {
|
|
165
|
+
value: Float32Array<ArrayBuffer>;
|
|
166
|
+
};
|
|
167
|
+
uW: {
|
|
168
|
+
value: number;
|
|
169
|
+
};
|
|
170
|
+
uH: {
|
|
171
|
+
value: number;
|
|
172
|
+
};
|
|
173
|
+
uWave: {
|
|
174
|
+
value: number;
|
|
175
|
+
};
|
|
176
|
+
uSlant: {
|
|
177
|
+
value: number;
|
|
178
|
+
};
|
|
179
|
+
uDim: {
|
|
180
|
+
value: number;
|
|
181
|
+
};
|
|
182
|
+
uIntensity: {
|
|
183
|
+
value: number;
|
|
184
|
+
};
|
|
185
|
+
uOpacity: {
|
|
186
|
+
value: number;
|
|
187
|
+
};
|
|
188
|
+
uPointer: {
|
|
189
|
+
value: THREE.Vector3;
|
|
190
|
+
};
|
|
191
|
+
uPointerActive: {
|
|
192
|
+
value: number;
|
|
193
|
+
};
|
|
194
|
+
uPointerMode: {
|
|
195
|
+
value: number;
|
|
196
|
+
};
|
|
197
|
+
uPointerStrength: {
|
|
198
|
+
value: number;
|
|
199
|
+
};
|
|
200
|
+
uPointerRadius: {
|
|
201
|
+
value: number;
|
|
202
|
+
};
|
|
203
|
+
uPlace: {
|
|
204
|
+
value: THREE.Matrix4[];
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
export declare function applyConfig(u: any, c: any): void;
|
|
208
|
+
export declare function build(u: any, c: any): any;
|
|
209
|
+
//# sourceMappingURL=fold.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fold.d.ts","sourceRoot":"","sources":["../../../../src/components/gallery/looks/fold.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,eAAO,MAAM,UAAU,UAA2D,CAAC;AAEnF,eAAO,MAAM,OAAO;;;;;;;;;CAE2D,CAAC;AAEhF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKpB,CAAC;AACF,eAAO,MAAM,UAAU,UAA6C,CAAC;AACrE,eAAO,MAAM,aAAa,UAAY,CAAC;AACvC,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;IAUf,CAAC;AACF,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAQnB,CAAC;AACF,wBAAgB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAE7B;AACD,wBAAgB,WAAW,CAAC,CAAC,KAAA,EAAE,CAAC,KAAA,QAK/B;AAsED,wBAAgB,KAAK,CAAC,CAAC,KAAA,EAAE,CAAC,KAAA,OAA6C"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
// The approved lab module, verbatim but for its import paths and the lab's picture loader (Claude outputs/gallery-lab/
|
|
2
|
+
// fold.mjs). Plain JS-shaped code (the viewer compiles non-strict); typed at its one door, kit/GalleryVariant.tsx. Its own DEFAULTS only fill knobs the
|
|
3
|
+
// core defaults (DEFAULT_GALLERY_OBJECTS.fold) do not carry; its own autoplay is never used.
|
|
4
|
+
// fold — every picture is a sheet of paper, lit by the scene, folded one of several ways (foldType). The folded
|
|
5
|
+
// sheet is a closed-form surface P(u, v, e) of the flat sheet's coordinates and the unfold progress e (0 = folded
|
|
6
|
+
// tight, grey; 1 = flat, full colour, with soft creases left over); its normals are taken from the surface itself
|
|
7
|
+
// (finite differences), so the scene's lights draw every ridge. When a picture becomes the active one it unfolds and
|
|
8
|
+
// comes to colour; leaving folds it back up. The cursor presses a gentle dent into the paper.
|
|
9
|
+
//
|
|
10
|
+
// accordion F equal panels alternately tilted ±α: width W·cos α, ridges (W/F)·sin α deep.
|
|
11
|
+
// miura a herringbone fold: accordion columns whose creases zig-zag row by row (the Miura-ori look),
|
|
12
|
+
// with shallower cross folds, so the sheet shrinks both ways.
|
|
13
|
+
// fan accordion pleats pinched toward the bottom edge, like a closed hand fan opening.
|
|
14
|
+
// roll rolled up into a scroll (a tightening spiral) that unrolls across the sheet.
|
|
15
|
+
// curl a page curled from a corner along a diagonal, uncurling flat.
|
|
16
|
+
// crumple crumpled into ridged creases (ridged noise) that smooth out as the paper is pressed flat.
|
|
17
|
+
//
|
|
18
|
+
// Scene-lit (standard material): the studio's lights draw the ridges; the gallery adds none.
|
|
19
|
+
import * as THREE from 'three';
|
|
20
|
+
import { BASE_DEFAULTS, BASE_GUI_MOTION, BASE_GUI_TAIL, LAYOUT_GUI, baseUniforms, applyBase, instanced, litMaterial, makeGallery, withLean } from '../kit/lookBase.js';
|
|
21
|
+
export const FOLD_TYPES = ['accordion', 'miura', 'fan', 'roll', 'curl', 'crumple'];
|
|
22
|
+
export const catalog = { key: 'fold', name: 'Fold', camera: { position: [1.0, 0.45, 4.5], target: [0, 0, 0] },
|
|
23
|
+
description: 'Pictures printed on paper folded in one of six ways (accordion, herringbone, fan, scroll, page curl, crumple) and lit by the scene: inactive ones are folded tight and grey, the active one unfolds flat into full colour; the cursor presses a dent into it. Use for print, editorial, fashion and craft showcases.',
|
|
24
|
+
tags: ['gallery', 'paper', 'fold', 'origami', 'scene-lit', 'interactive'] };
|
|
25
|
+
export const DEFAULTS = {
|
|
26
|
+
...BASE_DEFAULTS, type: 'fold', aspect: 1.4, width: 2.2, panels: 10, // structural
|
|
27
|
+
foldType: 'accordion', folded: 74, creases: 4, rollRadius: 0.12, crumple: 0.3, roughness: 0.75, paperColor: '#d9d4cb',
|
|
28
|
+
changeTime: 1.6, dim: 0.5,
|
|
29
|
+
pointerMode: 'press', pointerRadius: 0.55, press: 0.07,
|
|
30
|
+
};
|
|
31
|
+
export const STRUCTURAL = ['imageUrls', 'aspect', 'width', 'panels'];
|
|
32
|
+
export const POINTER_MODES = ['press'];
|
|
33
|
+
export const GUI = [
|
|
34
|
+
{ key: 'lean', min: 0, max: 3, step: 0.01, tip: 'The gallery turns toward the cursor' },
|
|
35
|
+
{ key: 'aspect', min: 0.6, max: 2.5, step: 0.01 }, { key: 'width', min: 1, max: 4, step: 0.01 }, { key: 'panels', min: 2, max: 30, step: 1, tip: 'Panels across a picture (the fold’s scale)' },
|
|
36
|
+
{ key: 'foldType', options: FOLD_TYPES, tip: 'How the paper is folded' },
|
|
37
|
+
...LAYOUT_GUI, ...BASE_GUI_MOTION,
|
|
38
|
+
{ key: 'folded', min: 10, max: 88, step: 1, tip: 'Fold angle of an inactive picture (degrees; accordion, herringbone, fan)' }, { key: 'creases', min: 0, max: 15, step: 0.5, tip: 'The soft creases an unfolded sheet keeps (degrees)' },
|
|
39
|
+
{ key: 'rollRadius', min: 0.03, max: 0.4, step: 0.005, tip: 'Radius of the scroll and the page curl' }, { key: 'crumple', min: 0, max: 1, step: 0.01, tip: 'Depth of the crumpled creases' },
|
|
40
|
+
{ key: 'roughness', min: 0, max: 1, step: 0.01 },
|
|
41
|
+
{ key: 'pointerMode', options: ['none', ...POINTER_MODES] }, ...BASE_GUI_TAIL, { key: 'press', min: 0, max: 0.3, step: 0.005, tip: 'Depth of the cursor’s dent' },
|
|
42
|
+
{ key: 'paperColor', color: true },
|
|
43
|
+
];
|
|
44
|
+
export const PRESETS = [
|
|
45
|
+
{ name: 'Accordion', description: 'The default.', patch: {} },
|
|
46
|
+
{ name: 'Herringbone', description: 'A Miura-like fold that shrinks both ways.', patch: { foldType: 'miura', panels: 12, folded: 70 } },
|
|
47
|
+
{ name: 'Hand fan', description: 'Narrow pleats pinched at the bottom.', patch: { foldType: 'fan', panels: 22, folded: 80 } },
|
|
48
|
+
{ name: 'Scroll', description: 'Rolled up, unrolling across.', patch: { foldType: 'roll', rollRadius: 0.1 } },
|
|
49
|
+
{ name: 'Page curl', description: 'Curled from a corner.', patch: { foldType: 'curl', rollRadius: 0.16 } },
|
|
50
|
+
{ name: 'Crumpled', description: 'Crumpled paper pressed flat.', patch: { foldType: 'crumple', crumple: 0.35, panels: 14 } },
|
|
51
|
+
{ name: 'Screen', description: 'A three-panel screen, half open when inactive.', patch: { panels: 3, folded: 45, creases: 8 } },
|
|
52
|
+
];
|
|
53
|
+
export function createUniforms() {
|
|
54
|
+
return { ...baseUniforms(), uF: { value: 10 }, uType: { value: 0 }, uFold: { value: 1.29 }, uCrease: { value: 0.07 }, uRoll: { value: 0.12 }, uCrumple: { value: 0.5 }, uPress: { value: 0.07 }, uPaper: { value: new THREE.Color('#d9d4cb') } };
|
|
55
|
+
}
|
|
56
|
+
export function applyConfig(u, c) {
|
|
57
|
+
const set = applyBase(u, c, POINTER_MODES);
|
|
58
|
+
set('uPress', c.press);
|
|
59
|
+
set('uPaper', c.paperColor);
|
|
60
|
+
set('uRoll', c.rollRadius);
|
|
61
|
+
set('uCrumple', c.crumple);
|
|
62
|
+
if (c.folded !== undefined)
|
|
63
|
+
u.uFold.value = c.folded * Math.PI / 180;
|
|
64
|
+
if (c.creases !== undefined)
|
|
65
|
+
u.uCrease.value = c.creases * Math.PI / 180;
|
|
66
|
+
if (c.foldType !== undefined)
|
|
67
|
+
u.uType.value = Math.max(0, FOLD_TYPES.indexOf(c.foldType));
|
|
68
|
+
}
|
|
69
|
+
const vertex = {
|
|
70
|
+
head: /* glsl */ `
|
|
71
|
+
uniform float uF, uType, uFold, uCrease, uRoll, uCrumple, uPress;
|
|
72
|
+
varying vec2 vUv; varying float vImg; varying float vE; varying float vShade; varying float vAlpha;
|
|
73
|
+
float tri(float t){ float s2 = fract(t * 0.5) * 2.0; return s2 < 1.0 ? s2 : 2.0 - s2; } // 0 valley .. 1 ridge
|
|
74
|
+
float h21(vec2 p){ p = fract(p * vec2(123.34, 456.21)); p += dot(p, p + 45.32); return fract(p.x * p.y); }
|
|
75
|
+
float vnoise(vec2 p){ vec2 i = floor(p), f = fract(p); vec2 w = f * f * (3.0 - 2.0 * f);
|
|
76
|
+
return mix(mix(h21(i), h21(i + vec2(1, 0)), w.x), mix(h21(i + vec2(0, 1)), h21(i + vec2(1, 1)), w.x), w.y); }
|
|
77
|
+
float ridged(vec2 p){ float s = 0.0, a = 0.5; for (int k = 0; k < 2; k++){ s += a * (1.0 - abs(vnoise(p) * 2.0 - 1.0)); p = p * 2.03 + 7.1; a *= 0.5; } return s; }
|
|
78
|
+
/** The folded sheet: flat coordinates uv (0..1) → local position, at unfold progress e. */
|
|
79
|
+
vec3 foldAt(vec2 uv, float e){
|
|
80
|
+
float al = mix(uFold, uCrease, e), pw = uW / uF;
|
|
81
|
+
vec2 q = vec2((uv.x - 0.5) * uW, (uv.y - 0.5) * uH);
|
|
82
|
+
vec3 p;
|
|
83
|
+
if (uType < 0.5) { // accordion
|
|
84
|
+
p = vec3(q.x * cos(al), q.y, pw * sin(al) * (tri(uv.x * uF) - 0.5));
|
|
85
|
+
} else if (uType < 1.5) { // herringbone (Miura-like)
|
|
86
|
+
float Fy = max(2.0, floor(uF * uH / uW + 0.5)), ph = uH / Fy, be = al * 0.45;
|
|
87
|
+
float t = uv.x * uF + 0.5 * tri(uv.y * Fy); // the column creases zig-zag row by row
|
|
88
|
+
p = vec3(q.x * cos(al), q.y * cos(be), pw * sin(al) * (tri(t) - 0.5) + ph * sin(be) * (tri(uv.y * Fy) - 0.5));
|
|
89
|
+
} else if (uType < 2.5) { // fan: pleats pinched toward the bottom edge
|
|
90
|
+
float a2 = al * mix(1.0, 0.35, uv.y);
|
|
91
|
+
p = vec3(q.x * cos(a2), q.y, pw * sin(a2) * (tri(uv.x * uF) - 0.5));
|
|
92
|
+
} else if (uType < 4.5) { // roll (scroll) / curl (page corner)
|
|
93
|
+
vec2 dir = uType < 3.5 ? vec2(1.0, 0.0) : normalize(vec2(1.0, 0.75));
|
|
94
|
+
float span = abs(dir.x) * uW + abs(dir.y) * uH;
|
|
95
|
+
float a = dot(q, dir) + span * 0.5; // 0 .. span along the unrolling direction
|
|
96
|
+
float a0 = uType < 3.5 ? e * span : mix(span * 0.5, span, e); // the flat part reaches this far (a curl is half over when inactive)
|
|
97
|
+
p = vec3(q, 0.0);
|
|
98
|
+
if (a > a0) {
|
|
99
|
+
float s = a - a0, R = uRoll, th = s / R;
|
|
100
|
+
float Rr = max(R - 0.006 * th, R * 0.35); // a tightening spiral: the layers never meet
|
|
101
|
+
p.xy += dir * (Rr * sin(th) - s);
|
|
102
|
+
p.z = Rr * (1.0 - cos(th));
|
|
103
|
+
}
|
|
104
|
+
if (uType < 3.5) p.x += (1.0 - e) * uW * 0.5; // the scroll sits centred while rolled
|
|
105
|
+
} else { // crumple
|
|
106
|
+
float amp = 1.0 - e;
|
|
107
|
+
float n = ridged(uv * vec2(uF * 0.35, uF * 0.35 * uH / uW));
|
|
108
|
+
p = vec3(q * (1.0 - 0.22 * amp * uCrumple), uCrumple * 0.16 * uW / max(uF * 0.25, 1.0) * amp * (n - 0.5) * 4.0);
|
|
109
|
+
}
|
|
110
|
+
return p;
|
|
111
|
+
}
|
|
112
|
+
`,
|
|
113
|
+
body: /* glsl */ `
|
|
114
|
+
float img = aI.x; float act = actOf(img);
|
|
115
|
+
float e = act * act * (3.0 - 2.0 * act);
|
|
116
|
+
vec2 uv = position.xy + 0.5;
|
|
117
|
+
vec3 p = foldAt(uv, e);
|
|
118
|
+
// normals from the surface itself (finite differences), so every fold type lights correctly
|
|
119
|
+
float d = 1.0 / 256.0;
|
|
120
|
+
vec3 pu = foldAt(uv + vec2(d, 0.0), e) - p, pv = foldAt(uv + vec2(0.0, d), e) - p;
|
|
121
|
+
vec3 n = normalize(cross(pu, pv));
|
|
122
|
+
float m = maskAt(p.xy);
|
|
123
|
+
p -= n * uPress * m;
|
|
124
|
+
gPos = p; gNrm = n;
|
|
125
|
+
vUv = uv; vImg = img; vE = e; vAlpha = fadeAt(img);
|
|
126
|
+
vShade = 1.0 - 0.2 * (1.0 - e) * (1.0 - abs(n.z)); // steep faces a touch darker while folded
|
|
127
|
+
`,
|
|
128
|
+
};
|
|
129
|
+
const fragment = {
|
|
130
|
+
head: /* glsl */ `uniform vec3 uPaper; varying vec2 vUv; varying float vImg; varying float vE; varying float vShade; varying float vAlpha;`,
|
|
131
|
+
body: /* glsl */ `
|
|
132
|
+
vec3 pic = texture(uTex, vec3(vUv, vImg)).rgb;
|
|
133
|
+
vec3 grey = mix(uPaper * 0.5, fadedOf(pic) * 2.0, 0.6);
|
|
134
|
+
diffuseColor.rgb = mix(grey, pic, vE) * vShade * uIntensity;
|
|
135
|
+
diffuseColor.a *= vAlpha * uOpacity; if (diffuseColor.a < 0.01) discard;
|
|
136
|
+
`,
|
|
137
|
+
};
|
|
138
|
+
export function build(u, c) { return withLean(buildGallery(u, c), c); }
|
|
139
|
+
function buildGallery(u, c) {
|
|
140
|
+
const W = c.width, H = W / c.aspect, F = Math.max(1, c.panels | 0);
|
|
141
|
+
u.uF.value = F;
|
|
142
|
+
// enough vertices for every fold type: 8 per panel across (a vertex on every crease), the rolls and crumples
|
|
143
|
+
const sx = F * Math.max(8, Math.ceil(120 / F)), sy = Math.max(Math.round(F * 8 / c.aspect), 72);
|
|
144
|
+
const geo = instanced(new THREE.PlaneGeometry(1, 1, sx, sy), 1, () => [0, 0]);
|
|
145
|
+
const mat = litMaterial(u, 'fold', vertex, fragment, { roughness: c.roughness });
|
|
146
|
+
const mesh = new THREE.Mesh(geo, mat);
|
|
147
|
+
mesh.frustumCulled = false;
|
|
148
|
+
mesh.raycast = () => { };
|
|
149
|
+
mesh.receiveShadow = true;
|
|
150
|
+
const g = makeGallery(u, c, { W, H, meshes: [mesh], setCount: (n) => { geo.instanceCount = n; } });
|
|
151
|
+
const apply = g.apply;
|
|
152
|
+
g.apply = (k) => { apply(k); applyConfig(u, k); if (k.roughness !== undefined)
|
|
153
|
+
mat.roughness = k.roughness; };
|
|
154
|
+
return g;
|
|
155
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
export declare const catalog: {
|
|
3
|
+
key: string;
|
|
4
|
+
name: string;
|
|
5
|
+
camera: {
|
|
6
|
+
position: number[];
|
|
7
|
+
target: number[];
|
|
8
|
+
};
|
|
9
|
+
description: string;
|
|
10
|
+
tags: string[];
|
|
11
|
+
};
|
|
12
|
+
export declare const DEFAULTS: {
|
|
13
|
+
type: string;
|
|
14
|
+
enabled: boolean;
|
|
15
|
+
lean: number;
|
|
16
|
+
imageUrls: any[];
|
|
17
|
+
autoplay: number;
|
|
18
|
+
intensity: number;
|
|
19
|
+
opacity: number;
|
|
20
|
+
aspect: number;
|
|
21
|
+
width: number;
|
|
22
|
+
thickness: number;
|
|
23
|
+
layout: string;
|
|
24
|
+
spacing: number;
|
|
25
|
+
depth: number;
|
|
26
|
+
visible: number;
|
|
27
|
+
shape: number;
|
|
28
|
+
dim: number;
|
|
29
|
+
focusLift: number;
|
|
30
|
+
stiffness: number;
|
|
31
|
+
damping: number;
|
|
32
|
+
throwing: number;
|
|
33
|
+
turnTime: number;
|
|
34
|
+
turnAngle: number;
|
|
35
|
+
edgeGlow: number;
|
|
36
|
+
roughness: number;
|
|
37
|
+
ior: number;
|
|
38
|
+
tint: string;
|
|
39
|
+
edgeColor: string;
|
|
40
|
+
pointerMode: string;
|
|
41
|
+
pointerStrength: number;
|
|
42
|
+
pointerRadius: number;
|
|
43
|
+
pointerColor: string;
|
|
44
|
+
};
|
|
45
|
+
export declare const STRUCTURAL: string[];
|
|
46
|
+
export declare const POINTER_MODES: string[];
|
|
47
|
+
export declare const GUI: ({
|
|
48
|
+
key: string;
|
|
49
|
+
options: string[];
|
|
50
|
+
tip: string;
|
|
51
|
+
min?: undefined;
|
|
52
|
+
max?: undefined;
|
|
53
|
+
step?: undefined;
|
|
54
|
+
} | {
|
|
55
|
+
key: string;
|
|
56
|
+
min: number;
|
|
57
|
+
max: number;
|
|
58
|
+
step: number;
|
|
59
|
+
tip: string;
|
|
60
|
+
options?: undefined;
|
|
61
|
+
} | {
|
|
62
|
+
key: string;
|
|
63
|
+
min: number;
|
|
64
|
+
max: number;
|
|
65
|
+
step: number;
|
|
66
|
+
options?: undefined;
|
|
67
|
+
color?: undefined;
|
|
68
|
+
} | {
|
|
69
|
+
key: string;
|
|
70
|
+
options: string[];
|
|
71
|
+
min?: undefined;
|
|
72
|
+
max?: undefined;
|
|
73
|
+
step?: undefined;
|
|
74
|
+
color?: undefined;
|
|
75
|
+
} | {
|
|
76
|
+
key: string;
|
|
77
|
+
color: boolean;
|
|
78
|
+
min?: undefined;
|
|
79
|
+
max?: undefined;
|
|
80
|
+
step?: undefined;
|
|
81
|
+
options?: undefined;
|
|
82
|
+
})[];
|
|
83
|
+
export declare const PRESETS: ({
|
|
84
|
+
name: string;
|
|
85
|
+
description: string;
|
|
86
|
+
patch: {
|
|
87
|
+
thickness?: undefined;
|
|
88
|
+
roughness?: undefined;
|
|
89
|
+
tint?: undefined;
|
|
90
|
+
};
|
|
91
|
+
} | {
|
|
92
|
+
name: string;
|
|
93
|
+
description: string;
|
|
94
|
+
patch: {
|
|
95
|
+
thickness: number;
|
|
96
|
+
roughness: number;
|
|
97
|
+
tint?: undefined;
|
|
98
|
+
};
|
|
99
|
+
} | {
|
|
100
|
+
name: string;
|
|
101
|
+
description: string;
|
|
102
|
+
patch: {
|
|
103
|
+
thickness: number;
|
|
104
|
+
roughness: number;
|
|
105
|
+
tint: string;
|
|
106
|
+
};
|
|
107
|
+
})[];
|
|
108
|
+
export declare function createUniforms(): {
|
|
109
|
+
uTex: {
|
|
110
|
+
value: any;
|
|
111
|
+
};
|
|
112
|
+
uIntensity: {
|
|
113
|
+
value: number;
|
|
114
|
+
};
|
|
115
|
+
uOpacity: {
|
|
116
|
+
value: number;
|
|
117
|
+
};
|
|
118
|
+
uKey: {
|
|
119
|
+
value: THREE.Vector3;
|
|
120
|
+
};
|
|
121
|
+
uEdgeColor: {
|
|
122
|
+
value: THREE.Color;
|
|
123
|
+
};
|
|
124
|
+
uEdgeGlow: {
|
|
125
|
+
value: number;
|
|
126
|
+
};
|
|
127
|
+
uPointerColor: {
|
|
128
|
+
value: THREE.Color;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
export declare function applyConfig(u: any, c: any): void;
|
|
132
|
+
export declare function build(u: any, c: any): any;
|
|
133
|
+
//# sourceMappingURL=glassPanes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glassPanes.d.ts","sourceRoot":"","sources":["../../../../src/components/gallery/looks/glassPanes.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,eAAO,MAAM,OAAO;;;;;;;;;CAEuD,CAAC;AAE5E,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQpB,CAAC;AACF,eAAO,MAAM,UAAU,UAAgD,CAAC;AACxE,eAAO,MAAM,aAAa,UAAW,CAAC;AACtC,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAUf,CAAC;AACF,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;IAInB,CAAC;AAEF,wBAAgB,cAAc;;;;;;;;;;;;;;;;;;;;;;EAE7B;AACD,wBAAgB,WAAW,CAAC,CAAC,KAAA,EAAE,CAAC,KAAA,QAG/B;AAwCD,wBAAgB,KAAK,CAAC,CAAC,KAAA,EAAE,CAAC,KAAA,OAA6C"}
|