@3driseai/3drise-viewer 0.1.27 → 0.1.29
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/ClipPlayer.d.ts.map +1 -1
- package/dist/animationsV2/ClipPlayer.js +13 -9
- package/dist/animationsV2/ClipsRuntime.d.ts +44 -3
- package/dist/animationsV2/ClipsRuntime.d.ts.map +1 -1
- package/dist/animationsV2/ClipsRuntime.js +173 -55
- package/dist/animationsV2/appliers.d.ts.map +1 -1
- package/dist/animationsV2/appliers.js +21 -5
- package/dist/animationsV2/index.d.ts +1 -1
- package/dist/animationsV2/index.d.ts.map +1 -1
- package/dist/animationsV2/normalize.d.ts.map +1 -1
- package/dist/animationsV2/normalize.js +7 -3
- package/dist/animationsV2/sequenceUtils.d.ts +44 -6
- package/dist/animationsV2/sequenceUtils.d.ts.map +1 -1
- package/dist/animationsV2/sequenceUtils.js +58 -12
- package/dist/animationsV2/types.d.ts +22 -12
- package/dist/animationsV2/types.d.ts.map +1 -1
- package/dist/api/sceneHandle.d.ts +35 -1
- package/dist/api/sceneHandle.d.ts.map +1 -1
- package/dist/api/sceneHandle.js +88 -17
- package/dist/components/AdvancedGrid.d.ts +1 -5
- package/dist/components/AdvancedGrid.d.ts.map +1 -1
- package/dist/components/AdvancedGrid.js +6 -35
- package/dist/components/AnimatedObject.d.ts.map +1 -1
- package/dist/components/AnimatedObject.js +9 -4
- package/dist/components/ApollonianGrid.d.ts +25 -0
- package/dist/components/ApollonianGrid.d.ts.map +1 -0
- package/dist/components/ApollonianGrid.js +55 -0
- package/dist/components/ChladniGrid.d.ts +1 -1
- package/dist/components/ChladniGrid.d.ts.map +1 -1
- package/dist/components/ChladniGrid.js +6 -35
- package/dist/components/CircuitGrid.d.ts +1 -1
- package/dist/components/CircuitGrid.d.ts.map +1 -1
- package/dist/components/CircuitGrid.js +6 -34
- package/dist/components/ConformalGrid.d.ts +25 -0
- package/dist/components/ConformalGrid.d.ts.map +1 -0
- package/dist/components/ConformalGrid.js +66 -0
- package/dist/components/ContourGrid.d.ts +1 -1
- package/dist/components/ContourGrid.d.ts.map +1 -1
- package/dist/components/ContourGrid.js +6 -34
- package/dist/components/CustomPrimitive.js +1 -1
- package/dist/components/EnvironmentObject.d.ts.map +1 -1
- package/dist/components/EnvironmentObject.js +9 -7
- package/dist/components/FlowNetGrid.d.ts +1 -1
- package/dist/components/FlowNetGrid.d.ts.map +1 -1
- package/dist/components/FlowNetGrid.js +6 -34
- package/dist/components/FractalGrid.d.ts +1 -1
- package/dist/components/FractalGrid.d.ts.map +1 -1
- package/dist/components/FractalGrid.js +6 -37
- package/dist/components/Galaxy.d.ts.map +1 -1
- package/dist/components/Galaxy.js +9 -23
- package/dist/components/GirihGrid.d.ts +1 -1
- package/dist/components/GirihGrid.d.ts.map +1 -1
- package/dist/components/GirihGrid.js +6 -35
- package/dist/components/GravWaveGrid.d.ts +1 -1
- package/dist/components/GravWaveGrid.d.ts.map +1 -1
- package/dist/components/GravWaveGrid.js +6 -35
- package/dist/components/GridsGenerator.d.ts +2 -2
- package/dist/components/GridsGenerator.d.ts.map +1 -1
- package/dist/components/GridsGenerator.js +21 -0
- package/dist/components/HexGrid.d.ts +1 -5
- package/dist/components/HexGrid.d.ts.map +1 -1
- package/dist/components/HexGrid.js +6 -36
- package/dist/components/HilbertGrid.d.ts +25 -0
- package/dist/components/HilbertGrid.d.ts.map +1 -0
- package/dist/components/HilbertGrid.js +66 -0
- package/dist/components/HyperbolicGrid.d.ts +1 -1
- package/dist/components/HyperbolicGrid.d.ts.map +1 -1
- package/dist/components/HyperbolicGrid.js +6 -34
- package/dist/components/LandObject.d.ts +9 -0
- package/dist/components/LandObject.d.ts.map +1 -0
- package/dist/components/LandObject.js +15 -0
- package/dist/components/LensingGrid.d.ts +25 -0
- package/dist/components/LensingGrid.d.ts.map +1 -0
- package/dist/components/LensingGrid.js +55 -0
- package/dist/components/LightsManager.d.ts.map +1 -1
- package/dist/components/LightsManager.js +8 -0
- package/dist/components/ModelBoundary.d.ts +2 -0
- package/dist/components/ModelBoundary.d.ts.map +1 -1
- package/dist/components/ModelBoundary.js +3 -0
- package/dist/components/ModelPrimitive.d.ts.map +1 -1
- package/dist/components/ModelPrimitive.js +6 -0
- package/dist/components/MoireGrid.d.ts +1 -1
- package/dist/components/MoireGrid.d.ts.map +1 -1
- package/dist/components/MoireGrid.js +6 -35
- package/dist/components/MoonDisc.d.ts +11 -0
- package/dist/components/MoonDisc.d.ts.map +1 -0
- package/dist/components/MoonDisc.js +128 -0
- package/dist/components/ObjectNode.d.ts.map +1 -1
- package/dist/components/ObjectNode.js +15 -4
- package/dist/components/ObjectsRenderer.d.ts.map +1 -1
- package/dist/components/ObjectsRenderer.js +7 -5
- package/dist/components/OceanBuilder.d.ts.map +1 -1
- package/dist/components/OceanBuilder.js +2 -0
- package/dist/components/ParastichyGrid.d.ts +25 -0
- package/dist/components/ParastichyGrid.d.ts.map +1 -0
- package/dist/components/ParastichyGrid.js +55 -0
- package/dist/components/PhyllotaxisGrid.d.ts +25 -0
- package/dist/components/PhyllotaxisGrid.d.ts.map +1 -0
- package/dist/components/PhyllotaxisGrid.js +66 -0
- package/dist/components/ProjectLoader.d.ts +5 -3
- package/dist/components/ProjectLoader.d.ts.map +1 -1
- package/dist/components/ProjectLoader.js +6 -3
- package/dist/components/QuasiGrid.d.ts +1 -1
- package/dist/components/QuasiGrid.d.ts.map +1 -1
- package/dist/components/QuasiGrid.js +6 -33
- package/dist/components/RadarGrid.d.ts +1 -1
- package/dist/components/RadarGrid.d.ts.map +1 -1
- package/dist/components/RadarGrid.js +6 -34
- package/dist/components/ReactionDiffusionGrid.d.ts +1 -1
- package/dist/components/ReactionDiffusionGrid.d.ts.map +1 -1
- package/dist/components/ReactionDiffusionGrid.js +6 -35
- package/dist/components/SceneBuilder.d.ts +25 -3
- package/dist/components/SceneBuilder.d.ts.map +1 -1
- package/dist/components/SceneBuilder.js +68 -38
- package/dist/components/SkyController.d.ts +25 -1
- package/dist/components/SkyController.d.ts.map +1 -1
- package/dist/components/SkyController.js +189 -130
- package/dist/components/SkyMesh.d.ts.map +1 -1
- package/dist/components/SkyMesh.js +26 -1
- package/dist/components/SkyStars.d.ts +11 -0
- package/dist/components/SkyStars.d.ts.map +1 -0
- package/dist/components/SkyStars.js +187 -0
- package/dist/components/SkySystem.d.ts +3 -3
- package/dist/components/SkySystem.d.ts.map +1 -1
- package/dist/components/SkySystem.js +8 -2
- package/dist/components/Sun.d.ts +15 -1
- package/dist/components/Sun.d.ts.map +1 -1
- package/dist/components/Sun.js +64 -3
- package/dist/components/SunLight.d.ts +6 -1
- package/dist/components/SunLight.d.ts.map +1 -1
- package/dist/components/SunLight.js +96 -44
- package/dist/components/TerrainBuilder.d.ts.map +1 -1
- package/dist/components/TerrainBuilder.js +2 -0
- package/dist/components/TextGenerator.d.ts +9 -0
- package/dist/components/TextGenerator.d.ts.map +1 -0
- package/dist/components/TextGenerator.js +29 -0
- package/dist/components/TruchetGrid.d.ts +25 -0
- package/dist/components/TruchetGrid.d.ts.map +1 -0
- package/dist/components/TruchetGrid.js +55 -0
- package/dist/components/VoronoiGrid.d.ts +1 -1
- package/dist/components/VoronoiGrid.d.ts.map +1 -1
- package/dist/components/VoronoiGrid.js +6 -33
- package/dist/components/WallpaperGrid.d.ts +1 -1
- package/dist/components/WallpaperGrid.d.ts.map +1 -1
- package/dist/components/WallpaperGrid.js +6 -35
- package/dist/components/environment/Rain.d.ts +15 -0
- package/dist/components/environment/Rain.d.ts.map +1 -0
- package/dist/components/environment/Rain.js +110 -0
- package/dist/components/environment/Rainbow.d.ts +20 -0
- package/dist/components/environment/Rainbow.d.ts.map +1 -0
- package/dist/components/environment/Rainbow.js +974 -0
- package/dist/components/environment/Sandstorm.d.ts +20 -0
- package/dist/components/environment/Sandstorm.d.ts.map +1 -0
- package/dist/components/environment/Sandstorm.js +776 -0
- package/dist/components/environment/Snow.d.ts +20 -0
- package/dist/components/environment/Snow.d.ts.map +1 -0
- package/dist/components/environment/Snow.js +609 -0
- package/dist/components/environment/Thunderstorm.d.ts +20 -0
- package/dist/components/environment/Thunderstorm.d.ts.map +1 -0
- package/dist/components/environment/Thunderstorm.js +731 -0
- package/dist/components/environment/Tornado.d.ts +20 -0
- package/dist/components/environment/Tornado.d.ts.map +1 -0
- package/dist/components/environment/Tornado.js +762 -0
- package/dist/components/environment/index.d.ts +13 -0
- package/dist/components/environment/index.d.ts.map +1 -0
- package/dist/components/environment/index.js +7 -0
- package/dist/components/index.d.ts +24 -10
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +15 -6
- package/dist/components/land/LandPatch.d.ts +15 -0
- package/dist/components/land/LandPatch.d.ts.map +1 -0
- package/dist/components/land/LandPatch.js +170 -0
- package/dist/components/land/index.d.ts +3 -0
- package/dist/components/land/index.d.ts.map +1 -0
- package/dist/components/land/index.js +1 -0
- package/dist/components/space/Earth.d.ts +16 -0
- package/dist/components/space/Earth.d.ts.map +1 -0
- package/dist/components/space/Earth.js +75 -0
- package/dist/components/space/ShootingStar.d.ts +21 -0
- package/dist/components/space/ShootingStar.d.ts.map +1 -0
- package/dist/components/space/ShootingStar.js +101 -0
- package/dist/components/space/ShootingStars.d.ts +16 -0
- package/dist/components/space/ShootingStars.d.ts.map +1 -0
- package/dist/components/space/ShootingStars.js +71 -0
- package/dist/components/space/SolarSystem.d.ts +16 -0
- package/dist/components/space/SolarSystem.d.ts.map +1 -0
- package/dist/components/space/SolarSystem.js +141 -0
- package/dist/components/space/Stars.d.ts +20 -0
- package/dist/components/space/Stars.d.ts.map +1 -0
- package/dist/components/space/Stars.js +160 -0
- package/dist/components/space/index.d.ts +11 -0
- package/dist/components/space/index.d.ts.map +1 -0
- package/dist/components/space/index.js +8 -0
- package/dist/components/terrain/TerrainSurface.d.ts.map +1 -1
- package/dist/components/terrain/TerrainSurface.js +27 -3
- package/dist/components/terrain/types.d.ts +5 -1
- package/dist/components/terrain/types.d.ts.map +1 -1
- package/dist/components/text/BurnAwayText.d.ts +15 -0
- package/dist/components/text/BurnAwayText.d.ts.map +1 -0
- package/dist/components/text/BurnAwayText.js +4 -0
- package/dist/components/text/ChalkboardText.d.ts +15 -0
- package/dist/components/text/ChalkboardText.d.ts.map +1 -0
- package/dist/components/text/ChalkboardText.js +4 -0
- package/dist/components/text/ConstellationText.d.ts +15 -0
- package/dist/components/text/ConstellationText.d.ts.map +1 -0
- package/dist/components/text/ConstellationText.js +4 -0
- package/dist/components/text/EmbroideryText.d.ts +15 -0
- package/dist/components/text/EmbroideryText.d.ts.map +1 -0
- package/dist/components/text/EmbroideryText.js +4 -0
- package/dist/components/text/FourierSketchText.d.ts +15 -0
- package/dist/components/text/FourierSketchText.d.ts.map +1 -0
- package/dist/components/text/FourierSketchText.js +4 -0
- package/dist/components/text/FrostGrowthText.d.ts +15 -0
- package/dist/components/text/FrostGrowthText.d.ts.map +1 -0
- package/dist/components/text/FrostGrowthText.js +4 -0
- package/dist/components/text/HandwritingText.d.ts +15 -0
- package/dist/components/text/HandwritingText.d.ts.map +1 -0
- package/dist/components/text/HandwritingText.js +4 -0
- package/dist/components/text/InkBleedText.d.ts +15 -0
- package/dist/components/text/InkBleedText.d.ts.map +1 -0
- package/dist/components/text/InkBleedText.js +4 -0
- package/dist/components/text/LightPaintingText.d.ts +15 -0
- package/dist/components/text/LightPaintingText.d.ts.map +1 -0
- package/dist/components/text/LightPaintingText.js +4 -0
- package/dist/components/text/LiquidMetalText.d.ts +15 -0
- package/dist/components/text/LiquidMetalText.d.ts.map +1 -0
- package/dist/components/text/LiquidMetalText.js +4 -0
- package/dist/components/text/NeonTubeText.d.ts +15 -0
- package/dist/components/text/NeonTubeText.d.ts.map +1 -0
- package/dist/components/text/NeonTubeText.js +4 -0
- package/dist/components/text/PlasmaDischargeText.d.ts +15 -0
- package/dist/components/text/PlasmaDischargeText.d.ts.map +1 -0
- package/dist/components/text/PlasmaDischargeText.js +4 -0
- package/dist/components/text/TextObjectView.d.ts +12 -0
- package/dist/components/text/TextObjectView.d.ts.map +1 -0
- package/dist/components/text/TextObjectView.js +11 -0
- package/dist/components/text/engine/fieldkit.d.ts +24 -0
- package/dist/components/text/engine/fieldkit.d.ts.map +1 -0
- package/dist/components/text/engine/fieldkit.js +201 -0
- package/dist/components/text/engine/glyphs.d.ts +19 -0
- package/dist/components/text/engine/glyphs.d.ts.map +1 -0
- package/dist/components/text/engine/glyphs.js +269 -0
- package/dist/components/text/engine/looks/burnAway.d.ts +144 -0
- package/dist/components/text/engine/looks/burnAway.d.ts.map +1 -0
- package/dist/components/text/engine/looks/burnAway.js +593 -0
- package/dist/components/text/engine/looks/chalkboard.d.ts +135 -0
- package/dist/components/text/engine/looks/chalkboard.d.ts.map +1 -0
- package/dist/components/text/engine/looks/chalkboard.js +426 -0
- package/dist/components/text/engine/looks/constellation.d.ts +111 -0
- package/dist/components/text/engine/looks/constellation.d.ts.map +1 -0
- package/dist/components/text/engine/looks/constellation.js +496 -0
- package/dist/components/text/engine/looks/embroidery.d.ts +165 -0
- package/dist/components/text/engine/looks/embroidery.d.ts.map +1 -0
- package/dist/components/text/engine/looks/embroidery.js +645 -0
- package/dist/components/text/engine/looks/frostGrowth.d.ts +109 -0
- package/dist/components/text/engine/looks/frostGrowth.d.ts.map +1 -0
- package/dist/components/text/engine/looks/frostGrowth.js +727 -0
- package/dist/components/text/engine/looks/index.d.ts +2 -0
- package/dist/components/text/engine/looks/index.d.ts.map +1 -0
- package/dist/components/text/engine/looks/index.js +48 -0
- package/dist/components/text/engine/looks/inkBleed.d.ts +103 -0
- package/dist/components/text/engine/looks/inkBleed.d.ts.map +1 -0
- package/dist/components/text/engine/looks/inkBleed.js +590 -0
- package/dist/components/text/engine/looks/lightPainting.d.ts +132 -0
- package/dist/components/text/engine/looks/lightPainting.d.ts.map +1 -0
- package/dist/components/text/engine/looks/lightPainting.js +567 -0
- package/dist/components/text/engine/looks/liquidMetal.d.ts +135 -0
- package/dist/components/text/engine/looks/liquidMetal.d.ts.map +1 -0
- package/dist/components/text/engine/looks/liquidMetal.js +655 -0
- package/dist/components/text/engine/looks/plasmaDischarge.d.ts +126 -0
- package/dist/components/text/engine/looks/plasmaDischarge.d.ts.map +1 -0
- package/dist/components/text/engine/looks/plasmaDischarge.js +763 -0
- package/dist/components/text/engine/methods.d.ts +19 -0
- package/dist/components/text/engine/methods.d.ts.map +1 -0
- package/dist/components/text/engine/methods.js +126 -0
- package/dist/components/text/engine/playback.d.ts +40 -0
- package/dist/components/text/engine/playback.d.ts.map +1 -0
- package/dist/components/text/engine/playback.js +114 -0
- package/dist/components/text/engine/ribbon.d.ts +58 -0
- package/dist/components/text/engine/ribbon.d.ts.map +1 -0
- package/dist/components/text/engine/ribbon.js +250 -0
- package/dist/components/text/engine/variants.d.ts +159 -0
- package/dist/components/text/engine/variants.d.ts.map +1 -0
- package/dist/components/text/engine/variants.js +378 -0
- package/dist/components/text/fonts/architects-daughter.outline.d.ts +3 -0
- package/dist/components/text/fonts/architects-daughter.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/architects-daughter.outline.js +4 -0
- package/dist/components/text/fonts/architects-daughter.strokes.d.ts +3 -0
- package/dist/components/text/fonts/architects-daughter.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/architects-daughter.strokes.js +4 -0
- package/dist/components/text/fonts/caveat.outline.d.ts +3 -0
- package/dist/components/text/fonts/caveat.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/caveat.outline.js +4 -0
- package/dist/components/text/fonts/caveat.strokes.d.ts +3 -0
- package/dist/components/text/fonts/caveat.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/caveat.strokes.js +4 -0
- package/dist/components/text/fonts/courgette.outline.d.ts +3 -0
- package/dist/components/text/fonts/courgette.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/courgette.outline.js +4 -0
- package/dist/components/text/fonts/courgette.strokes.d.ts +3 -0
- package/dist/components/text/fonts/courgette.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/courgette.strokes.js +4 -0
- package/dist/components/text/fonts/dancing-script.outline.d.ts +3 -0
- package/dist/components/text/fonts/dancing-script.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/dancing-script.outline.js +4 -0
- package/dist/components/text/fonts/dancing-script.strokes.d.ts +3 -0
- package/dist/components/text/fonts/dancing-script.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/dancing-script.strokes.js +4 -0
- package/dist/components/text/fonts/gochi-hand.outline.d.ts +3 -0
- package/dist/components/text/fonts/gochi-hand.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/gochi-hand.outline.js +4 -0
- package/dist/components/text/fonts/gochi-hand.strokes.d.ts +3 -0
- package/dist/components/text/fonts/gochi-hand.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/gochi-hand.strokes.js +4 -0
- package/dist/components/text/fonts/handlee.outline.d.ts +3 -0
- package/dist/components/text/fonts/handlee.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/handlee.outline.js +4 -0
- package/dist/components/text/fonts/handlee.strokes.d.ts +3 -0
- package/dist/components/text/fonts/handlee.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/handlee.strokes.js +4 -0
- package/dist/components/text/fonts/index.d.ts +5 -0
- package/dist/components/text/fonts/index.d.ts.map +1 -0
- package/dist/components/text/fonts/index.js +44 -0
- package/dist/components/text/fonts/indie-flower.outline.d.ts +3 -0
- package/dist/components/text/fonts/indie-flower.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/indie-flower.outline.js +4 -0
- package/dist/components/text/fonts/indie-flower.strokes.d.ts +3 -0
- package/dist/components/text/fonts/indie-flower.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/indie-flower.strokes.js +4 -0
- package/dist/components/text/fonts/kalam.outline.d.ts +3 -0
- package/dist/components/text/fonts/kalam.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/kalam.outline.js +4 -0
- package/dist/components/text/fonts/kalam.strokes.d.ts +3 -0
- package/dist/components/text/fonts/kalam.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/kalam.strokes.js +4 -0
- package/dist/components/text/fonts/kaushan-script.outline.d.ts +3 -0
- package/dist/components/text/fonts/kaushan-script.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/kaushan-script.outline.js +4 -0
- package/dist/components/text/fonts/kaushan-script.strokes.d.ts +3 -0
- package/dist/components/text/fonts/kaushan-script.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/kaushan-script.strokes.js +4 -0
- package/dist/components/text/fonts/mynerve.outline.d.ts +3 -0
- package/dist/components/text/fonts/mynerve.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/mynerve.outline.js +4 -0
- package/dist/components/text/fonts/mynerve.strokes.d.ts +3 -0
- package/dist/components/text/fonts/mynerve.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/mynerve.strokes.js +4 -0
- package/dist/components/text/fonts/nanum-pen-script.outline.d.ts +3 -0
- package/dist/components/text/fonts/nanum-pen-script.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/nanum-pen-script.outline.js +4 -0
- package/dist/components/text/fonts/nanum-pen-script.strokes.d.ts +3 -0
- package/dist/components/text/fonts/nanum-pen-script.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/nanum-pen-script.strokes.js +4 -0
- package/dist/components/text/fonts/pacifico.outline.d.ts +3 -0
- package/dist/components/text/fonts/pacifico.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/pacifico.outline.js +4 -0
- package/dist/components/text/fonts/pacifico.strokes.d.ts +3 -0
- package/dist/components/text/fonts/pacifico.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/pacifico.strokes.js +4 -0
- package/dist/components/text/fonts/patrick-hand.outline.d.ts +3 -0
- package/dist/components/text/fonts/patrick-hand.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/patrick-hand.outline.js +4 -0
- package/dist/components/text/fonts/patrick-hand.strokes.d.ts +3 -0
- package/dist/components/text/fonts/patrick-hand.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/patrick-hand.strokes.js +4 -0
- package/dist/components/text/fonts/poppins.outline.d.ts +3 -0
- package/dist/components/text/fonts/poppins.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/poppins.outline.js +4 -0
- package/dist/components/text/fonts/poppins.strokes.d.ts +3 -0
- package/dist/components/text/fonts/poppins.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/poppins.strokes.js +4 -0
- package/dist/components/text/fonts/satisfy.outline.d.ts +3 -0
- package/dist/components/text/fonts/satisfy.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/satisfy.outline.js +4 -0
- package/dist/components/text/fonts/satisfy.strokes.d.ts +3 -0
- package/dist/components/text/fonts/satisfy.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/satisfy.strokes.js +4 -0
- package/dist/components/text/fonts/sriracha.outline.d.ts +3 -0
- package/dist/components/text/fonts/sriracha.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/sriracha.outline.js +4 -0
- package/dist/components/text/fonts/sriracha.strokes.d.ts +3 -0
- package/dist/components/text/fonts/sriracha.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/sriracha.strokes.js +4 -0
- package/dist/components/text/index.d.ts +27 -0
- package/dist/components/text/index.d.ts.map +1 -0
- package/dist/components/text/index.js +13 -0
- package/dist/components/text/useTextObject.d.ts +21 -0
- package/dist/components/text/useTextObject.d.ts.map +1 -0
- package/dist/components/text/useTextObject.js +118 -0
- package/dist/components/water/OceanSurface.d.ts.map +1 -1
- package/dist/components/water/OceanSurface.js +3 -1
- package/dist/components/water/WaterBody.d.ts.map +1 -1
- package/dist/components/water/WaterBody.js +3 -1
- package/dist/components/water/types.d.ts +5 -1
- package/dist/components/water/types.d.ts.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +5 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useCloudSun.d.ts +9 -4
- package/dist/hooks/useCloudSun.d.ts.map +1 -1
- package/dist/hooks/useCloudSun.js +17 -7
- package/dist/hooks/useConfigLive.d.ts +3 -2
- package/dist/hooks/useConfigLive.d.ts.map +1 -1
- package/dist/hooks/useContinuousEffects.d.ts.map +1 -1
- package/dist/hooks/useContinuousEffects.js +4 -10
- package/dist/hooks/useEnvironmentProbe.d.ts +3 -22
- package/dist/hooks/useEnvironmentProbe.d.ts.map +1 -1
- package/dist/hooks/useEnvironmentProbe.js +47 -8
- package/dist/hooks/useGridSurface.d.ts +3 -10
- package/dist/hooks/useGridSurface.d.ts.map +1 -1
- package/dist/hooks/useGridSurface.js +5 -31
- package/dist/hooks/useInteraction.d.ts.map +1 -1
- package/dist/hooks/useInteraction.js +19 -72
- package/dist/hooks/useLightConfig.d.ts +2 -1
- package/dist/hooks/useLightConfig.d.ts.map +1 -1
- package/dist/hooks/useOceanMaterial.d.ts +6 -2
- package/dist/hooks/useOceanMaterial.d.ts.map +1 -1
- package/dist/hooks/useOceanMaterial.js +37 -2
- package/dist/hooks/useSkyLive.d.ts +23 -0
- package/dist/hooks/useSkyLive.d.ts.map +1 -0
- package/dist/hooks/useSkyLive.js +30 -0
- package/dist/hooks/useSkyUniforms.d.ts.map +1 -1
- package/dist/hooks/useSkyUniforms.js +2 -10
- package/dist/hooks/useTerrainLive.d.ts +3 -1
- package/dist/hooks/useTerrainLive.d.ts.map +1 -1
- package/dist/hooks/useTerrainTextures.d.ts +38 -0
- package/dist/hooks/useTerrainTextures.d.ts.map +1 -0
- package/dist/hooks/useTerrainTextures.js +149 -0
- package/dist/index.d.ts +11 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/operations/catalogue/blastOff.d.ts +3 -0
- package/dist/operations/catalogue/blastOff.d.ts.map +1 -0
- package/dist/operations/catalogue/blastOff.js +118 -0
- package/dist/operations/catalogue/bounce.d.ts +3 -0
- package/dist/operations/catalogue/bounce.d.ts.map +1 -0
- package/dist/operations/catalogue/bounce.js +34 -0
- package/dist/operations/catalogue/curlSmoke.d.ts.map +1 -1
- package/dist/operations/catalogue/curlSmoke.js +3 -1
- package/dist/operations/catalogue/dissolve.d.ts.map +1 -1
- package/dist/operations/catalogue/dissolve.js +2 -1
- package/dist/operations/catalogue/driftUp.d.ts +3 -0
- package/dist/operations/catalogue/driftUp.d.ts.map +1 -0
- package/dist/operations/catalogue/driftUp.js +57 -0
- package/dist/operations/catalogue/emberAsh.d.ts.map +1 -1
- package/dist/operations/catalogue/emberAsh.js +2 -1
- package/dist/operations/catalogue/flip.d.ts.map +1 -1
- package/dist/operations/catalogue/flip.js +19 -9
- package/dist/operations/catalogue/float.d.ts +3 -0
- package/dist/operations/catalogue/float.d.ts.map +1 -0
- package/dist/operations/catalogue/float.js +39 -0
- package/dist/operations/catalogue/flyBy.d.ts +3 -0
- package/dist/operations/catalogue/flyBy.d.ts.map +1 -0
- package/dist/operations/catalogue/flyBy.js +79 -0
- package/dist/operations/catalogue/frost.d.ts.map +1 -1
- package/dist/operations/catalogue/frost.js +10 -3
- package/dist/operations/catalogue/grow.d.ts +3 -0
- package/dist/operations/catalogue/grow.d.ts.map +1 -0
- package/dist/operations/catalogue/grow.js +19 -0
- package/dist/operations/catalogue/hologram.d.ts.map +1 -1
- package/dist/operations/catalogue/hologram.js +11 -5
- package/dist/operations/catalogue/jelly.d.ts.map +1 -1
- package/dist/operations/catalogue/jelly.js +18 -8
- package/dist/operations/catalogue/knockAway.d.ts +3 -0
- package/dist/operations/catalogue/knockAway.d.ts.map +1 -0
- package/dist/operations/catalogue/knockAway.js +74 -0
- package/dist/operations/catalogue/leafFall.d.ts +3 -0
- package/dist/operations/catalogue/leafFall.d.ts.map +1 -0
- package/dist/operations/catalogue/leafFall.js +74 -0
- package/dist/operations/catalogue/lidarScan.d.ts.map +1 -1
- package/dist/operations/catalogue/lidarScan.js +4 -1
- package/dist/operations/catalogue/metalize.d.ts.map +1 -1
- package/dist/operations/catalogue/metalize.js +8 -2
- package/dist/operations/catalogue/motionTrail.d.ts +6 -0
- package/dist/operations/catalogue/motionTrail.d.ts.map +1 -0
- package/dist/operations/catalogue/motionTrail.js +221 -0
- package/dist/operations/catalogue/petrify.d.ts.map +1 -1
- package/dist/operations/catalogue/petrify.js +9 -3
- package/dist/operations/catalogue/physicalExit.d.ts +55 -0
- package/dist/operations/catalogue/physicalExit.d.ts.map +1 -0
- package/dist/operations/catalogue/physicalExit.js +165 -0
- package/dist/operations/catalogue/physicalHeld.d.ts +41 -0
- package/dist/operations/catalogue/physicalHeld.d.ts.map +1 -0
- package/dist/operations/catalogue/physicalHeld.js +78 -0
- package/dist/operations/catalogue/physicalMix.d.ts +45 -0
- package/dist/operations/catalogue/physicalMix.d.ts.map +1 -0
- package/dist/operations/catalogue/physicalMix.js +144 -0
- package/dist/operations/catalogue/pop.d.ts +3 -0
- package/dist/operations/catalogue/pop.d.ts.map +1 -0
- package/dist/operations/catalogue/pop.js +44 -0
- package/dist/operations/catalogue/print3d.d.ts.map +1 -1
- package/dist/operations/catalogue/print3d.js +5 -1
- package/dist/operations/catalogue/pulse.d.ts +3 -0
- package/dist/operations/catalogue/pulse.d.ts.map +1 -0
- package/dist/operations/catalogue/pulse.js +29 -0
- package/dist/operations/catalogue/restPose.d.ts +5 -7
- package/dist/operations/catalogue/restPose.d.ts.map +1 -1
- package/dist/operations/catalogue/restPose.js +18 -48
- package/dist/operations/catalogue/rotate.d.ts +3 -0
- package/dist/operations/catalogue/rotate.d.ts.map +1 -0
- package/dist/operations/catalogue/rotate.js +49 -0
- package/dist/operations/catalogue/shake.d.ts +3 -0
- package/dist/operations/catalogue/shake.d.ts.map +1 -0
- package/dist/operations/catalogue/shake.js +31 -0
- package/dist/operations/catalogue/shatter.d.ts.map +1 -1
- package/dist/operations/catalogue/shatter.js +5 -1
- package/dist/operations/catalogue/slam.d.ts +3 -0
- package/dist/operations/catalogue/slam.d.ts.map +1 -0
- package/dist/operations/catalogue/slam.js +89 -0
- package/dist/operations/catalogue/slingshot.d.ts +3 -0
- package/dist/operations/catalogue/slingshot.d.ts.map +1 -0
- package/dist/operations/catalogue/slingshot.js +88 -0
- package/dist/operations/catalogue/spin.d.ts.map +1 -1
- package/dist/operations/catalogue/spin.js +24 -13
- package/dist/operations/catalogue/sway.d.ts +3 -0
- package/dist/operations/catalogue/sway.d.ts.map +1 -0
- package/dist/operations/catalogue/sway.js +23 -0
- package/dist/operations/catalogue/swirl.d.ts.map +1 -1
- package/dist/operations/catalogue/swirl.js +6 -5
- package/dist/operations/catalogue/trailCore.d.ts +89 -0
- package/dist/operations/catalogue/trailCore.d.ts.map +1 -0
- package/dist/operations/catalogue/trailCore.js +190 -0
- package/dist/operations/catalogue/trailGhosts.d.ts +5 -0
- package/dist/operations/catalogue/trailGhosts.d.ts.map +1 -0
- package/dist/operations/catalogue/trailGhosts.js +179 -0
- package/dist/operations/catalogue/trailStampStyles.d.ts +11 -0
- package/dist/operations/catalogue/trailStampStyles.d.ts.map +1 -0
- package/dist/operations/catalogue/trailStampStyles.js +479 -0
- package/dist/operations/catalogue/trailStamps.d.ts +57 -0
- package/dist/operations/catalogue/trailStamps.d.ts.map +1 -0
- package/dist/operations/catalogue/trailStamps.js +349 -0
- package/dist/operations/catalogue/trailStreaks.d.ts +3 -0
- package/dist/operations/catalogue/trailStreaks.d.ts.map +1 -0
- package/dist/operations/catalogue/trailStreaks.js +147 -0
- package/dist/operations/catalogue/transitionField.d.ts +30 -0
- package/dist/operations/catalogue/transitionField.d.ts.map +1 -1
- package/dist/operations/catalogue/transitionField.js +21 -0
- package/dist/operations/catalogue/turnAway.d.ts +3 -0
- package/dist/operations/catalogue/turnAway.d.ts.map +1 -0
- package/dist/operations/catalogue/turnAway.js +54 -0
- package/dist/operations/catalogue/vortexDrain.d.ts +3 -0
- package/dist/operations/catalogue/vortexDrain.d.ts.map +1 -0
- package/dist/operations/catalogue/vortexDrain.js +68 -0
- package/dist/operations/catalogue/warp.d.ts +3 -0
- package/dist/operations/catalogue/warp.d.ts.map +1 -0
- package/dist/operations/catalogue/warp.js +73 -0
- package/dist/operations/catalogue/whoosh.d.ts +3 -0
- package/dist/operations/catalogue/whoosh.d.ts.map +1 -0
- package/dist/operations/catalogue/whoosh.js +84 -0
- package/dist/operations/catalogue/wobble.d.ts +3 -0
- package/dist/operations/catalogue/wobble.d.ts.map +1 -0
- package/dist/operations/catalogue/wobble.js +23 -0
- package/dist/operations/clipPreview.d.ts +3 -0
- package/dist/operations/clipPreview.d.ts.map +1 -0
- package/dist/operations/clipPreview.js +20 -0
- package/dist/operations/groupFanout.d.ts +96 -0
- package/dist/operations/groupFanout.d.ts.map +1 -0
- package/dist/operations/groupFanout.js +365 -0
- package/dist/operations/groups.d.ts +20 -0
- package/dist/operations/groups.d.ts.map +1 -0
- package/dist/operations/groups.js +66 -0
- package/dist/operations/index.d.ts +5 -2
- package/dist/operations/index.d.ts.map +1 -1
- package/dist/operations/index.js +5 -2
- package/dist/operations/objectEffects.d.ts +161 -6
- package/dist/operations/objectEffects.d.ts.map +1 -1
- package/dist/operations/objectEffects.js +1091 -17
- package/dist/operations/registry.d.ts.map +1 -1
- package/dist/operations/registry.js +24 -2
- package/dist/operations/runtime.d.ts +57 -2
- package/dist/operations/runtime.d.ts.map +1 -1
- package/dist/operations/runtime.js +161 -18
- package/dist/operations/types.d.ts +60 -3
- package/dist/operations/types.d.ts.map +1 -1
- package/dist/operations/types.js +5 -1
- package/dist/operations/useObjectEffectLayers.d.ts +2 -2
- package/dist/operations/useObjectEffectLayers.d.ts.map +1 -1
- package/dist/operations/useObjectEffectLayers.js +31 -10
- package/dist/operations/usePresentedVisibility.d.ts +10 -0
- package/dist/operations/usePresentedVisibility.d.ts.map +1 -0
- package/dist/operations/usePresentedVisibility.js +53 -0
- package/dist/presets/terrainBiomes.d.ts +67 -0
- package/dist/presets/terrainBiomes.d.ts.map +1 -0
- package/dist/presets/terrainBiomes.js +294 -0
- package/dist/presets/terrainPresets.d.ts +6 -0
- package/dist/presets/terrainPresets.d.ts.map +1 -1
- package/dist/presets/terrainPresets.js +26 -38
- package/dist/shaders/glsl/oceanCore.glsl.d.ts +2 -2
- package/dist/shaders/glsl/oceanCore.glsl.d.ts.map +1 -1
- package/dist/shaders/glsl/oceanCore.glsl.js +17 -0
- package/dist/shaders/glsl/surfaceCore.glsl.d.ts +21 -0
- package/dist/shaders/glsl/surfaceCore.glsl.d.ts.map +1 -0
- package/dist/shaders/glsl/surfaceCore.glsl.js +120 -0
- package/dist/shaders/glsl/terrainCore.glsl.d.ts +16 -3
- package/dist/shaders/glsl/terrainCore.glsl.d.ts.map +1 -1
- package/dist/shaders/glsl/terrainCore.glsl.js +266 -20
- package/dist/shaders/ocean/OceanSurfaceMaterial.d.ts +2 -0
- package/dist/shaders/ocean/OceanSurfaceMaterial.d.ts.map +1 -1
- package/dist/shaders/ocean/OceanSurfaceMaterial.js +3 -0
- package/dist/shaders/terrain/TerrainMaterial.d.ts +17 -0
- package/dist/shaders/terrain/TerrainMaterial.d.ts.map +1 -1
- package/dist/shaders/terrain/TerrainMaterial.js +107 -8
- package/dist/triggers/engine.d.ts +44 -0
- package/dist/triggers/engine.d.ts.map +1 -0
- package/dist/triggers/engine.js +165 -0
- package/dist/triggers/hosts/actions.d.ts +8 -0
- package/dist/triggers/hosts/actions.d.ts.map +1 -0
- package/dist/triggers/hosts/actions.js +22 -0
- package/dist/triggers/hosts/interactions.d.ts +6 -0
- package/dist/triggers/hosts/interactions.d.ts.map +1 -0
- package/dist/triggers/hosts/interactions.js +4 -0
- package/dist/triggers/hosts/timelineCues.d.ts +2 -0
- package/dist/triggers/hosts/timelineCues.d.ts.map +1 -0
- package/dist/triggers/hosts/timelineCues.js +22 -0
- package/dist/triggers/index.d.ts +13 -0
- package/dist/triggers/index.d.ts.map +1 -0
- package/dist/triggers/index.js +9 -0
- package/dist/triggers/kinds/action.d.ts +2 -0
- package/dist/triggers/kinds/action.d.ts.map +1 -0
- package/dist/triggers/kinds/action.js +31 -0
- package/dist/triggers/kinds/animations.d.ts +2 -0
- package/dist/triggers/kinds/animations.d.ts.map +1 -0
- package/dist/triggers/kinds/animations.js +75 -0
- package/dist/triggers/kinds/effects.d.ts +2 -0
- package/dist/triggers/kinds/effects.d.ts.map +1 -0
- package/dist/triggers/kinds/effects.js +27 -0
- package/dist/triggers/kinds/index.d.ts +4 -0
- package/dist/triggers/kinds/index.d.ts.map +1 -0
- package/dist/triggers/kinds/index.js +4 -0
- package/dist/triggers/log.d.ts +21 -0
- package/dist/triggers/log.d.ts.map +1 -0
- package/dist/triggers/log.js +43 -0
- package/dist/triggers/readiness.d.ts +40 -0
- package/dist/triggers/readiness.d.ts.map +1 -0
- package/dist/triggers/readiness.js +158 -0
- package/dist/triggers/registry.d.ts +41 -0
- package/dist/triggers/registry.d.ts.map +1 -0
- package/dist/triggers/registry.js +7 -0
- package/dist/types/gridConfigs.d.ts +117 -19
- package/dist/types/gridConfigs.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/ui/UiAnchorUpdater.d.ts +10 -0
- package/dist/ui/UiAnchorUpdater.d.ts.map +1 -0
- package/dist/ui/UiAnchorUpdater.js +111 -0
- package/dist/ui/UiLayers.d.ts +20 -0
- package/dist/ui/UiLayers.d.ts.map +1 -0
- package/dist/ui/UiLayers.js +57 -0
- package/dist/ui/index.d.ts +9 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +6 -0
- package/dist/ui/uiAnchors.d.ts +21 -0
- package/dist/ui/uiAnchors.d.ts.map +1 -0
- package/dist/ui/uiAnchors.js +22 -0
- package/dist/ui/uiBaseStyles.d.ts +2 -0
- package/dist/ui/uiBaseStyles.d.ts.map +1 -0
- package/dist/ui/uiBaseStyles.js +100 -0
- package/dist/ui/uiBinder.d.ts +30 -0
- package/dist/ui/uiBinder.d.ts.map +1 -0
- package/dist/ui/uiBinder.js +344 -0
- package/dist/utils/configAnimations.d.ts.map +1 -1
- package/dist/utils/configAnimations.js +5 -1
- package/dist/utils/gridConfig.d.ts +1 -1
- package/dist/utils/gridConfig.d.ts.map +1 -1
- package/dist/utils/gridConfig.js +1 -1
- package/dist/utils/landPatch.d.ts +33 -0
- package/dist/utils/landPatch.d.ts.map +1 -0
- package/dist/utils/landPatch.js +114 -0
- package/dist/utils/renderedSky.d.ts +32 -0
- package/dist/utils/renderedSky.d.ts.map +1 -0
- package/dist/utils/renderedSky.js +57 -0
- package/dist/utils/skyMoon.d.ts +35 -0
- package/dist/utils/skyMoon.d.ts.map +1 -0
- package/dist/utils/skyMoon.js +41 -0
- package/dist/utils/terrainHeight.d.ts +4 -0
- package/dist/utils/terrainHeight.d.ts.map +1 -0
- package/dist/utils/terrainHeight.js +150 -0
- package/dist/utils/terrainTextureResolver.d.ts +18 -0
- package/dist/utils/terrainTextureResolver.d.ts.map +1 -0
- package/dist/utils/terrainTextureResolver.js +17 -0
- package/dist/utils/terrainUniforms.d.ts +17 -0
- package/dist/utils/terrainUniforms.d.ts.map +1 -1
- package/dist/utils/terrainUniforms.js +84 -0
- package/dist/utils/textureArrays.d.ts +29 -0
- package/dist/utils/textureArrays.d.ts.map +1 -0
- package/dist/utils/textureArrays.js +140 -0
- package/package.json +2 -2
|
@@ -0,0 +1,590 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { prepare, applyAnim, DRAW_METHODS, ERASE_METHODS } from '../methods.js';
|
|
3
|
+
import { buildField, fieldMaterial, fieldQuad } from '../fieldkit.js';
|
|
4
|
+
import { setReveal, REVEAL_UNIFORMS } from '../ribbon.js';
|
|
5
|
+
// =========================================================================================
|
|
6
|
+
// inkBleed — fountain-pen ink soaking into absorbent paper (single-stroke pen paths, per-pixel field).
|
|
7
|
+
//
|
|
8
|
+
// THE MATHS (what is modelled):
|
|
9
|
+
// 1. Capillary wicking (Washburn / diffusion): the wetting front around a pen stroke advances as r(age) = bleed * tanh(1.25*sqrt(age/T)):
|
|
10
|
+
// sqrt(age) growth at first (fast), saturating at `bleed` once the paper has drunk what it can. `age` = seconds since the pen
|
|
11
|
+
// passed that very pixel (ageG), so the feather visibly grows behind the pen.
|
|
12
|
+
// 2. The paper is a fixed procedural fibre network (jittered cells, each with fibres of random orientation, length and strength)
|
|
13
|
+
// plus a low-frequency "formation" cloud (mass density of the sheet). Ink wicks further where fibres are dense: the front is
|
|
14
|
+
// r_eff = r(age) * (1 + fibre * noise) (ragged contour) and each fibre carries ink out to ~2.4 r along its own axis (feathering).
|
|
15
|
+
// 3. Ink density across the line is the diffusion kernel: D = core(pen half-width, widened by pressure wf) + H*exp(-(d/r_eff)^2)
|
|
16
|
+
// (+ the fibre wicks). Slow pen = more pressure = wider, denser, wetter.
|
|
17
|
+
// 4. Coffee ring: as the ink dries (1 - exp(-age/T)) solute is carried to the contact line, so a darker rim forms at the edge
|
|
18
|
+
// of the pen line and at the feather front; strength = pooling * dryness.
|
|
19
|
+
// 5. Colour is dye TRANSMISSION, not a flat colour: T = exp(-(k1*D1 + k2*D2)), k = -ln(colour) per channel (Beer-Lambert),
|
|
20
|
+
// so thin ink = lighter, same hue; and chromatography: the second dye (colour2) is the lighter, faster-wicking component, it
|
|
21
|
+
// travels further (r*1.55) so a brown/teal fringe separates from the dark core. Paper colour * T = what the eye sees.
|
|
22
|
+
// 6. Iron-gall oxidation: ink is written pale blue-grey and darkens (ox = 1-exp(-age*rate(density)/tau), smoothstepped) to its final dye; denser ink oxidises
|
|
23
|
+
// faster, so the front runs from the core outwards. Slowly, ink acid browns the paper (same sqrt diffusion law, wider, stronger under pressure) + a faint verso ghost.
|
|
24
|
+
// 7. Burn (look-native erase, default): the whole deckled sheet burns with the ink on it. Combustion is a front with arrival time T(p) solving the eikonal
|
|
25
|
+
// equation |grad T| = 1/v(p), solved for real at build (multi-source Dijkstra on a 384-wide grid of the sheet) from a few seeded ignition points; the fire
|
|
26
|
+
// runs ~1.7x faster along the iron-gall lines (corrosive ink: letters char first). In the shader T is warped by fbm (uneven local speed) and the front is
|
|
27
|
+
// ragged. Erase progress S.e drives it: pixel p ignites at e = (1-L)*T'(p) and lives for a lifecycle L, so everything is gone by S.e = 1. By age behind the
|
|
28
|
+
// front: ember line (blackbody 1750 K -> 900 K, I ~ T^4) -> cracked char (Voronoi F2-F1, glowing in the cracks) -> ash -> gone (alpha eaten, edges first);
|
|
29
|
+
// the ink survives as a fragile ash lace of the letters that collapses just before the end. Paper curl shading at the front, rising sparks (closed form).
|
|
30
|
+
// 8. Idle: a soft light drifting over the sheet (specular sheen weighted by the fibre relief) and the slow creep of drying.
|
|
31
|
+
// =========================================================================================
|
|
32
|
+
const BURN_COMMON = /* glsl */ `
|
|
33
|
+
uniform sampler2D uArr; uniform vec4 uArrExt; uniform float uL; uniform float uV; uniform float uRough; uniform vec2 uSeedV; uniform float uFire;
|
|
34
|
+
float bh(vec2 p){ vec3 p3 = fract(vec3(p.xyx)*0.1031); p3 += dot(p3, p3.yzx + 33.33); return fract((p3.x + p3.y)*p3.z); }
|
|
35
|
+
float vnz(vec2 p){ vec2 i = floor(p); vec2 f = fract(p); f = f*f*(3.0 - 2.0*f);
|
|
36
|
+
return mix(mix(bh(i), bh(i + vec2(1.0, 0.0)), f.x), mix(bh(i + vec2(0.0, 1.0)), bh(i + vec2(1.0, 1.0)), f.x), f.y); }
|
|
37
|
+
float fbm4(vec2 p){ float a = 0.5; float s = 0.0; for (int i = 0; i < 4; i++){ s += a*vnz(p); p = p*2.03 + vec2(17.1, 9.7); a *= 0.5; } return s/0.9375; }
|
|
38
|
+
vec3 S(vec3 c){ return pow(c, vec3(2.2)); }
|
|
39
|
+
// ember colour from temperature (orange blackbody ramp): cooler = deeper and redder, hotter = paler and more yellow-white; radiance ~ T^4
|
|
40
|
+
vec3 ember(float T){ vec3 b = vec3(1.0, 0.48, 0.11); float h = smoothstep(900.0, 1800.0, T); return pow(b, vec3(mix(1.7, 0.45, h))); }
|
|
41
|
+
float irad(float T){ return pow(T/1500.0, 4.0); }
|
|
42
|
+
// arrival of the front at p in erase-progress units (0 .. 1-L); the eikonal arrival is warped by low-frequency fbm = uneven local speed
|
|
43
|
+
float burnArr(vec2 p){
|
|
44
|
+
float A = texture2D(uArr, (p - uArrExt.xy)/uArrExt.zw).r;
|
|
45
|
+
float amp = 0.34*uRough; float n = fbm4(p*1.5 + uSeedV);
|
|
46
|
+
float w = (1.0 + amp*1.5*(2.0*n - 1.0))/(1.0 + amp*1.5);
|
|
47
|
+
return (1.0 - uL)*clamp(A*w, 0.0, 1.0);
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
const SPARK_VERT = /* glsl */ `
|
|
51
|
+
${REVEAL_UNIFORMS}${BURN_COMMON}
|
|
52
|
+
attribute vec4 aR;
|
|
53
|
+
uniform float uScale; uniform float uSize;
|
|
54
|
+
varying float vA; varying vec3 vCol;
|
|
55
|
+
void main(){
|
|
56
|
+
vec2 pos = position.xy; float a = 0.0; float T = 1300.0; float sz = 1.0;
|
|
57
|
+
float arr = burnArr(position.xy);
|
|
58
|
+
float life = uL*(0.3 + 0.55*aR.x);
|
|
59
|
+
float k = (uE - arr)/life;
|
|
60
|
+
if (uFire > 0.5 && k > 0.0 && k < 1.0){
|
|
61
|
+
float e = 1.0 - pow(1.0 - k, 1.7);
|
|
62
|
+
pos.y += 0.012 + (0.14 + 0.26*aR.y)*e;
|
|
63
|
+
pos.x += (aR.z - 0.5)*0.10*e + 0.025*sin(k*5.0 + aR.w*6.28)*e;
|
|
64
|
+
a = smoothstep(0.0, 0.06, k)*(1.0 - smoothstep(0.45, 1.0, k))*(0.5 + 0.5*aR.w);
|
|
65
|
+
T = mix(1700.0, 950.0, k); sz = 0.7 + 0.6*aR.x;
|
|
66
|
+
}
|
|
67
|
+
a *= 0.75 + 0.25*sin(uTime*(3.0 + 4.0*aR.w) + aR.z*30.0);
|
|
68
|
+
vA = a; vCol = ember(T)*irad(T)*1.1;
|
|
69
|
+
vec4 mv = modelViewMatrix*vec4(pos, 0.001, 1.0); gl_Position = projectionMatrix*mv;
|
|
70
|
+
gl_PointSize = a > 0.001 ? max(2.0, sz*uSize*uScale/-mv.z) : 0.0;
|
|
71
|
+
}`;
|
|
72
|
+
const SPARK_FRAG = /* glsl */ `
|
|
73
|
+
precision highp float; varying float vA; varying vec3 vCol;
|
|
74
|
+
void main(){ vec2 p = gl_PointCoord*2.0 - 1.0; float r = length(p);
|
|
75
|
+
float core = 1.0 - smoothstep(0.0, 0.32, r); float halo = pow(max(1.0 - r, 0.0), 2.6)*0.5;
|
|
76
|
+
float a = (core*0.95 + halo)*vA; if (a < 0.004) discard;
|
|
77
|
+
vec3 c = vCol*a; c /= max(1.0, max(c.r, max(c.g, c.b)));
|
|
78
|
+
gl_FragColor = vec4(c, 1.0);
|
|
79
|
+
#include <tonemapping_fragment>
|
|
80
|
+
#include <colorspace_fragment>
|
|
81
|
+
}`;
|
|
82
|
+
// ---- CPU: eikonal solve on the sheet (multi-source Dijkstra, 16-neighbour stencil) ----------------------------------------------
|
|
83
|
+
function mulberry32(a) { return function () { a |= 0; a = (a + 0x6d2b79f5) | 0; let t = Math.imul(a ^ (a >>> 15), 1 | a); t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t; return ((t ^ (t >>> 14)) >>> 0) / 4294967296; }; }
|
|
84
|
+
function burnMap(strokes, field) {
|
|
85
|
+
const ex = field.ext, ew = ex.z, eh = ex.w;
|
|
86
|
+
const W = 384, H = Math.max(8, Math.round(W * eh / ew)), sx = ew / W, sy = eh / H, N = W * H;
|
|
87
|
+
const rng = mulberry32(7 * 7919 + 13);
|
|
88
|
+
// sheet mask: the same rounded rectangle as paperSD in the shader (without the deckle noise)
|
|
89
|
+
const cx0 = ex.x + ew / 2, cy0 = ex.y + eh / 2, hx = ew / 2 - 0.125, hy = eh / 2 - 0.125;
|
|
90
|
+
const sheet = new Uint8Array(N);
|
|
91
|
+
for (let y = 0; y < H; y++)
|
|
92
|
+
for (let x = 0; x < W; x++) {
|
|
93
|
+
const dx = Math.abs(ex.x + (x + 0.5) * sx - cx0) - hx, dy = Math.abs(ex.y + (y + 0.5) * sy - cy0) - hy;
|
|
94
|
+
sheet[y * W + x] = (Math.hypot(Math.max(dx, 0), Math.max(dy, 0)) + Math.min(Math.max(dx, dy), 0) - 0.05) < 0 ? 1 : 0;
|
|
95
|
+
}
|
|
96
|
+
// the ink: strokes rasterised with a pen-wide line; fire runs faster along it (iron-gall ink is corrosive)
|
|
97
|
+
const cv = document.createElement('canvas');
|
|
98
|
+
cv.width = W;
|
|
99
|
+
cv.height = H;
|
|
100
|
+
const g = cv.getContext('2d', { willReadFrequently: true });
|
|
101
|
+
g.fillStyle = '#000';
|
|
102
|
+
g.fillRect(0, 0, W, H);
|
|
103
|
+
g.strokeStyle = '#fff';
|
|
104
|
+
g.lineCap = 'round';
|
|
105
|
+
g.lineJoin = 'round';
|
|
106
|
+
g.lineWidth = Math.max(1.5, 0.14 / sx);
|
|
107
|
+
for (const s of strokes) {
|
|
108
|
+
g.beginPath();
|
|
109
|
+
for (let i = 0; i < s.pts.length; i += 2) {
|
|
110
|
+
const X = (s.pts[i] - ex.x) / sx, Y = H - (s.pts[i + 1] - ex.y) / sy;
|
|
111
|
+
if (i === 0)
|
|
112
|
+
g.moveTo(X, Y);
|
|
113
|
+
else
|
|
114
|
+
g.lineTo(X, Y);
|
|
115
|
+
}
|
|
116
|
+
g.stroke();
|
|
117
|
+
}
|
|
118
|
+
const im = g.getImageData(0, 0, W, H).data;
|
|
119
|
+
const speed = new Float32Array(N);
|
|
120
|
+
for (let y = 0; y < H; y++)
|
|
121
|
+
for (let x = 0; x < W; x++)
|
|
122
|
+
speed[y * W + x] = 1 + 0.7 * (im[((H - 1 - y) * W + x) * 4] / 255);
|
|
123
|
+
// ignition: two seeded points on the sheet rim and one on the writing (lit a little later)
|
|
124
|
+
const cellAt = (X, Y) => { const ix = Math.max(0, Math.min(W - 1, Math.floor((X - ex.x) / sx))), iy = Math.max(0, Math.min(H - 1, Math.floor((Y - ex.y) / sy))); return iy * W + ix; };
|
|
125
|
+
const nearestSheet = (c) => { let best = -1, bd = 1e30; const X = c % W, Y = (c / W) | 0; for (let p = 0; p < N; p++)
|
|
126
|
+
if (sheet[p]) {
|
|
127
|
+
const d2 = ((p % W) - X) ** 2 + (((p / W) | 0) - Y) ** 2;
|
|
128
|
+
if (d2 < bd) {
|
|
129
|
+
bd = d2;
|
|
130
|
+
best = p;
|
|
131
|
+
}
|
|
132
|
+
} return best; };
|
|
133
|
+
const rimCells = [];
|
|
134
|
+
for (let y = 0; y < H; y++)
|
|
135
|
+
for (let x = 0; x < W; x++) {
|
|
136
|
+
const p = y * W + x;
|
|
137
|
+
if (!sheet[p])
|
|
138
|
+
continue;
|
|
139
|
+
const edge = x === 0 || y === 0 || x === W - 1 || y === H - 1 || !sheet[p - 1] || !sheet[p + 1] || !sheet[p - W] || !sheet[p + W];
|
|
140
|
+
if (edge)
|
|
141
|
+
rimCells.push(p);
|
|
142
|
+
}
|
|
143
|
+
const src = []; // [cell, delay]
|
|
144
|
+
for (let k = 0; k < 2 && rimCells.length; k++)
|
|
145
|
+
src.push([rimCells[Math.floor(rng() * rimCells.length) % rimCells.length], 0]);
|
|
146
|
+
const cands = [];
|
|
147
|
+
strokes.forEach((s) => { const n = s.pts.length / 2; for (let i = 0; i < n; i++)
|
|
148
|
+
cands.push([s.pts[2 * i], s.pts[2 * i + 1]]); });
|
|
149
|
+
if (cands.length) {
|
|
150
|
+
const c = cands[Math.floor(rng() * cands.length) % cands.length];
|
|
151
|
+
const cell = cellAt(c[0], c[1]);
|
|
152
|
+
src.push([sheet[cell] ? cell : nearestSheet(cell), 0.45]);
|
|
153
|
+
}
|
|
154
|
+
const dist = new Float64Array(N).fill(1e30);
|
|
155
|
+
let hk = new Float64Array(1024), hv = new Int32Array(1024), hn = 0;
|
|
156
|
+
const push = (k, v) => { if (hn === hk.length) {
|
|
157
|
+
const a = new Float64Array(hn * 2), b = new Int32Array(hn * 2);
|
|
158
|
+
a.set(hk);
|
|
159
|
+
b.set(hv);
|
|
160
|
+
hk = a;
|
|
161
|
+
hv = b;
|
|
162
|
+
} let i = hn++; while (i > 0) {
|
|
163
|
+
const p = (i - 1) >> 1;
|
|
164
|
+
if (hk[p] <= k)
|
|
165
|
+
break;
|
|
166
|
+
hk[i] = hk[p];
|
|
167
|
+
hv[i] = hv[p];
|
|
168
|
+
i = p;
|
|
169
|
+
} hk[i] = k; hv[i] = v; };
|
|
170
|
+
const pop = () => { const rk = hk[0], rv = hv[0]; const k = hk[--hn], v = hv[hn]; let i = 0; for (;;) {
|
|
171
|
+
let c = 2 * i + 1;
|
|
172
|
+
if (c >= hn)
|
|
173
|
+
break;
|
|
174
|
+
if (c + 1 < hn && hk[c + 1] < hk[c])
|
|
175
|
+
c++;
|
|
176
|
+
if (hk[c] >= k)
|
|
177
|
+
break;
|
|
178
|
+
hk[i] = hk[c];
|
|
179
|
+
hv[i] = hv[c];
|
|
180
|
+
i = c;
|
|
181
|
+
} hk[i] = k; hv[i] = v; return [rk, rv]; };
|
|
182
|
+
for (const [c, dl] of src)
|
|
183
|
+
if (c >= 0) {
|
|
184
|
+
dist[c] = Math.min(dist[c], dl);
|
|
185
|
+
push(dl, c);
|
|
186
|
+
}
|
|
187
|
+
const NB = [[1, 0], [-1, 0], [0, 1], [0, -1], [1, 1], [1, -1], [-1, 1], [-1, -1], [2, 1], [2, -1], [-2, 1], [-2, -1], [1, 2], [1, -2], [-1, 2], [-1, -2]];
|
|
188
|
+
const NL = NB.map(([a, b]) => Math.hypot(a * sx, b * sy));
|
|
189
|
+
while (hn > 0) {
|
|
190
|
+
const [dk, c] = pop();
|
|
191
|
+
if (dk > dist[c])
|
|
192
|
+
continue;
|
|
193
|
+
const cx = c % W, cy = (c / W) | 0;
|
|
194
|
+
for (let j = 0; j < 16; j++) {
|
|
195
|
+
const xx = cx + NB[j][0], yy = cy + NB[j][1];
|
|
196
|
+
if (xx < 0 || yy < 0 || xx >= W || yy >= H)
|
|
197
|
+
continue;
|
|
198
|
+
const q = yy * W + xx;
|
|
199
|
+
if (!sheet[q])
|
|
200
|
+
continue;
|
|
201
|
+
const nd = dk + NL[j] / (0.5 * (speed[c] + speed[q]));
|
|
202
|
+
if (nd < dist[q]) {
|
|
203
|
+
dist[q] = nd;
|
|
204
|
+
push(nd, q);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
let Tmax = 1e-3;
|
|
209
|
+
for (let p = 0; p < N; p++)
|
|
210
|
+
if (sheet[p] && dist[p] < 1e29)
|
|
211
|
+
Tmax = Math.max(Tmax, dist[p]);
|
|
212
|
+
// steady pace: blend T with its cdf over the sheet area (monotone, topology unchanged)
|
|
213
|
+
const ord = [];
|
|
214
|
+
for (let p = 0; p < N; p++)
|
|
215
|
+
if (sheet[p] && dist[p] < 1e29)
|
|
216
|
+
ord.push(p);
|
|
217
|
+
ord.sort((a, b) => dist[a] - dist[b]);
|
|
218
|
+
const EQ = 0.45;
|
|
219
|
+
const A = new Float32Array(N).fill(1);
|
|
220
|
+
const set = new Uint8Array(N);
|
|
221
|
+
ord.forEach((p, i) => { A[p] = ((1 - EQ) * dist[p] / Tmax + EQ * i / Math.max(1, ord.length - 1)); set[p] = 1; });
|
|
222
|
+
// dilate the arrival outwards so the deckle, the shadow and the light spilling over the edge have a front too
|
|
223
|
+
for (let r = 0; r < 9; r++) {
|
|
224
|
+
const nA = A.slice(), nS = set.slice();
|
|
225
|
+
for (let y = 0; y < H; y++)
|
|
226
|
+
for (let x = 0; x < W; x++) {
|
|
227
|
+
const p = y * W + x;
|
|
228
|
+
if (set[p])
|
|
229
|
+
continue;
|
|
230
|
+
let m = 2, f = 0;
|
|
231
|
+
for (let dy = -1; dy <= 1; dy++)
|
|
232
|
+
for (let dx = -1; dx <= 1; dx++) {
|
|
233
|
+
const xx = x + dx, yy = y + dy;
|
|
234
|
+
if (xx < 0 || yy < 0 || xx >= W || yy >= H)
|
|
235
|
+
continue;
|
|
236
|
+
const q = yy * W + xx;
|
|
237
|
+
if (set[q] && A[q] < m) {
|
|
238
|
+
m = A[q];
|
|
239
|
+
f = 1;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
if (f) {
|
|
243
|
+
nA[p] = m;
|
|
244
|
+
nS[p] = 1;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
A.set(nA);
|
|
248
|
+
set.set(nS);
|
|
249
|
+
}
|
|
250
|
+
const hf = THREE.DataUtils.toHalfFloat;
|
|
251
|
+
const data = new Uint16Array(N * 4);
|
|
252
|
+
const one = hf(1);
|
|
253
|
+
for (let p = 0; p < N; p++) {
|
|
254
|
+
data[4 * p] = hf(A[p]);
|
|
255
|
+
data[4 * p + 1] = 0;
|
|
256
|
+
data[4 * p + 2] = 0;
|
|
257
|
+
data[4 * p + 3] = one;
|
|
258
|
+
}
|
|
259
|
+
const tex = new THREE.DataTexture(data, W, H, THREE.RGBAFormat, THREE.HalfFloatType);
|
|
260
|
+
tex.minFilter = tex.magFilter = THREE.LinearFilter;
|
|
261
|
+
tex.wrapS = tex.wrapT = THREE.ClampToEdgeWrapping;
|
|
262
|
+
tex.generateMipmaps = false;
|
|
263
|
+
tex.needsUpdate = true;
|
|
264
|
+
// spark seeds stratified over the burn order: a spark is born every so often along the whole fire
|
|
265
|
+
const seeds = [];
|
|
266
|
+
const NB2 = 56;
|
|
267
|
+
if (ord.length)
|
|
268
|
+
for (let i = 0; i < NB2; i++) {
|
|
269
|
+
const c = ord[Math.min(ord.length - 1, Math.floor(((i + rng()) / NB2) * ord.length))];
|
|
270
|
+
seeds.push({ x: ex.x + ((c % W) + rng()) * sx, y: ex.y + (((c / W) | 0) + rng()) * sy, r: [rng(), rng(), rng(), rng()] });
|
|
271
|
+
}
|
|
272
|
+
return { tex, Tmax, seeds };
|
|
273
|
+
}
|
|
274
|
+
function sparkGeometry(map) {
|
|
275
|
+
const n = map.seeds.length;
|
|
276
|
+
const pos = new Float32Array(n * 3), aR = new Float32Array(n * 4);
|
|
277
|
+
map.seeds.forEach((s, i) => { pos[3 * i] = s.x; pos[3 * i + 1] = s.y; aR.set(s.r, 4 * i); });
|
|
278
|
+
const g = new THREE.BufferGeometry();
|
|
279
|
+
g.setAttribute('position', new THREE.BufferAttribute(pos, 3));
|
|
280
|
+
g.setAttribute('aR', new THREE.BufferAttribute(aR, 4));
|
|
281
|
+
g.boundingSphere = new THREE.Sphere(new THREE.Vector3(), 1e3);
|
|
282
|
+
return g;
|
|
283
|
+
}
|
|
284
|
+
const FRAG = /* glsl */ `
|
|
285
|
+
uniform vec3 uColor; uniform vec3 uColor2; uniform float uBleed; uniform float uDry; uniform float uFibre; uniform float uPool;
|
|
286
|
+
uniform float uWeight; uniform float uPaper; uniform float uOpacity; uniform float uPen; uniform float uTexel; uniform float uOx; uniform float uBurn; uniform float uChar;
|
|
287
|
+
|
|
288
|
+
vec2 h22(vec2 p){ return vec2(h21(p), h21(p + vec2(17.3, 9.1))); }
|
|
289
|
+
float vnoise(vec2 p){ vec2 i = floor(p), f = fract(p); f = f*f*(3.0 - 2.0*f);
|
|
290
|
+
return mix(mix(h21(i), h21(i + vec2(1.0, 0.0)), f.x), mix(h21(i + vec2(0.0, 1.0)), h21(i + vec2(1.0, 1.0)), f.x), f.y); }
|
|
291
|
+
|
|
292
|
+
// fibre network: two fibres per jittered cell, random orientation / length / strength, tapered ends. 18 segment evaluations.
|
|
293
|
+
float fibres(vec2 p, float cell, float w, float seed){
|
|
294
|
+
vec2 ic = floor(p/cell); float best = 0.0;
|
|
295
|
+
for (int j = -1; j <= 1; j++) for (int i = -1; i <= 1; i++) {
|
|
296
|
+
vec2 c = ic + vec2(float(i), float(j));
|
|
297
|
+
for (int k = 0; k < 2; k++) {
|
|
298
|
+
vec2 s = c + vec2(float(k)*7.7 + seed, float(k)*3.1);
|
|
299
|
+
vec2 ctr = (c + h22(s))*cell;
|
|
300
|
+
float ang = h21(s + 3.3)*3.14159265;
|
|
301
|
+
float hl = (0.5 + 0.7*h21(s + 8.1))*cell;
|
|
302
|
+
vec2 dir = vec2(cos(ang), sin(ang)); vec2 pa = p - ctr;
|
|
303
|
+
float t = dot(pa, dir); float d = abs(pa.x*dir.y - pa.y*dir.x);
|
|
304
|
+
float str = (0.4 + 0.6*h21(s + 5.5))*(1.0 - smoothstep(0.55, 1.0, abs(t)/hl));
|
|
305
|
+
best = max(best, str*exp(-(d*d)/(w*w)));
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
return best;
|
|
309
|
+
}
|
|
310
|
+
vec3 vor(vec2 p){ vec2 n = floor(p); vec2 f = fract(p); float F1 = 8.0; float F2 = 8.0; float id = 0.0;
|
|
311
|
+
for (int j = -1; j <= 1; j++) for (int i = -1; i <= 1; i++){
|
|
312
|
+
vec2 g = vec2(float(i), float(j)); vec2 c = n + g;
|
|
313
|
+
vec2 o = vec2(bh(c), bh(c + vec2(31.7, 17.3)));
|
|
314
|
+
float d = length(g + o - f);
|
|
315
|
+
if (d < F1){ F2 = F1; F1 = d; id = bh(c + vec2(5.1, 9.2)); } else if (d < F2) F2 = d;
|
|
316
|
+
} return vec3(F1, F2 - F1, id); }
|
|
317
|
+
float tanhs(float x){ float e = exp(-2.0*min(x, 12.0)); return (1.0 - e)/(1.0 + e); }
|
|
318
|
+
// deckled sheet: rounded rectangle inside the field extent + torn-edge noise. > 0 inside.
|
|
319
|
+
float paperSD(vec2 q){
|
|
320
|
+
vec2 c = uFExt.xy + 0.5*uFExt.zw; vec2 hh = 0.5*uFExt.zw - 0.075 - 0.05; vec2 dd = abs(q - c) - hh;
|
|
321
|
+
float sd = -(length(max(dd, 0.0)) + min(max(dd.x, dd.y), 0.0) - 0.05);
|
|
322
|
+
return sd + (vnoise(q*19.0) - 0.5)*0.034 + (vnoise(q*53.0) - 0.5)*0.014;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
void main(){
|
|
326
|
+
vec2 p = vPos;
|
|
327
|
+
float px = max(fwidth(p.x), 1e-4); // em per screen pixel
|
|
328
|
+
vec4 A = fieldA(p); vec4 B = fieldB(p);
|
|
329
|
+
float d = max(A.x, 0.0); float wf = clamp(B.y, 0.35, 1.8);
|
|
330
|
+
float T0 = max(uDry, 0.05);
|
|
331
|
+
float rpen = 0.5*uPen*uWeight*(0.55 + 0.45*wf); // pressure widens the line
|
|
332
|
+
// round pen tip: pixels within the nib radius of the pen are inked even when their nearest centreline point is still ahead of it
|
|
333
|
+
float ee = 5.0*uTexel;
|
|
334
|
+
vec2 gr = vec2(fieldA(p + vec2(ee, 0.0)).y - fieldA(p - vec2(ee, 0.0)).y, fieldA(p + vec2(0.0, ee)).y - fieldA(p - vec2(0.0, ee)).y)/(2.0*ee);
|
|
335
|
+
float gm = min(length(gr), 0.5);
|
|
336
|
+
float gEff = A.y - gm*sqrt(max(rpen*rpen - d*d, 0.0));
|
|
337
|
+
float vis = revealInG(gEff)*(uFire > 0.5 ? 1.0 : revealOutG(A.z)); // ink presence (draw front, erase front)
|
|
338
|
+
float age = ageG(A.y);
|
|
339
|
+
|
|
340
|
+
// ---- sheet presence: appears as the pen starts, leaves with the last of the ink ----
|
|
341
|
+
float pres = smoothstep(0.0, 0.05, uD)*(uFire > 0.5 ? 1.0 : 1.0 - smoothstep(0.78, 1.0, uE));
|
|
342
|
+
float sd = paperSD(p);
|
|
343
|
+
float mask = smoothstep(-px, px*1.5, sd);
|
|
344
|
+
float shd = smoothstep(-0.05, 0.0, paperSD(p - vec2(0.012, -0.02)))*0.34;
|
|
345
|
+
|
|
346
|
+
// ---- paper: fibre relief + formation ----
|
|
347
|
+
float wfib = max(0.0068, 0.8*px);
|
|
348
|
+
float Fv = fibres(p, 0.085, wfib, 0.0);
|
|
349
|
+
float Q = 0.6*vnoise(p*11.0 + vec2(3.7, 1.3)) + 0.4*vnoise(p*27.0 + vec2(5.1, 8.2));
|
|
350
|
+
float Q2 = 0.65*vnoise(p*38.0 + vec2(9.0, 2.0)) + 0.35*vnoise(p*61.0 + vec2(1.0, 6.0));
|
|
351
|
+
float grain = vnoise(p*210.0);
|
|
352
|
+
vec3 paperCol = vec3(0.74, 0.675, 0.52);
|
|
353
|
+
vec3 paperLit = paperCol*(1.0 + 0.10*(Q - 0.5) + 0.05*(grain - 0.5) + uFibre*0.05*(Fv - 0.3));
|
|
354
|
+
// constant state: a soft light drifting over the sheet (specular on the fibre relief; the paper itself never moves)
|
|
355
|
+
float ti = uTime*0.11*uIdleSpeed*uIdle;
|
|
356
|
+
vec2 lp = uFExt.xy + uFExt.zw*vec2(0.5 + 0.42*sin(ti), 0.5 + 0.30*sin(ti*0.63 + 1.0));
|
|
357
|
+
vec2 dl = (p - lp)/vec2(1.6, 1.0);
|
|
358
|
+
float spot = exp(-dot(dl, dl)/(0.55*uFExt.w*uFExt.w + 0.5));
|
|
359
|
+
paperLit += vec3(0.95, 0.9, 0.78)*spot*(0.25 + 0.75*Fv + 0.35*grain)*0.12*uIdle;
|
|
360
|
+
// paper browning ("ink burn"): the acid of the ink diffuses into the sheet with the same sqrt law as the bleed, only slower and wider,
|
|
361
|
+
// and is strongest beside heavy pen pressure. It stays in the paper when the ink is later erased.
|
|
362
|
+
float visIn = revealInG(A.y);
|
|
363
|
+
float Tb = 4.0*max(uDry, 0.05) + 3.0;
|
|
364
|
+
float gb = tanhs(1.25*sqrt(age/Tb));
|
|
365
|
+
float rBur = (0.05 + 1.6*uBleed)*(0.7 + 0.3*wf)*max(0.35, 1.0 + 0.5*uFibre*(Q - 0.5));
|
|
366
|
+
float pw = pow(clamp(wf, 0.4, 1.8), 1.5);
|
|
367
|
+
float burn = uBurn*gb*(0.75 + 0.25*(1.0 - exp(-age/60.0)))*visIn*pw*(0.5*exp(-(d*d)/(rBur*rBur + 1e-6)) + 0.35*exp(-(d*d)/(0.12*rBur*rBur + 1e-6)));
|
|
368
|
+
// faint show-through of the ink from the verso: a soft, slightly offset greyish-brown imprint of the line
|
|
369
|
+
float dg = max(fieldA(p + vec2(0.006, -0.009)).x, 0.0);
|
|
370
|
+
float ghost = uBurn*gb*visIn*0.5*exp(-(dg*dg)/(6.0*rpen*rpen + 1e-6));
|
|
371
|
+
paperLit *= mix(vec3(1.0), vec3(0.74, 0.55, 0.34), clamp(burn, 0.0, 0.85));
|
|
372
|
+
paperLit *= mix(vec3(1.0), vec3(0.66, 0.62, 0.6), clamp(ghost*0.28, 0.0, 0.3));
|
|
373
|
+
|
|
374
|
+
// ---- ink: wicking front, diffusion kernel, fibre wicks ----
|
|
375
|
+
float x = 1.25*sqrt(age/T0); float grow = tanhs(x);
|
|
376
|
+
float wet = exp(-age/(0.9*T0)); float dry = 1.0 - exp(-age/(1.7*T0));
|
|
377
|
+
float dryL = 0.82*dry + 0.18*(1.0 - exp(-age/40.0)); // residual slow drying keeps raising the rim contrast
|
|
378
|
+
float rb = uBleed*grow*(0.6 + 0.4*wf);
|
|
379
|
+
float rag = max(0.3, 1.0 + uFibre*(1.5*(Q - 0.5) + 0.7*(Q2 - 0.5)));
|
|
380
|
+
float rE = rb*rag;
|
|
381
|
+
float aa = px*0.9;
|
|
382
|
+
|
|
383
|
+
float soft = (mix(0.05, 0.2, grow)*rpen + aa);
|
|
384
|
+
float core = 1.0 - smoothstep(rpen - soft*0.5, rpen + soft, d);
|
|
385
|
+
float haloK = exp(-(d*d)/(rE*rE + 1e-6));
|
|
386
|
+
float wick = uFibre*Fv*Fv*smoothstep(0.25, 0.8, Q + 0.25*(Q2 - 0.5))*exp(-(d*d)/(rb*rb*3.2 + 1e-6)); // fibres in dense paper carry ink ~1.8 r outwards
|
|
387
|
+
float D1 = (0.98 + 0.28*(wf - 0.9))*core*(1.0 + 0.2*wet)
|
|
388
|
+
+ 0.3*(0.6 + 0.4*wf)*grow*haloK
|
|
389
|
+
+ 0.26*wick*grow;
|
|
390
|
+
float rE2 = rE*1.4 + 0.003*grow;
|
|
391
|
+
float D2 = 0.55*grow*exp(-(d*d)/(rE2*rE2 + 1e-6))*(0.85 + 0.9*(Q - 0.5))
|
|
392
|
+
+ 0.35*uFibre*Fv*Fv*exp(-(d*d)/(rb*rb*6.0 + 1e-6))*grow;
|
|
393
|
+
// coffee ring: solute pooled at the contact line of the pen stroke and at the feather front
|
|
394
|
+
float rimC = exp(-pow((d - rpen)/(0.26*rpen + aa), 2.0))*0.5;
|
|
395
|
+
float rimB = exp(-pow((d - rE*0.9)/(0.15*rE + aa), 2.0))*0.12*smoothstep(0.0, 0.012, rE);
|
|
396
|
+
D1 += uPool*dryL*(rimC*(1.0 - 0.6*core) + rimB + rimC*core*0.35);
|
|
397
|
+
// iron-gall oxidation: Fe(II) -> Fe(III) tannate. Written pale blue-grey, it darkens toward the final dye as ox goes 0 -> 1.
|
|
398
|
+
// The reaction runs fastest where the ink is dense, so the front moves from the core outwards and the thin edges stay pale / turn warm.
|
|
399
|
+
float Dn = clamp(D1, 0.0, 1.3);
|
|
400
|
+
float ox = 1.0 - exp(-age*(0.18 + 1.1*Dn)/max(uOx, 0.05));
|
|
401
|
+
ox = ox*ox*(3.0 - 2.0*ox);
|
|
402
|
+
D1 *= vis; D2 *= vis;
|
|
403
|
+
|
|
404
|
+
vec3 freshCol = min(mix(pow(max(uColor, vec3(1e-3)), vec3(0.3)), vec3(0.42, 0.46, 0.52), 0.55), vec3(0.85))*0.82; // pale blue-grey version of the ink
|
|
405
|
+
vec3 colNow = mix(freshCol, uColor, ox);
|
|
406
|
+
vec3 k1 = -log(clamp(colNow/paperCol, vec3(0.01), vec3(1.0))); vec3 k2 = -log(clamp(uColor2/paperCol, vec3(0.01), vec3(1.0))); // k s.t. paper*T = colour at unit density
|
|
407
|
+
k1 = mix(k1, k2, 0.4*(1.0 - clamp(Dn, 0.0, 1.0))*ox); // thin oxidised edges turn warm (rust) rather than navy
|
|
408
|
+
vec3 Tr = exp(-(k1*D1 + k2*D2)); // dye transmission (Beer-Lambert)
|
|
409
|
+
vec3 onPaper = paperLit*Tr;
|
|
410
|
+
// wet gloss: fresh ink reflects the light for a moment (also marks where the pen is)
|
|
411
|
+
float gloss = exp(-age/(0.45*T0))*exp(-(d*d)/(0.07*rpen*rpen + 1e-6))*vis*(0.35 + 0.65*spot)*0.09; // a thin specular streak along the wet line
|
|
412
|
+
onPaper += vec3(0.55, 0.58, 0.62)*gloss*uPaper;
|
|
413
|
+
|
|
414
|
+
// no paper (paper knob 0): ink as pigment over the scene, coverage from density (luminous inks work too)
|
|
415
|
+
float aI = 1.0 - exp(-1.7*(D1 + 0.7*D2));
|
|
416
|
+
vec3 pig = (colNow*D1 + uColor2*0.7*D2)/(D1 + 0.7*D2 + 1e-4);
|
|
417
|
+
vec3 inkOver = pig*aI + vec3(0.7)*gloss*(1.0 - uPaper);
|
|
418
|
+
|
|
419
|
+
float pa = uPaper*mask*pres;
|
|
420
|
+
float sh = shd*uPaper*pres;
|
|
421
|
+
vec3 rgb = pa*onPaper + (1.0 - uPaper)*inkOver;
|
|
422
|
+
float al = pa + (1.0 - pa)*sh + (1.0 - uPaper)*aI*(1.0 - pa);
|
|
423
|
+
|
|
424
|
+
// ======== BURN: the sheet and the ink burn together (look-native erase) ========
|
|
425
|
+
if (uFire > 0.5) {
|
|
426
|
+
float arr = max(0.0, burnArr(p) + uRough*(0.009*(2.0*fbm4(p*13.0 + uSeedV*3.1) - 1.0) + 0.003*(2.0*fbm4(p*41.0 + uSeedV*1.7) - 1.0)));
|
|
427
|
+
float tt = uE - arr; float phi = tt/uL; float Dd = tt*uV; float aheadEm = max(-Dd, 0.0);
|
|
428
|
+
float gEnd = mix(0.14, 1.0, uChar); float psi = max(phi, 0.0)/gEnd;
|
|
429
|
+
float qs = max(sd, 0.0); float qe = mix(max(rpen - d, 0.0)*2.0, qs, uPaper);
|
|
430
|
+
vec2 wp = vec2(vnz(p*7.0 + uSeedV), vnz(p*7.0 + uSeedV + 19.7)) - 0.5;
|
|
431
|
+
vec3 vc = vor(p*15.0 + wp*1.6 + uSeedV*0.37); vec3 vf = vor(p*38.0 + wp*2.5 + uSeedV*0.91 + 7.3);
|
|
432
|
+
float nh = fbm4(p*9.0 + uSeedV*1.3); float cn = fbm4(p*21.0 + uSeedV*2.0);
|
|
433
|
+
float fibB = 0.5 + (Fv - 0.3)*0.5 + (grain - 0.5)*0.4;
|
|
434
|
+
float wC = 0.035 + fwidth(vc.y);
|
|
435
|
+
float cr = max(1.0 - smoothstep(0.02, 0.02 + wC, vc.y), 0.55*(1.0 - smoothstep(0.015, 0.075 + fwidth(vf.y), vf.y)));
|
|
436
|
+
vec3 charC = S(vec3(0.17, 0.13, 0.105))*(0.5 + 0.95*cn)*(0.85 + 0.3*vc.z)*(1.0 - 0.75*cr)*(0.8 + 0.4*fibB);
|
|
437
|
+
vec3 ashC = S(vec3(0.40, 0.375, 0.345))*(0.5 + 0.8*cn)*(0.92 + 0.16*vc.z)*(0.8 + 0.4*fibB)*(1.0 - 0.3*cr);
|
|
438
|
+
float ashMix = smoothstep(0.30, 0.85, psi + 0.3*(nh - 0.5));
|
|
439
|
+
float charMix = smoothstep(0.0, 0.006 + 1.5*px, Dd);
|
|
440
|
+
vec3 burnt = mix(charC, ashC, ashMix)*mix(vec3(1.0), Tr, 0.45*(1.0 - ashMix)); // the ink darkens / tints the char it sits in
|
|
441
|
+
float hh = mix(0.5*nh + 0.5*cn, vc.z, 0.22);
|
|
442
|
+
float thr = mix(0.42, 0.93, hh) - 0.20*exp(-qe/0.03);
|
|
443
|
+
float alive = 1.0 - smoothstep(thr - 0.09, thr + 0.02, psi);
|
|
444
|
+
// paper ahead of the front toasts
|
|
445
|
+
float toast = exp(-aheadEm/0.03);
|
|
446
|
+
vec3 sheetAhead = onPaper*mix(vec3(1.0), vec3(0.62, 0.45, 0.28), toast*0.7);
|
|
447
|
+
vec3 sheetRGB = mix(sheetAhead, burnt, charMix);
|
|
448
|
+
vec3 pigRGB = mix(pig, burnt, charMix);
|
|
449
|
+
// curl: the charring edge lifts toward the viewer (shading only)
|
|
450
|
+
float gate = smoothstep(0.0, 0.02, uE);
|
|
451
|
+
float curlP = 0.6*smoothstep(0.0, 0.012, Dd)*exp(-max(Dd, 0.0)/0.07);
|
|
452
|
+
float hgt = 0.03*curlP*(0.35 + 0.65*exp(-qs/0.04))*(0.8 + 0.4*cn);
|
|
453
|
+
float gx = dFdx(p.x); gx = abs(gx) > 1.0e-6 ? gx : 1.0e-6; float gy = dFdy(p.y); gy = abs(gy) > 1.0e-6 ? gy : 1.0e-6;
|
|
454
|
+
vec2 slope = vec2(dFdx(hgt)/gx, dFdy(hgt)/gy);
|
|
455
|
+
vec3 nrm = normalize(vec3(-slope*0.9, 1.0)); vec3 Ld = normalize(vec3(-0.5, 0.6, 0.65));
|
|
456
|
+
sheetRGB *= clamp(dot(nrm, Ld)/Ld.z, 0.45, 1.5);
|
|
457
|
+
sheetRGB = mix(sheetRGB, S(vec3(0.045, 0.03, 0.02)), clamp(curlP*exp(-qs/0.007), 0.0, 1.0)*0.85*(1.0 - smoothstep(0.0, 0.01, sd)));
|
|
458
|
+
sheetRGB *= 1.0 - 0.38*0.6*gate*exp(-aheadEm/0.04)*(0.4 + 0.6*exp(-qs/0.05));
|
|
459
|
+
// ash lace: the ink outlasts the paper as a fragile skeleton of the letters, cooling to blue-grey, collapsing just before the end
|
|
460
|
+
float thread = smoothstep(0.42, 0.66, fbm4(p*22.0 + uSeedV*0.7));
|
|
461
|
+
float outl = exp(-pow((d - 0.8*rpen)/(0.16*rpen + px), 2.0));
|
|
462
|
+
float lace = max(outl, 0.3*smoothstep(0.35, 0.9, D1))*(0.15 + 0.85*thread);
|
|
463
|
+
float wv = clamp((p.x - uArrExt.x)/uArrExt.z, 0.0, 1.0);
|
|
464
|
+
float tc = mix(0.62, 0.93, clamp(0.6*wv + 0.4*vc.z, 0.0, 1.0));
|
|
465
|
+
float collapse = 1.0 - smoothstep(tc - 0.035, tc + 0.03, uE);
|
|
466
|
+
float laceA = lace*0.55*mix(0.5, 1.0, uChar)*smoothstep(0.30, 0.75, psi)*collapse;
|
|
467
|
+
float cool = smoothstep(0.4, 1.0, psi);
|
|
468
|
+
float shn = pow(vnz(vec2(p.x*4.0 + uTime*0.12*uIdleSpeed, p.y*8.0 + 3.1*vc.z)), 3.0);
|
|
469
|
+
vec3 laceC = mix(S(vec3(0.44, 0.41, 0.38)), S(vec3(0.36, 0.43, 0.52)), cool)*(0.55 + 0.9*shn*cool);
|
|
470
|
+
// the front itself: thin ember line, glowing bed in the cracks, heat halo ahead
|
|
471
|
+
float Dp = max(Dd, 0.0); float onFront = smoothstep(0.0, 0.0035 + 1.5*px, Dd);
|
|
472
|
+
float Te = mix(1750.0, 1150.0, 1.0 - exp(-Dp/0.03)); float line = exp(-Dp/0.012);
|
|
473
|
+
float beat = 0.55 + 0.45*sin(uTime*0.9*uIdleSpeed + vc.z*40.0);
|
|
474
|
+
float bed = exp(-Dp/0.06)*cr*beat*(1.0 - smoothstep(0.04, 0.4, psi));
|
|
475
|
+
float Tbd = mix(1150.0, 880.0, smoothstep(0.0, 0.3, psi));
|
|
476
|
+
vec3 emis = (ember(Te)*irad(Te)*line*0.62 + ember(Tbd)*irad(Tbd)*bed*0.8 + ember(1250.0)*0.09*exp(-Dp/0.035))*onFront;
|
|
477
|
+
emis += ember(1250.0)*0.09*exp(-aheadEm/0.03)*(1.0 - onFront);
|
|
478
|
+
// composite
|
|
479
|
+
float aSheet = uPaper*mask*pres*alive*mix(1.0, 1.0 - 0.2*cr, ashMix*charMix)*(1.0 - 0.5*smoothstep(0.4, 1.0, psi)*charMix);
|
|
480
|
+
float aPig = (1.0 - uPaper)*aI*alive*(1.0 - 0.5*smoothstep(0.4, 1.0, psi)*charMix);
|
|
481
|
+
float aBody = aSheet + aPig*(1.0 - aSheet);
|
|
482
|
+
vec3 bodyC = (sheetRGB*aSheet + pigRGB*aPig*(1.0 - aSheet))/max(aBody, 1.0e-4);
|
|
483
|
+
float aOut = aBody + laceA*(1.0 - aBody);
|
|
484
|
+
vec3 colOut = (bodyC*aBody + laceC*laceA*(1.0 - aBody))/max(aOut, 1.0e-4);
|
|
485
|
+
float cov = max(uPaper*mask*pres, (1.0 - uPaper)*clamp(aI, 0.0, 1.0));
|
|
486
|
+
float spill = exp(-max(-sd, 0.0)/0.014)*(1.0 - smoothstep(0.025, 0.045, max(-sd, 0.0)))*uPaper*pres;
|
|
487
|
+
float mEm = (cov + (1.0 - cov)*spill*0.55)*alive;
|
|
488
|
+
vec3 em = emis*mEm; em /= max(1.0, max(em.r, max(em.g, em.b)));
|
|
489
|
+
float shF = 1.0 - smoothstep(0.45, 0.95, psi);
|
|
490
|
+
rgb = colOut*aOut + em;
|
|
491
|
+
al = aOut + (1.0 - aOut)*(sh*shF);
|
|
492
|
+
}
|
|
493
|
+
rgb *= uOpacity; al = clamp(al*uOpacity, 0.0, 1.0);
|
|
494
|
+
if (al < 0.002) discard;
|
|
495
|
+
gl_FragColor = vec4(rgb, al);
|
|
496
|
+
#include <tonemapping_fragment>
|
|
497
|
+
#include <colorspace_fragment>
|
|
498
|
+
}`;
|
|
499
|
+
const hex = (h) => new THREE.Color(h);
|
|
500
|
+
const num = (name, label, description, min, max, step, unit) => ({ name, label, description, type: 'number', min, max, step, ...(unit ? { unit } : {}) });
|
|
501
|
+
const col = (name, label, description) => ({ name, label, description, type: 'color' });
|
|
502
|
+
export default {
|
|
503
|
+
key: 'inkBleed', source: 'hand', drawMethods: DRAW_METHODS, eraseMethods: ['burn', ...ERASE_METHODS], drawDefault: 'pen', eraseDefault: 'burn',
|
|
504
|
+
animDefaults: { eraseDuration: 6, holdTime: 2.5, eraseEase: 'linear' },
|
|
505
|
+
methodInfo: { burn: { label: 'Burn', hint: 'The whole sheet burns with the ink on it: seeded ignition points, an ember front along the sheet and the writing, char, ash lace, nothing.' } },
|
|
506
|
+
catalog: {
|
|
507
|
+
name: 'Ink Bleed',
|
|
508
|
+
description: 'Fountain-pen ink soaking into fibrous paper: a wetting front feathers along the fibres, dye separates into a coloured fringe and dries to a darker rim. Use for letters, journals and artisanal titles.',
|
|
509
|
+
tags: ['ink', 'bleed', 'paper', 'fountain-pen', 'handwriting', 'calligraphy', 'organic'],
|
|
510
|
+
},
|
|
511
|
+
defaults: { color: '#1b2d6a', color2: '#b0703c', bleed: 0.042, dryTime: 2.4, fibre: 0.7, pooling: 0.7, weight: 0.7, paper: 1, oxidation: 3.5, burn: 0.6, char: 0.6, spread: 1, opacity: 1 },
|
|
512
|
+
ui: {
|
|
513
|
+
main: [
|
|
514
|
+
num('bleed', 'Bleed', 'How far the ink feathers into the paper', 0, 0.12, 0.002, 'em'),
|
|
515
|
+
col('color', 'Ink', 'Colour of the dense dye (the dark core)'),
|
|
516
|
+
num('weight', 'Pen weight', 'Thickness of the pen line', 0.3, 1.6, 0.01),
|
|
517
|
+
num('paper', 'Paper', '0 = ink only, 1 = a sheet of paper behind the text', 0, 1, 0.01),
|
|
518
|
+
],
|
|
519
|
+
more: [
|
|
520
|
+
col('color2', 'Fringe dye', 'Colour of the lighter dye that separates into the halo'),
|
|
521
|
+
num('dryTime', 'Drying time', 'How long the ink keeps wicking before it dries', 0.3, 8, 0.05, 's'),
|
|
522
|
+
num('fibre', 'Fibre', 'How strongly the paper fibres guide and rag the feathering', 0, 1.5, 0.01),
|
|
523
|
+
num('pooling', 'Pooling', 'Dark rim where the ink collects as it dries', 0, 1.5, 0.01),
|
|
524
|
+
num('oxidation', 'Oxidation', 'Seconds the ink takes to darken from pale blue-grey to its final colour (iron-gall oxidation)', 0.3, 20, 0.1, 's'),
|
|
525
|
+
num('burn', 'Ink burn', 'Slow browning of the paper around the lines, strongest where the pen pressed hard', 0, 1.5, 0.01),
|
|
526
|
+
num('char', 'Char', 'How much cracked char and ash the fire leaves behind (0 = clean burn); used by the Burn erase', 0, 1, 0.01),
|
|
527
|
+
num('spread', 'Spread', 'Speed of the fire front; faster fronts leave their remains lingering longer (Burn erase)', 0.3, 2.2, 0.01),
|
|
528
|
+
num('opacity', 'Opacity', 'Overall opacity', 0, 1, 0.01),
|
|
529
|
+
],
|
|
530
|
+
},
|
|
531
|
+
structural: [],
|
|
532
|
+
presets: [
|
|
533
|
+
{ name: 'Blue-black shading', description: 'Navy core with a warm brown fringe on cream paper.', patch: {} },
|
|
534
|
+
{ name: 'Sepia quill', description: 'Brown dye that separates to teal.', patch: { color: '#4a2a14', color2: '#2f8f86', bleed: 0.052, dryTime: 3.2, fibre: 0.9, pooling: 0.9, weight: 0.8, oxidation: 5, burn: 0.8 } },
|
|
535
|
+
{ name: 'Iron gall', description: 'Near-black ink with a rust fringe, crisp and dry.', patch: { color: '#14110f', color2: '#a2491f', bleed: 0.032, dryTime: 1.2, fibre: 0.5, pooling: 1.1, weight: 0.62, oxidation: 6, burn: 1.1 } },
|
|
536
|
+
{ name: 'Soaked blotter', description: 'A wet nib on soft paper: wide, ragged feathering.', patch: { color: '#1a2a6a', color2: '#9a3a5a', bleed: 0.1, dryTime: 5.5, fibre: 1.25, pooling: 0.5, weight: 0.9, oxidation: 2.5, burn: 0.5 } },
|
|
537
|
+
{ name: 'Gold gel', description: 'Luminous gold ink straight on the scene, no paper.', patch: { color: '#e8b64a', color2: '#fff0c0', bleed: 0.022, dryTime: 2, fibre: 0.3, pooling: 0.4, weight: 0.8, paper: 0, oxidation: 0.3, burn: 0 } },
|
|
538
|
+
],
|
|
539
|
+
build(layout, cfg, anim) {
|
|
540
|
+
const strokes = layout.strokes;
|
|
541
|
+
prepare(strokes, 'hand');
|
|
542
|
+
const G = layout.glyphs.length;
|
|
543
|
+
strokes.forEach((s) => { s.glyphN = s.glyph / Math.max(1, G - 1); });
|
|
544
|
+
const { infoD, infoE } = applyAnim(strokes, anim, G);
|
|
545
|
+
const field = buildField(strokes, { source: 'hand', texels: 1024, pad: 0.3, maxDist: 0.4 });
|
|
546
|
+
const map = burnMap(strokes, field);
|
|
547
|
+
const mat = fieldMaterial(field, FRAG, {
|
|
548
|
+
uArr: { value: map.tex }, uArrExt: { value: field.ext }, uL: { value: 0.3 }, uV: { value: 3 }, uRough: { value: 0.6 }, uSeedV: { value: new THREE.Vector2(91.4 % 97, 49.8 % 89) },
|
|
549
|
+
uFire: { value: anim.erase.method === 'burn' ? 1 : 0 }, uChar: { value: cfg.char },
|
|
550
|
+
uColor: { value: hex(cfg.color) }, uColor2: { value: hex(cfg.color2) }, uBleed: { value: cfg.bleed }, uDry: { value: cfg.dryTime }, uFibre: { value: cfg.fibre },
|
|
551
|
+
uPool: { value: cfg.pooling }, uWeight: { value: cfg.weight }, uPaper: { value: cfg.paper }, uOpacity: { value: 1 }, uTexel: { value: field.texel }, uOx: { value: cfg.oxidation }, uBurn: { value: cfg.burn }, uPen: { value: layout.natural || 0.08 },
|
|
552
|
+
}, { extra: BURN_COMMON });
|
|
553
|
+
const mesh = fieldQuad(field, mat);
|
|
554
|
+
const sgeo = sparkGeometry(map);
|
|
555
|
+
const smat = new THREE.ShaderMaterial({ uniforms: { ...mat.uniforms }, vertexShader: SPARK_VERT, fragmentShader: SPARK_FRAG, transparent: true, depthWrite: false, blending: THREE.AdditiveBlending });
|
|
556
|
+
smat.uniforms.uScale = { value: 800 };
|
|
557
|
+
smat.uniforms.uSize = { value: 0.016 };
|
|
558
|
+
const sparks = new THREE.Points(sgeo, smat);
|
|
559
|
+
sparks.frustumCulled = false;
|
|
560
|
+
const group = new THREE.Group();
|
|
561
|
+
group.add(mesh, sparks);
|
|
562
|
+
const api = {
|
|
563
|
+
object: group,
|
|
564
|
+
apply(c) {
|
|
565
|
+
const u = mat.uniforms;
|
|
566
|
+
u.uColor.value.set(c.color);
|
|
567
|
+
u.uColor2.value.set(c.color2);
|
|
568
|
+
u.uBleed.value = c.bleed;
|
|
569
|
+
u.uDry.value = c.dryTime;
|
|
570
|
+
u.uFibre.value = c.fibre;
|
|
571
|
+
u.uPool.value = c.pooling;
|
|
572
|
+
u.uWeight.value = c.weight;
|
|
573
|
+
u.uPaper.value = c.paper;
|
|
574
|
+
u.uOpacity.value = c.opacity;
|
|
575
|
+
u.uOx.value = c.oxidation;
|
|
576
|
+
u.uBurn.value = c.burn;
|
|
577
|
+
u.uChar.value = c.char;
|
|
578
|
+
// spread: fire speed vs. how long the remains linger. L = lifecycle length in erase progress (the front uses 1-L), so S.e = 1 always finishes.
|
|
579
|
+
const L = Math.max(0.12, Math.min(0.62, 0.12 + 0.22 * c.spread));
|
|
580
|
+
u.uL.value = L;
|
|
581
|
+
u.uV.value = map.Tmax / (1 - L);
|
|
582
|
+
api.c = c;
|
|
583
|
+
},
|
|
584
|
+
update(S, time, px) { setReveal(mat.uniforms, S, infoD, infoE, anim.draw.duration, time); smat.uniforms.uScale.value = px; },
|
|
585
|
+
dispose() { field.dispose(); map.tex.dispose(); mat.dispose(); mesh.geometry.dispose(); sgeo.dispose(); smat.dispose(); },
|
|
586
|
+
};
|
|
587
|
+
api.apply(cfg);
|
|
588
|
+
return api;
|
|
589
|
+
},
|
|
590
|
+
};
|