@kolkrabbi/design-editor 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +65 -0
- package/dist/OrbitControls-BAhLQ5d8.js +11630 -0
- package/dist/design-editor.css +3 -0
- package/dist/design-editor.js +63602 -0
- package/dist/favicon/favicon.svg +12 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-Black.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-BlackItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-Bold.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-BoldItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactBlack.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactBlackItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactBold.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactBoldItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactDark.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactDarkItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactFine.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactFineItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactLight.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactLightItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactMedium.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactMediumItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactRegular.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactRegularItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-Dark.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-DarkItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-Fine.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-FineItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-Light.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-LightItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-Medium.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-MediumItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowBlack.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowBlackItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowBold.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowBoldItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowDark.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowDarkItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowFine.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowFineItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowLight.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowLightItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowMedium.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowMediumItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowRegular.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowRegularItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-Regular.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-RegularItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialBlack.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialBlackItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialBold.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialBoldItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialDark.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialDarkItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialFine.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialFineItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialLight.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialLightItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialMedium.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialMediumItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialRegular.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialRegularItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallBlack.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallBlackItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallBold.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallBoldItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallDark.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallDarkItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallFine.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallFineItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallLight.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallLightItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallMedium.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallMediumItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallRegular.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallRegularItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightBlack.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightBlackItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightBold.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightBoldItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightDark.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightDarkItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightFine.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightFineItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightLight.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightLightItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightMedium.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightMediumItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightRegular.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightRegularItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideBlack.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideBlackItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideBold.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideBoldItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideDark.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideDarkItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideFine.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideFineItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideLight.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideLightItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideMedium.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideMediumItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideRegular.woff2 +0 -0
- package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideRegularItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk-Mono/PPRightGroteskMono-Bold.woff2 +0 -0
- package/dist/fonts/Right-Grotesk-Mono/PPRightGroteskMono-BoldItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk-Mono/PPRightGroteskMono-Dark.woff2 +0 -0
- package/dist/fonts/Right-Grotesk-Mono/PPRightGroteskMono-Fine.woff2 +0 -0
- package/dist/fonts/Right-Grotesk-Mono/PPRightGroteskMono-FineItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk-Mono/PPRightGroteskMono-Light.woff2 +0 -0
- package/dist/fonts/Right-Grotesk-Mono/PPRightGroteskMono-Medium.woff2 +0 -0
- package/dist/fonts/Right-Grotesk-Mono/PPRightGroteskMono-Regular.woff2 +0 -0
- package/dist/fonts/Right-Grotesk-Mono/PPRightGroteskMono-RegularItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-CompactLight.woff2 +0 -0
- package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-CompactLightItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-CompactMedium.woff2 +0 -0
- package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-CompactMediumItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-Regular.woff2 +0 -0
- package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-RegularItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-SpatialBold.woff2 +0 -0
- package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-SpatialBoldItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-SpatialLight.woff2 +0 -0
- package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-SpatialLightItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-WideBold.woff2 +0 -0
- package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-WideBoldItalic.woff2 +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-Black.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-BlackItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-Bold.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-BoldItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactBlack.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactBlackItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactBold.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactBoldItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactDark.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactDarkItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactFine.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactFineItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactLight.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactLightItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactMedium.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactMediumItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactRegular.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactRegularItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-Dark.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-DarkItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-Fine.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-FineItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-Light.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-LightItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-Medium.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-MediumItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowBlack.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowBlackItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowBold.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowBoldItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowDark.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowDarkItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowFine.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowFineItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowLight.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowLightItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowMedium.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowMediumItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowRegular.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowRegularItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-Regular.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-RegularItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialBlack.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialBlackItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialBold.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialBoldItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialDark.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialDarkItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialFine.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialFineItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialLight.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialLightItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialMedium.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialMediumItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialRegular.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialRegularItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallBlack.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallBlackItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallBold.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallBoldItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallDark.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallDarkItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallFine.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallFineItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallLight.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallLightItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallMedium.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallMediumItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallRegular.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallRegularItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightBlack.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightBlackItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightBold.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightBoldItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightDark.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightDarkItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightFine.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightFineItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightLight.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightLightItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightMedium.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightMediumItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightRegular.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightRegularItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideBlack.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideBlackItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideBold.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideBoldItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideDark.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideDarkItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideFine.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideFineItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideLight.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideLightItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideMedium.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideMediumItalic.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideRegular.ttf +0 -0
- package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideRegularItalic.ttf +0 -0
- package/dist/fonts/TG/TGGullhamrarVF.ttf +0 -0
- package/dist/fonts/TG/TGMalromurRomanVF.ttf +0 -0
- package/dist/fonts/TG/TGRotVF.ttf +0 -0
- package/dist/fonts/jetbrains-mono/JetBrainsMono-Medium.woff2 +0 -0
- package/dist/fonts/jetbrains-mono/JetBrainsMono-MediumItalic.woff2 +0 -0
- package/dist/fonts/jetbrains-mono/JetBrainsMono-Regular.woff2 +0 -0
- package/dist/fonts/jetbrains-mono/JetBrainsMono-SemiBold.woff2 +0 -0
- package/dist/host-Cidlc8xP.js +718 -0
- package/dist/host-IfZgcJFg.js +2405 -0
- package/dist/meshPalettes-BJODHYrY.js +892 -0
- package/package.json +63 -0
|
@@ -0,0 +1,718 @@
|
|
|
1
|
+
import { B as e, D as t, K as n, L as r, O as i, W as a, at as o, c as s, d as c, it as l, k as u, l as d, nt as f, o as p, p as m, rt as h, s as g, t as _, tt as v, z as y } from "./OrbitControls-BAhLQ5d8.js";
|
|
2
|
+
//#region src/filters/gl/synthBase.js
|
|
3
|
+
var b = "\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = vec4(position.xy, 0.0, 1.0);\n }\n", x = class {
|
|
4
|
+
constructor(e, { autoLoop: t = !1 } = {}) {
|
|
5
|
+
this.canvas = e, this.autoLoop = t, this.renderer = new o({
|
|
6
|
+
canvas: e,
|
|
7
|
+
antialias: !0,
|
|
8
|
+
preserveDrawingBuffer: !0,
|
|
9
|
+
alpha: !0
|
|
10
|
+
}), this.renderer.setClearColor(0, 0), this.params = {}, this.time = 0, this.last = performance.now(), this.tex = null, this.imageAspect = 1, this.w = 1, this.h = 1, this._raf = null, this.paused = !1, this._setup(), this.autoLoop && this.start();
|
|
11
|
+
}
|
|
12
|
+
setSource(e) {
|
|
13
|
+
this.tex && this.tex.dispose();
|
|
14
|
+
let t = new d(e);
|
|
15
|
+
t.minFilter = i, t.magFilter = i, t.wrapS = c, t.wrapT = c, this.tex = t, this.imageAspect = (e.width || 1) / (e.height || 1), this._onImage?.();
|
|
16
|
+
}
|
|
17
|
+
touchSource() {
|
|
18
|
+
this.tex && (this.tex.needsUpdate = !0);
|
|
19
|
+
}
|
|
20
|
+
setParams(e) {
|
|
21
|
+
Object.assign(this.params, e), this._onParams?.();
|
|
22
|
+
}
|
|
23
|
+
setPaused(e) {
|
|
24
|
+
this.paused = !!e;
|
|
25
|
+
}
|
|
26
|
+
reset() {
|
|
27
|
+
this.time = 0, this._reset?.();
|
|
28
|
+
}
|
|
29
|
+
resize(e, t) {
|
|
30
|
+
if (e < 1 || t < 1) return;
|
|
31
|
+
let n = Math.min(window.devicePixelRatio || 1, 2);
|
|
32
|
+
this.renderer.setPixelRatio(n), this.renderer.setSize(e, t, !1), this.w = e, this.h = t, this._resize?.(e, t);
|
|
33
|
+
}
|
|
34
|
+
coverFit() {
|
|
35
|
+
let e = this.w / this.h, t, n;
|
|
36
|
+
return this.imageAspect > e ? (t = e / this.imageAspect, n = 1) : (t = 1, n = this.imageAspect / e), {
|
|
37
|
+
sx: t,
|
|
38
|
+
sy: n,
|
|
39
|
+
ox: (1 - t) / 2,
|
|
40
|
+
oy: (1 - n) / 2
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
step(e) {
|
|
44
|
+
this.paused || (this.time += e * (this.params.speed ?? 1)), this._frame(e);
|
|
45
|
+
}
|
|
46
|
+
frame(e) {
|
|
47
|
+
this.step(e);
|
|
48
|
+
}
|
|
49
|
+
start() {
|
|
50
|
+
if (!this.autoLoop || this._raf) return;
|
|
51
|
+
let e = () => {
|
|
52
|
+
this._raf = requestAnimationFrame(e);
|
|
53
|
+
let t = performance.now(), n = Math.min(.05, (t - this.last) / 1e3);
|
|
54
|
+
this.last = t, this.step(n);
|
|
55
|
+
};
|
|
56
|
+
this._raf = requestAnimationFrame(e);
|
|
57
|
+
}
|
|
58
|
+
exportPNG() {
|
|
59
|
+
return new Promise((e) => this.canvas.toBlob(e, "image/png"));
|
|
60
|
+
}
|
|
61
|
+
recordWebm(e = 6, t = 30) {
|
|
62
|
+
if (typeof MediaRecorder > "u" || !this.canvas.captureStream) return Promise.resolve(null);
|
|
63
|
+
let n = this.canvas.captureStream(t), r = (e) => typeof MediaRecorder.isTypeSupported == "function" && MediaRecorder.isTypeSupported(e), i = r("video/webm;codecs=vp9") ? "video/webm;codecs=vp9" : r("video/webm;codecs=vp8") ? "video/webm;codecs=vp8" : "video/webm", a = new MediaRecorder(n, {
|
|
64
|
+
mimeType: i,
|
|
65
|
+
videoBitsPerSecond: 12e6
|
|
66
|
+
}), o = [];
|
|
67
|
+
return a.ondataavailable = (e) => {
|
|
68
|
+
e.data && e.data.size && o.push(e.data);
|
|
69
|
+
}, new Promise((t) => {
|
|
70
|
+
a.onstop = () => t(new Blob(o, { type: "video/webm" })), a.start(), setTimeout(() => {
|
|
71
|
+
a.state !== "inactive" && a.stop();
|
|
72
|
+
}, e * 1e3);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
dispose() {
|
|
76
|
+
this._raf && cancelAnimationFrame(this._raf), this._raf = null, this._dispose?.(), this.tex && this.tex.dispose(), this.renderer.dispose();
|
|
77
|
+
}
|
|
78
|
+
}, S = "\n precision highp float;\n varying vec2 vUv;\n uniform sampler2D uPrev;\n uniform sampler2D uImage;\n uniform vec2 uScale;\n uniform vec2 uOffset;\n uniform float uDecay;\n uniform float uTaps; // active heads (1..4)\n uniform float uZoom; // per-step feedback zoom\n uniform float uRot; // per-step rotation, rad\n uniform float uDrift; // per-step radial offset (chromatic convergence)\n uniform float uChroma; // per-head colour amount (0 = mono, 1 = full tint)\n uniform float uMix; // live source contribution (0 = pure feedback)\n uniform vec4 uGap; // per-head spacing multipliers (even/triplet/shift)\n uniform vec2 uOrigin; // feedback transform centre (the tunnel vanishing point)\n\n vec3 head(float g, vec3 tint, float on) {\n vec2 c = vUv - uOrigin;\n float a = uRot * g;\n float s = sin(a), co = cos(a);\n c = mat2(co, -s, s, co) * c;\n c *= pow(uZoom, g);\n c += normalize(c + 1e-4) * (uDrift * g);\n vec3 col = texture2D(uPrev, c + uOrigin).rgb;\n return mix(col, col * tint, uChroma) * on;\n }\n\n void main() {\n vec3 fbk = vec3(0.0);\n fbk += head(uGap.x, vec3(1.0, 0.25, 0.20), step(0.5, uTaps));\n fbk += head(uGap.y, vec3(0.30, 1.0, 0.35), step(1.5, uTaps));\n fbk += head(uGap.z, vec3(0.35, 0.50, 1.0), step(2.5, uTaps));\n fbk += head(uGap.w, vec3(1.0, 0.72, 0.25), step(3.5, uTaps));\n fbk = fbk / max(1.0, uTaps) * uDecay;\n vec3 src = texture2D(uImage, vUv * uScale + uOffset).rgb;\n gl_FragColor = vec4(clamp(max(fbk, src * uMix), 0.0, 1.0), 1.0);\n }\n", C = "\n precision highp float;\n varying vec2 vUv;\n uniform sampler2D uTex;\n uniform float uTime;\n uniform float uSat; // saturation boost (1 = none)\n uniform float uLock; // 70s palette colorize mix (0 = off)\n uniform float uHue; // hue cycle speed (0 = off)\n uniform float uGain; // output brightness (1 = none)\n vec3 satBoost(vec3 c, float s) { float l = dot(c, vec3(0.299, 0.587, 0.114)); return clamp(mix(vec3(l), c, s), 0.0, 1.0); }\n mat3 hueRot(float a) {\n float c = cos(a), s = sin(a);\n mat3 w = mat3(0.299, 0.299, 0.299, 0.587, 0.587, 0.587, 0.114, 0.114, 0.114);\n mat3 u = mat3(0.701, -0.299, -0.300, -0.587, 0.413, -0.588, -0.114, -0.114, 0.886);\n mat3 v = mat3(0.168, -0.328, 1.250, 0.330, 0.035, -1.050, -0.497, 0.292, -0.203);\n return w + u * c + v * s;\n }\n // Map luma → a vintage 70s ramp: rust · ochre · cream · teal · blue.\n vec3 pal70(float t) {\n t = clamp(t, 0.0, 1.0) * 4.0;\n vec3 a = vec3(0.75, 0.22, 0.17), b = vec3(0.88, 0.54, 0.12), c = vec3(0.95, 0.91, 0.84), d = vec3(0.16, 0.62, 0.56), e = vec3(0.17, 0.37, 0.54);\n if (t < 1.0) return mix(a, b, t);\n if (t < 2.0) return mix(b, c, t - 1.0);\n if (t < 3.0) return mix(c, d, t - 2.0);\n return mix(d, e, t - 3.0);\n }\n void main() {\n vec3 col = texture2D(uTex, vUv).rgb;\n if (uHue > 0.001) col = clamp(hueRot(uTime * uHue) * col, 0.0, 1.0);\n col = satBoost(col, uSat);\n col = mix(col, pal70(dot(col, vec3(0.299, 0.587, 0.114))), uLock);\n col = clamp(col * uGain, 0.0, 1.0);\n gl_FragColor = vec4(col, 1.0);\n }\n", w = {
|
|
79
|
+
minFilter: i,
|
|
80
|
+
magFilter: i,
|
|
81
|
+
depthBuffer: !1,
|
|
82
|
+
stencilBuffer: !1
|
|
83
|
+
}, T = class extends x {
|
|
84
|
+
_setup() {
|
|
85
|
+
this.camera = new r(-1, 1, 1, -1, 0, 1), this.scene = new a(), this.geo = new e(2, 2), this.rtA = new l(2, 2, w), this.rtB = new l(2, 2, w), this.fbMat = new n({
|
|
86
|
+
vertexShader: b,
|
|
87
|
+
fragmentShader: S,
|
|
88
|
+
uniforms: {
|
|
89
|
+
uPrev: { value: null },
|
|
90
|
+
uImage: { value: null },
|
|
91
|
+
uScale: { value: new v(1, 1) },
|
|
92
|
+
uOffset: { value: new v(0, 0) },
|
|
93
|
+
uDecay: { value: .92 },
|
|
94
|
+
uTaps: { value: 3 },
|
|
95
|
+
uZoom: { value: 1 },
|
|
96
|
+
uRot: { value: 0 },
|
|
97
|
+
uDrift: { value: .02 },
|
|
98
|
+
uChroma: { value: .6 },
|
|
99
|
+
uMix: { value: 1 },
|
|
100
|
+
uGap: { value: new h(1, 2, 3, 4) },
|
|
101
|
+
uOrigin: { value: new v(.5, .5) }
|
|
102
|
+
}
|
|
103
|
+
}), this.copyMat = new n({
|
|
104
|
+
vertexShader: b,
|
|
105
|
+
fragmentShader: C,
|
|
106
|
+
uniforms: {
|
|
107
|
+
uTex: { value: null },
|
|
108
|
+
uTime: { value: 0 },
|
|
109
|
+
uSat: { value: 1 },
|
|
110
|
+
uLock: { value: 0 },
|
|
111
|
+
uHue: { value: 0 },
|
|
112
|
+
uGain: { value: 1 }
|
|
113
|
+
}
|
|
114
|
+
}), this.quad = new u(this.geo, this.fbMat), this.scene.add(this.quad);
|
|
115
|
+
}
|
|
116
|
+
_applyFit() {
|
|
117
|
+
let { sx: e, sy: t, ox: n, oy: r } = this.coverFit();
|
|
118
|
+
this.fbMat.uniforms.uScale.value.set(e, t), this.fbMat.uniforms.uOffset.value.set(n, r);
|
|
119
|
+
}
|
|
120
|
+
_onImage() {
|
|
121
|
+
this._applyFit();
|
|
122
|
+
}
|
|
123
|
+
_onParams() {
|
|
124
|
+
let e = this.params, t = this.fbMat.uniforms;
|
|
125
|
+
t.uDecay.value = e.decay ?? .92, t.uTaps.value = e.taps ?? 3, t.uZoom.value = e.zoom ?? 1, t.uRot.value = e.rotate ?? 0, t.uDrift.value = e.drift ?? .02, t.uChroma.value = e.chroma ?? .6, t.uMix.value = e.mix ?? 1;
|
|
126
|
+
let n = {
|
|
127
|
+
even: [
|
|
128
|
+
1,
|
|
129
|
+
2,
|
|
130
|
+
3,
|
|
131
|
+
4
|
|
132
|
+
],
|
|
133
|
+
triplet: [
|
|
134
|
+
1,
|
|
135
|
+
1.5,
|
|
136
|
+
2.5,
|
|
137
|
+
4
|
|
138
|
+
],
|
|
139
|
+
shift: [
|
|
140
|
+
1,
|
|
141
|
+
2,
|
|
142
|
+
4,
|
|
143
|
+
8
|
|
144
|
+
]
|
|
145
|
+
}, r = n[e.spacing] || n.even;
|
|
146
|
+
t.uGap.value.set(r[0], r[1], r[2], r[3]), t.uOrigin.value.set(e.originX ?? .5, e.originY ?? .5), this.copyMat.uniforms.uSat.value = e.sat ?? 1, this.copyMat.uniforms.uLock.value = e.palette ?? 0, this.copyMat.uniforms.uHue.value = e.hue ?? 0, this.copyMat.uniforms.uGain.value = e.gain ?? 1;
|
|
147
|
+
}
|
|
148
|
+
_resize(e, t) {
|
|
149
|
+
this.rtA.setSize(e, t), this.rtB.setSize(e, t), this.renderer.setRenderTarget(this.rtA), this.renderer.clear(), this.renderer.setRenderTarget(this.rtB), this.renderer.clear(), this.renderer.setRenderTarget(null), this._applyFit();
|
|
150
|
+
}
|
|
151
|
+
_reset() {
|
|
152
|
+
this.renderer.setRenderTarget(this.rtA), this.renderer.clear(), this.renderer.setRenderTarget(this.rtB), this.renderer.clear(), this.renderer.setRenderTarget(null);
|
|
153
|
+
}
|
|
154
|
+
_frame() {
|
|
155
|
+
if (!this.tex) {
|
|
156
|
+
this.renderer.setRenderTarget(null), this.renderer.clear();
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
this.quad.material = this.fbMat, this.fbMat.uniforms.uPrev.value = this.rtA.texture, this.fbMat.uniforms.uImage.value = this.tex, this.renderer.setRenderTarget(this.rtB), this.renderer.render(this.scene, this.camera);
|
|
160
|
+
let e = this.rtA;
|
|
161
|
+
this.rtA = this.rtB, this.rtB = e, this.quad.material = this.copyMat, this.copyMat.uniforms.uTex.value = this.rtA.texture, this.copyMat.uniforms.uTime.value = this.time, this.renderer.setRenderTarget(null), this.renderer.render(this.scene, this.camera);
|
|
162
|
+
}
|
|
163
|
+
_dispose() {
|
|
164
|
+
this.rtA.dispose(), this.rtB.dispose(), this.fbMat.dispose(), this.copyMat.dispose(), this.geo.dispose();
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region src/filters/gl/orbit.js
|
|
169
|
+
function E(e, t, n, r = [
|
|
170
|
+
0,
|
|
171
|
+
0,
|
|
172
|
+
0
|
|
173
|
+
]) {
|
|
174
|
+
let i = Math.cos(t);
|
|
175
|
+
return [
|
|
176
|
+
r[0] + n * i * Math.sin(e),
|
|
177
|
+
r[1] + n * Math.sin(t),
|
|
178
|
+
r[2] + n * i * Math.cos(e)
|
|
179
|
+
];
|
|
180
|
+
}
|
|
181
|
+
//#endregion
|
|
182
|
+
//#region src/filters/gl/scanEngine.js
|
|
183
|
+
var D = "\n uniform sampler2D uImage;\n uniform float uDisplace;\n varying vec3 vColor;\n varying float vLuma;\n void main() {\n vec3 c = texture2D(uImage, uv).rgb;\n float luma = dot(c, vec3(0.299, 0.587, 0.114));\n vColor = c;\n vLuma = luma;\n vec3 p = position;\n p.z += (luma - 0.5) * uDisplace;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(p, 1.0);\n }\n", O = "\n precision highp float;\n varying vec3 vColor;\n varying float vLuma;\n uniform float uMono;\n uniform float uOpacity;\n uniform vec3 uTint;\n void main() {\n vec3 col = mix(vColor, uTint * (0.25 + vLuma), uMono);\n gl_FragColor = vec4(col, uOpacity);\n }\n", k = Math.PI * 2, A = class extends x {
|
|
184
|
+
_setup() {
|
|
185
|
+
this.scene = new a(), this.camera = new y(45, 1, .1, 100);
|
|
186
|
+
let [e, t, r] = E(0, .4, 3);
|
|
187
|
+
this.camera.position.set(e, t, r), this.controls = new _(this.camera, this.canvas), this.controls.enableDamping = !0, this.controls.dampingFactor = .08, this.controls.enablePan = !1, this.controls.minDistance = 1.5, this.controls.maxDistance = 8, this.controls.target.set(0, 0, 0), this.controls.update(), this.mat = new n({
|
|
188
|
+
vertexShader: D,
|
|
189
|
+
fragmentShader: O,
|
|
190
|
+
transparent: !0,
|
|
191
|
+
uniforms: {
|
|
192
|
+
uImage: { value: null },
|
|
193
|
+
uDisplace: { value: 1 },
|
|
194
|
+
uMono: { value: 0 },
|
|
195
|
+
uOpacity: { value: 1 },
|
|
196
|
+
uTint: { value: new m("#9fe7ff") }
|
|
197
|
+
}
|
|
198
|
+
}), this.mesh = null, this.rows = 140, this.cols = 220, this._camKey = "", this._bg = new m("#0b0e13"), this._buildMesh();
|
|
199
|
+
}
|
|
200
|
+
_buildMesh() {
|
|
201
|
+
let e = Math.max(8, Math.round(this.cols)), n = Math.max(8, Math.round(this.rows)), r = this.imageAspect || 1, i = new Float32Array(e * n * 3), a = new Float32Array(e * n * 2);
|
|
202
|
+
for (let t = 0; t < n; t++) for (let o = 0; o < e; o++) {
|
|
203
|
+
let s = t * e + o, c = o / (e - 1), l = t / (n - 1);
|
|
204
|
+
i[s * 3] = (c - .5) * 2 * r, i[s * 3 + 1] = (.5 - l) * 2, i[s * 3 + 2] = 0, a[s * 2] = c, a[s * 2 + 1] = 1 - l;
|
|
205
|
+
}
|
|
206
|
+
let o = [];
|
|
207
|
+
for (let t = 0; t < n; t++) for (let n = 0; n < e - 1; n++) o.push(t * e + n, t * e + n + 1);
|
|
208
|
+
let s = new g();
|
|
209
|
+
s.setAttribute("position", new p(i, 3)), s.setAttribute("uv", new p(a, 2)), s.setIndex(o), this.mesh && (this.scene.remove(this.mesh), this.mesh.geometry.dispose()), this.mesh = new t(s, this.mat), this.scene.add(this.mesh);
|
|
210
|
+
}
|
|
211
|
+
_onImage() {
|
|
212
|
+
this.mat.uniforms.uImage.value = this.tex, this._buildMesh();
|
|
213
|
+
}
|
|
214
|
+
_onParams() {
|
|
215
|
+
let e = this.params;
|
|
216
|
+
this.mat.uniforms.uDisplace.value = e.displace ?? 1, this.mat.uniforms.uMono.value = +!!e.mono, this.mat.uniforms.uOpacity.value = e.opacity ?? 1, e.tint && this.mat.uniforms.uTint.value.set(e.tint);
|
|
217
|
+
let t = Math.round(e.lines ?? 140), n = Math.round(e.cols ?? 220);
|
|
218
|
+
(t !== this.rows || n !== this.cols) && (this.rows = t, this.cols = n, this._buildMesh());
|
|
219
|
+
let r = e.fov ?? 45;
|
|
220
|
+
if (r !== this.camera.fov && (this.camera.fov = r, this.camera.updateProjectionMatrix()), e.bg && this._bg.set(e.bg), !e.cameraMotion) {
|
|
221
|
+
let t = `${e.yaw}|${e.pitch}|${e.dist}`;
|
|
222
|
+
if (t !== this._camKey) {
|
|
223
|
+
this._camKey = t;
|
|
224
|
+
let [n, r, i] = E(e.yaw ?? 0, e.pitch ?? .4, e.dist ?? 3);
|
|
225
|
+
this.camera.position.set(n, r, i), this.controls.target.set(0, 0, 0), this.controls.update();
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
_resize(e, t) {
|
|
230
|
+
this.camera.aspect = e / t, this.camera.updateProjectionMatrix();
|
|
231
|
+
}
|
|
232
|
+
resolveCam() {
|
|
233
|
+
let e = this.params, t = e.yaw ?? 0, n = e.pitch ?? .4, r = e.dist ?? 3;
|
|
234
|
+
if (e.cameraMotion) {
|
|
235
|
+
let i = this.time * (e.motionSpeed ?? .3), a = Math.sin(i * k);
|
|
236
|
+
switch (e.motionPreset) {
|
|
237
|
+
case "spin":
|
|
238
|
+
t = i * 2.2;
|
|
239
|
+
break;
|
|
240
|
+
case "rock":
|
|
241
|
+
t += a * .7;
|
|
242
|
+
break;
|
|
243
|
+
case "rise":
|
|
244
|
+
n += a * .6;
|
|
245
|
+
break;
|
|
246
|
+
case "push":
|
|
247
|
+
r *= 1 - .35 * (.5 + .5 * a);
|
|
248
|
+
break;
|
|
249
|
+
case "pull":
|
|
250
|
+
r *= 1 + .6 * (.5 + .5 * a);
|
|
251
|
+
break;
|
|
252
|
+
default:
|
|
253
|
+
t = i;
|
|
254
|
+
break;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return n = Math.max(-1.4, Math.min(1.4, n)), {
|
|
258
|
+
yaw: t,
|
|
259
|
+
pitch: n,
|
|
260
|
+
dist: r
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
_frame() {
|
|
264
|
+
if (this.renderer.setRenderTarget(null), this.renderer.setClearColor(this._bg, this.params.bgAlpha ?? 1), !this.tex || !this.mesh) {
|
|
265
|
+
this.renderer.clear();
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
if (this.params.cameraMotion) {
|
|
269
|
+
this.controls.enabled = !1;
|
|
270
|
+
let { yaw: e, pitch: t, dist: n } = this.resolveCam(), [r, i, a] = E(e, t, n);
|
|
271
|
+
this.camera.position.set(r, i, a), this.camera.lookAt(0, 0, 0);
|
|
272
|
+
} else this.controls.enabled = !0, this.controls.update();
|
|
273
|
+
this.renderer.render(this.scene, this.camera);
|
|
274
|
+
}
|
|
275
|
+
_dispose() {
|
|
276
|
+
this.controls.dispose(), this.mesh && this.mesh.geometry.dispose(), this.mat.dispose();
|
|
277
|
+
}
|
|
278
|
+
}, j = 160, M = "\n precision highp float;\n varying vec2 vUv;\n uniform sampler2D uImage;\n uniform vec2 uScale, uOffset;\n void main() { gl_FragColor = texture2D(uImage, vUv * uScale + uOffset); }\n", N = "\n precision highp float;\n varying vec2 vUv;\n uniform sampler2D uImage;\n uniform vec2 uScale, uOffset;\n uniform float uSlit;\n uniform int uAxis;\n void main() {\n float cross = (uAxis == 0) ? vUv.y : vUv.x;\n vec2 suv = (uAxis == 0) ? vec2(uSlit, cross) : vec2(cross, uSlit);\n gl_FragColor = texture2D(uImage, suv * uScale + uOffset);\n }\n", P = "\n precision highp float;\n varying vec2 vUv;\n uniform sampler2D uStrip, uImage;\n uniform vec2 uScale, uOffset;\n uniform float uHead, uDir, uOrig, uSmooth;\n uniform int uAxis, uMode; // uMode 0 = chop, 1 = finish\n vec2 sUV(float pos, float cross) { return (uAxis == 0) ? vec2(pos, cross) : vec2(cross, pos); }\n float toPos(float along) {\n if (uMode == 1) { float t = (uDir > 0.0) ? along : 1.0 - along; return fract(uHead - t); }\n return (uDir > 0.0) ? along : 1.0 - along;\n }\n void main() {\n float along = (uAxis == 0) ? vUv.x : vUv.y;\n float cross = (uAxis == 0) ? vUv.y : vUv.x;\n float r = uSmooth * 0.03;\n vec4 e = texture2D(uStrip, sUV(toPos(along), cross)) * 0.383\n + (texture2D(uStrip, sUV(toPos(along + r), cross)) + texture2D(uStrip, sUV(toPos(along - r), cross))) * 0.242\n + (texture2D(uStrip, sUV(toPos(along + 2.0 * r), cross)) + texture2D(uStrip, sUV(toPos(along - 2.0 * r), cross))) * 0.0665;\n vec4 s = texture2D(uImage, vUv * uScale + uOffset);\n gl_FragColor = mix(e, s, uOrig);\n }\n", F = {
|
|
279
|
+
minFilter: i,
|
|
280
|
+
magFilter: i,
|
|
281
|
+
depthBuffer: !1,
|
|
282
|
+
stencilBuffer: !1
|
|
283
|
+
}, I = class extends x {
|
|
284
|
+
_setup() {
|
|
285
|
+
this.camera = new r(-1, 1, 1, -1, 0, 1), this.scene = new a(), this.geo = new e(2, 2), this.quad = new u(this.geo, null), this.scene.add(this.quad), this.scrollMul = 1, this._acc = 0, this.headPx = 0, this.strip = null;
|
|
286
|
+
let t = () => ({
|
|
287
|
+
uImage: { value: null },
|
|
288
|
+
uScale: { value: new v(1, 1) },
|
|
289
|
+
uOffset: { value: new v(0, 0) }
|
|
290
|
+
});
|
|
291
|
+
this.srcMat = new n({
|
|
292
|
+
vertexShader: b,
|
|
293
|
+
fragmentShader: M,
|
|
294
|
+
uniforms: t()
|
|
295
|
+
}), this.slitMat = new n({
|
|
296
|
+
vertexShader: b,
|
|
297
|
+
fragmentShader: N,
|
|
298
|
+
uniforms: {
|
|
299
|
+
...t(),
|
|
300
|
+
uSlit: { value: .5 },
|
|
301
|
+
uAxis: { value: 0 }
|
|
302
|
+
}
|
|
303
|
+
}), this.dispMat = new n({
|
|
304
|
+
vertexShader: b,
|
|
305
|
+
fragmentShader: P,
|
|
306
|
+
uniforms: {
|
|
307
|
+
uStrip: { value: null },
|
|
308
|
+
...t(),
|
|
309
|
+
uHead: { value: 0 },
|
|
310
|
+
uDir: { value: 1 },
|
|
311
|
+
uOrig: { value: 0 },
|
|
312
|
+
uSmooth: { value: 0 },
|
|
313
|
+
uAxis: { value: 0 },
|
|
314
|
+
uMode: { value: 0 }
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
_makeRT(e, t) {
|
|
319
|
+
return new l(Math.max(2, e), Math.max(2, t), F);
|
|
320
|
+
}
|
|
321
|
+
_clearRT(e) {
|
|
322
|
+
this.renderer.setRenderTarget(e), this.renderer.setClearColor(0, 0), this.renderer.clear(), this.renderer.setRenderTarget(null);
|
|
323
|
+
}
|
|
324
|
+
_build() {
|
|
325
|
+
this.w < 2 || this.h < 2 || (this.strip?.dispose(), this.strip = this._makeRT(this.w, this.h), this._clearRT(this.strip), this._acc = 0, this.headPx = 0);
|
|
326
|
+
}
|
|
327
|
+
_applyFit() {
|
|
328
|
+
let { sx: e, sy: t, ox: n, oy: r } = this.coverFit();
|
|
329
|
+
for (let i of [
|
|
330
|
+
this.srcMat,
|
|
331
|
+
this.slitMat,
|
|
332
|
+
this.dispMat
|
|
333
|
+
]) i.uniforms.uScale.value.set(e, t), i.uniforms.uOffset.value.set(n, r);
|
|
334
|
+
}
|
|
335
|
+
_onImage() {
|
|
336
|
+
this._applyFit();
|
|
337
|
+
}
|
|
338
|
+
_onParams() {
|
|
339
|
+
let e = this.params, t = +(e.axis === "vertical");
|
|
340
|
+
this.scrollMul = Math.max(0, e.scroll ?? 1), this.slitMat.uniforms.uSlit.value = Math.max(0, Math.min(1, e.slit ?? .5)), this.slitMat.uniforms.uAxis.value = t;
|
|
341
|
+
let n = this.dispMat.uniforms;
|
|
342
|
+
n.uAxis.value = t, n.uMode.value = +(e.mode === "finish"), n.uDir.value = e.invert ? -1 : 1, n.uOrig.value = Math.max(0, Math.min(1, e.orig ?? 0)), n.uSmooth.value = Math.max(0, Math.min(1, e.smooth ?? 0));
|
|
343
|
+
}
|
|
344
|
+
_resize(e, t) {
|
|
345
|
+
this.w = e, this.h = t, this._build(), this._applyFit();
|
|
346
|
+
}
|
|
347
|
+
_reset() {
|
|
348
|
+
this._build();
|
|
349
|
+
}
|
|
350
|
+
_advance(e) {
|
|
351
|
+
let t = this.params.speed ?? 1;
|
|
352
|
+
this.paused || (this._acc += e * t * this.scrollMul * j);
|
|
353
|
+
let n = Math.floor(this._acc);
|
|
354
|
+
return n > 0 && (this._acc -= n), Math.min(n, Math.floor(Math.max(this.w, this.h) / 2));
|
|
355
|
+
}
|
|
356
|
+
_frame(e) {
|
|
357
|
+
if (this.strip || this._build(), !this.tex || !this.strip) {
|
|
358
|
+
this.renderer.setRenderTarget(null), this.renderer.setClearColor(0, 0), this.renderer.clear();
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
let t = this._advance(e), n = this.params.mode === "finish", r = this.dispMat.uniforms.uAxis.value;
|
|
362
|
+
if (t > 0) {
|
|
363
|
+
let e = r === 0 ? this.w : this.h, i = n ? this.slitMat : this.srcMat;
|
|
364
|
+
i.uniforms.uImage.value = this.tex, this.quad.material = i, this.renderer.setRenderTarget(this.strip), this.renderer.setScissorTest(!0);
|
|
365
|
+
let a = this.headPx, o = Math.min(t, e);
|
|
366
|
+
for (; o > 0;) {
|
|
367
|
+
let t = Math.min(o, e - a);
|
|
368
|
+
r === 0 ? this.renderer.setScissor(a, 0, t, this.h) : this.renderer.setScissor(0, a, this.w, t), this.renderer.render(this.scene, this.camera), a = (a + t) % e, o -= t;
|
|
369
|
+
}
|
|
370
|
+
this.renderer.setScissorTest(!1), this.headPx = (this.headPx + t) % e, this.dispMat.uniforms.uHead.value = this.headPx / e;
|
|
371
|
+
}
|
|
372
|
+
this.dispMat.uniforms.uStrip.value = this.strip.texture, this.dispMat.uniforms.uImage.value = this.tex, this.quad.material = this.dispMat, this.renderer.setRenderTarget(null), this.renderer.render(this.scene, this.camera);
|
|
373
|
+
}
|
|
374
|
+
_dispose() {
|
|
375
|
+
this.strip?.dispose();
|
|
376
|
+
for (let e of [
|
|
377
|
+
this.srcMat,
|
|
378
|
+
this.slitMat,
|
|
379
|
+
this.dispMat
|
|
380
|
+
]) e.dispose();
|
|
381
|
+
this.geo.dispose();
|
|
382
|
+
}
|
|
383
|
+
}, L = "\n precision highp float;\n varying vec2 vUv;\n uniform sampler2D uImage;\n uniform vec2 uScale, uOffset;\n uniform float uTime;\n uniform vec2 uOrigin, uZoomV, uPan, uDrift;\n uniform float uRot, uSpin, uTwist, uSeg;\n uniform int uMirror; // 0 none · 1 kaleido · 2 mirror X · 3 mirror Y · 4 quad\n uniform float uPulse, uPulseRate;\n uniform float uHue, uPost, uStrobe, uSat, uLock;\n\n mat2 rot(float a) { float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }\n vec3 satBoost(vec3 c, float s) { float l = dot(c, vec3(0.299, 0.587, 0.114)); return clamp(mix(vec3(l), c, s), 0.0, 1.0); }\n vec3 pal70(float t) {\n t = clamp(t, 0.0, 1.0) * 4.0;\n vec3 a = vec3(0.75, 0.22, 0.17), b = vec3(0.88, 0.54, 0.12), c = vec3(0.95, 0.91, 0.84), d = vec3(0.16, 0.62, 0.56), e = vec3(0.17, 0.37, 0.54);\n if (t < 1.0) return mix(a, b, t);\n if (t < 2.0) return mix(b, c, t - 1.0);\n if (t < 3.0) return mix(c, d, t - 2.0);\n return mix(d, e, t - 3.0);\n }\n mat3 hueRot(float a) {\n float c = cos(a), s = sin(a);\n mat3 w = mat3(0.299, 0.299, 0.299, 0.587, 0.587, 0.587, 0.114, 0.114, 0.114);\n mat3 u = mat3(0.701, -0.299, -0.300, -0.587, 0.413, -0.588, -0.114, -0.114, 0.886);\n mat3 v = mat3(0.168, -0.328, 1.250, 0.330, 0.035, -1.050, -0.497, 0.292, -0.203);\n return w + u * c + v * s;\n }\n\n void main() {\n vec2 uv = vUv - uOrigin;\n float pulse = 1.0 + uPulse * sin(uTime * uPulseRate * 6.2831853);\n uv /= max(vec2(0.05), uZoomV * pulse);\n uv = rot(uRot + uTime * uSpin) * uv;\n uv = rot(uTwist * length(uv)) * uv;\n if (uMirror == 1) {\n float ang = atan(uv.y, uv.x);\n float rad = length(uv);\n float seg = 6.2831853 / max(1.0, uSeg);\n ang = abs(mod(ang, seg) - seg * 0.5);\n uv = vec2(cos(ang), sin(ang)) * rad;\n } else if (uMirror == 2) { uv.x = abs(uv.x); }\n else if (uMirror == 3) { uv.y = abs(uv.y); }\n else if (uMirror == 4) { uv = abs(uv); }\n uv += uOrigin + uPan + uTime * uDrift;\n vec3 col = texture2D(uImage, fract(uv) * uScale + uOffset).rgb;\n col = clamp(hueRot(uTime * uHue) * col, 0.0, 1.0);\n col = satBoost(col, uSat);\n col = mix(col, pal70(dot(col, vec3(0.299, 0.587, 0.114))), uLock);\n if (uPost > 1.5) col = floor(col * uPost) / uPost;\n if (uStrobe > 0.01) { float f = step(0.5, fract(uTime * uStrobe)); col *= mix(1.0, f, 0.7); }\n gl_FragColor = vec4(col, 1.0);\n }\n", R = {
|
|
384
|
+
none: 0,
|
|
385
|
+
kaleido: 1,
|
|
386
|
+
mirrorX: 2,
|
|
387
|
+
mirrorY: 3,
|
|
388
|
+
quad: 4
|
|
389
|
+
}, ee = class extends x {
|
|
390
|
+
_setup() {
|
|
391
|
+
this.camera = new r(-1, 1, 1, -1, 0, 1), this.scene = new a(), this.geo = new e(2, 2), this.mat = new n({
|
|
392
|
+
vertexShader: b,
|
|
393
|
+
fragmentShader: L,
|
|
394
|
+
uniforms: {
|
|
395
|
+
uImage: { value: null },
|
|
396
|
+
uScale: { value: new v(1, 1) },
|
|
397
|
+
uOffset: { value: new v(0, 0) },
|
|
398
|
+
uTime: { value: 0 },
|
|
399
|
+
uOrigin: { value: new v(.5, .5) },
|
|
400
|
+
uZoomV: { value: new v(1, 1) },
|
|
401
|
+
uPan: { value: new v(0, 0) },
|
|
402
|
+
uDrift: { value: new v(0, 0) },
|
|
403
|
+
uRot: { value: 0 },
|
|
404
|
+
uSpin: { value: .1 },
|
|
405
|
+
uTwist: { value: 0 },
|
|
406
|
+
uSeg: { value: 6 },
|
|
407
|
+
uMirror: { value: 1 },
|
|
408
|
+
uPulse: { value: 0 },
|
|
409
|
+
uPulseRate: { value: .5 },
|
|
410
|
+
uHue: { value: .3 },
|
|
411
|
+
uPost: { value: 0 },
|
|
412
|
+
uStrobe: { value: 0 },
|
|
413
|
+
uSat: { value: 1 },
|
|
414
|
+
uLock: { value: 0 }
|
|
415
|
+
}
|
|
416
|
+
}), this.quad = new u(this.geo, this.mat), this.scene.add(this.quad);
|
|
417
|
+
}
|
|
418
|
+
_applyFit() {
|
|
419
|
+
let { sx: e, sy: t, ox: n, oy: r } = this.coverFit();
|
|
420
|
+
this.mat.uniforms.uScale.value.set(e, t), this.mat.uniforms.uOffset.value.set(n, r);
|
|
421
|
+
}
|
|
422
|
+
_onImage() {
|
|
423
|
+
this.mat.uniforms.uImage.value = this.tex, this._applyFit();
|
|
424
|
+
}
|
|
425
|
+
_onParams() {
|
|
426
|
+
let e = this.params, t = this.mat.uniforms;
|
|
427
|
+
t.uMirror.value = R[e.mirror] ?? 1, t.uSeg.value = e.segments ?? 6, t.uTwist.value = e.twist ?? 0, t.uOrigin.value.set(e.originX ?? .5, e.originY ?? .5), t.uZoomV.value.set(e.zoomX ?? 1, e.zoomY ?? 1), t.uPan.value.set(e.panX ?? 0, e.panY ?? 0), t.uDrift.value.set(e.driftX ?? 0, e.driftY ?? 0), t.uRot.value = e.rotate ?? 0, t.uSpin.value = e.spin ?? .1, t.uPulse.value = e.pulse ?? 0, t.uPulseRate.value = e.pulseRate ?? .5, t.uHue.value = e.hue ?? .3, t.uPost.value = e.posterize ?? 0, t.uStrobe.value = e.strobe ?? 0, t.uSat.value = e.sat ?? 1, t.uLock.value = e.palette ?? 0;
|
|
428
|
+
}
|
|
429
|
+
_resize() {
|
|
430
|
+
this._applyFit();
|
|
431
|
+
}
|
|
432
|
+
_frame() {
|
|
433
|
+
if (this.renderer.setRenderTarget(null), !this.tex) {
|
|
434
|
+
this.renderer.clear();
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
this.mat.uniforms.uImage.value = this.tex, this.mat.uniforms.uTime.value = this.time, this.renderer.render(this.scene, this.camera);
|
|
438
|
+
}
|
|
439
|
+
_dispose() {
|
|
440
|
+
this.mat.dispose(), this.geo.dispose();
|
|
441
|
+
}
|
|
442
|
+
}, z = Math.PI * 2, B = {
|
|
443
|
+
off: null,
|
|
444
|
+
orbit: (e, t) => [.5 + t * Math.cos(e), .5 + t * Math.sin(e)],
|
|
445
|
+
figure8: (e, t) => [.5 + t * Math.sin(e), .5 + t * Math.sin(2 * e) * .5],
|
|
446
|
+
lissajous: (e, t) => [.5 + t * Math.sin(3 * e), .5 + t * Math.sin(2 * e)],
|
|
447
|
+
sweep: (e, t) => [.5 + t * Math.sin(e), .5],
|
|
448
|
+
spiral: (e, t) => {
|
|
449
|
+
let n = t * (.55 + .45 * Math.sin(e * .25));
|
|
450
|
+
return [.5 + n * Math.cos(e), .5 + n * Math.sin(e)];
|
|
451
|
+
}
|
|
452
|
+
}, V = "\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = vec4(position.xy, 0.0, 1.0);\n }\n", H = "\n precision highp float;\n varying vec2 vUv;\n uniform sampler2D uPrev;\n uniform vec2 uMouse;\n uniform float uRadius;\n uniform float uDecay;\n uniform float uAspect;\n uniform float uActive;\n void main() {\n float prev = texture2D(uPrev, vUv).r;\n vec2 d = vUv - uMouse;\n d.x *= uAspect;\n float blob = smoothstep(uRadius, 0.0, length(d)) * uActive;\n float v = max(prev * uDecay, blob);\n gl_FragColor = vec4(vec3(v), 1.0);\n }\n", U = "\n precision highp float;\n varying vec2 vUv;\n uniform sampler2D uImage;\n uniform sampler2D uTrail;\n uniform vec2 uImageScale;\n uniform vec2 uImageOffset;\n uniform float uStrength;\n uniform float uRGBShift;\n uniform vec2 uTexel;\n void main() {\n // Trail intensity at this pixel, plus its gradient (points toward the\n // cursor's bright centre → the refraction direction).\n float t = texture2D(uTrail, vUv).r;\n float tL = texture2D(uTrail, vUv - vec2(uTexel.x, 0.0)).r;\n float tR = texture2D(uTrail, vUv + vec2(uTexel.x, 0.0)).r;\n float tD = texture2D(uTrail, vUv - vec2(0.0, uTexel.y)).r;\n float tU = texture2D(uTrail, vUv + vec2(0.0, uTexel.y)).r;\n vec2 grad = vec2(tR - tL, tU - tD);\n vec2 dir = length(grad) > 1e-5 ? normalize(grad) : vec2(0.0);\n\n vec2 disp = grad * uStrength;\n // Chromatic aberration — R/G/B read at positions offset along the trail\n // direction, magnitude = trail intensity x shift.\n vec2 chroma = dir * t * uRGBShift;\n\n vec2 base = vUv * uImageScale + uImageOffset;\n float r = texture2D(uImage, base + disp + chroma).r;\n float g = texture2D(uImage, base + disp).g;\n float b = texture2D(uImage, base + disp - chroma).b;\n gl_FragColor = vec4(r, g, b, 1.0);\n }\n", W = .5, G = class {
|
|
453
|
+
constructor(t, { autoLoop: s = !1 } = {}) {
|
|
454
|
+
this.canvas = t, this.autoLoop = s, this.renderer = new o({
|
|
455
|
+
canvas: t,
|
|
456
|
+
antialias: !1,
|
|
457
|
+
alpha: !0,
|
|
458
|
+
preserveDrawingBuffer: !0
|
|
459
|
+
}), this.renderer.setClearColor(0, 0), this.camera = new r(-1, 1, 1, -1, 0, 1), this.scene = new a(), this.geo = new e(2, 2), this.target = new v(.5, .5), this.eased = new v(.5, .5), this.active = 0, this.params = {
|
|
460
|
+
strength: .25,
|
|
461
|
+
radius: .18,
|
|
462
|
+
decay: .94,
|
|
463
|
+
rgbShift: .03
|
|
464
|
+
}, this.size = new v(1, 1), this.imageAspect = 1, this.texture = null, this._raf = null, this.paused = !1, this.timeScale = 1, this.motion = {
|
|
465
|
+
shape: "off",
|
|
466
|
+
speed: 1,
|
|
467
|
+
size: .6,
|
|
468
|
+
pulse: 0
|
|
469
|
+
}, this.time = 0, this.last = performance.now();
|
|
470
|
+
let c = {
|
|
471
|
+
minFilter: i,
|
|
472
|
+
magFilter: i,
|
|
473
|
+
depthBuffer: !1,
|
|
474
|
+
stencilBuffer: !1
|
|
475
|
+
};
|
|
476
|
+
this.rtA = new l(2, 2, c), this.rtB = new l(2, 2, c), this.trailMat = new n({
|
|
477
|
+
vertexShader: V,
|
|
478
|
+
fragmentShader: H,
|
|
479
|
+
uniforms: {
|
|
480
|
+
uPrev: { value: null },
|
|
481
|
+
uMouse: { value: new v(.5, .5) },
|
|
482
|
+
uRadius: { value: this.params.radius },
|
|
483
|
+
uDecay: { value: this.params.decay },
|
|
484
|
+
uAspect: { value: 1 },
|
|
485
|
+
uActive: { value: 0 }
|
|
486
|
+
}
|
|
487
|
+
}), this.displayMat = new n({
|
|
488
|
+
vertexShader: V,
|
|
489
|
+
fragmentShader: U,
|
|
490
|
+
uniforms: {
|
|
491
|
+
uImage: { value: null },
|
|
492
|
+
uTrail: { value: null },
|
|
493
|
+
uImageScale: { value: new v(1, 1) },
|
|
494
|
+
uImageOffset: { value: new v(0, 0) },
|
|
495
|
+
uStrength: { value: this.params.strength },
|
|
496
|
+
uRGBShift: { value: this.params.rgbShift },
|
|
497
|
+
uTexel: { value: new v(.5, .5) }
|
|
498
|
+
}
|
|
499
|
+
}), this.quad = new u(this.geo, this.trailMat), this.scene.add(this.quad), this._clearTargets(), this.autoLoop && this.start();
|
|
500
|
+
}
|
|
501
|
+
_clearTargets() {
|
|
502
|
+
this.renderer.setRenderTarget(this.rtA), this.renderer.clear(), this.renderer.setRenderTarget(this.rtB), this.renderer.clear(), this.renderer.setRenderTarget(null);
|
|
503
|
+
}
|
|
504
|
+
setSource(e) {
|
|
505
|
+
this.texture && this.texture.dispose();
|
|
506
|
+
let t = new d(e);
|
|
507
|
+
t.minFilter = i, t.magFilter = i, t.wrapS = c, t.wrapT = c, this.texture = t, this.imageAspect = (e.width || 1) / (e.height || 1), this.displayMat.uniforms.uImage.value = t, this._updateFit();
|
|
508
|
+
}
|
|
509
|
+
touchSource() {
|
|
510
|
+
this.texture && (this.texture.needsUpdate = !0);
|
|
511
|
+
}
|
|
512
|
+
setParams(e) {
|
|
513
|
+
e.strength != null && (this.params.strength = e.strength), e.radius != null && (this.params.radius = e.radius), e.decay != null && (this.params.decay = e.decay), e.rgbShift != null && (this.params.rgbShift = e.rgbShift), e.speed != null && this.setTimeScale(e.speed), (e.px != null || e.py != null) && this.setPointer(e.px ?? this.target.x, e.py ?? this.target.y), e.motionShape != null && (this.motion.shape = e.motionShape), e.motionSpeed != null && (this.motion.speed = e.motionSpeed), e.motionSize != null && (this.motion.size = e.motionSize), e.motionPulse != null && (this.motion.pulse = e.motionPulse), this._apply();
|
|
514
|
+
}
|
|
515
|
+
_apply() {
|
|
516
|
+
this.trailMat.uniforms.uRadius.value = this.params.radius, this.trailMat.uniforms.uDecay.value = this.params.decay, this.displayMat.uniforms.uStrength.value = this.params.strength, this.displayMat.uniforms.uRGBShift.value = this.params.rgbShift;
|
|
517
|
+
}
|
|
518
|
+
setPointer(e, t) {
|
|
519
|
+
this.target.set(e, t), this.active = 1;
|
|
520
|
+
}
|
|
521
|
+
setMotion(e) {
|
|
522
|
+
Object.assign(this.motion, e);
|
|
523
|
+
}
|
|
524
|
+
setPaused(e) {
|
|
525
|
+
this.paused = !!e;
|
|
526
|
+
}
|
|
527
|
+
setTimeScale(e) {
|
|
528
|
+
this.timeScale = Math.max(.05, e);
|
|
529
|
+
}
|
|
530
|
+
clearTrail() {
|
|
531
|
+
this._clearTargets();
|
|
532
|
+
}
|
|
533
|
+
reset() {
|
|
534
|
+
this.time = 0, this._clearTargets();
|
|
535
|
+
}
|
|
536
|
+
resize(e, t) {
|
|
537
|
+
if (e < 1 || t < 1) return;
|
|
538
|
+
let n = Math.min(window.devicePixelRatio || 1, 2);
|
|
539
|
+
this.renderer.setPixelRatio(n), this.renderer.setSize(e, t, !1);
|
|
540
|
+
let r = Math.max(2, Math.round(e * W)), i = Math.max(2, Math.round(t * W));
|
|
541
|
+
this.rtA.setSize(r, i), this.rtB.setSize(r, i), this.size.set(e, t), this.trailMat.uniforms.uAspect.value = e / t, this.displayMat.uniforms.uTexel.value.set(1 / r, 1 / i), this._updateFit(), this._clearTargets();
|
|
542
|
+
}
|
|
543
|
+
_updateFit() {
|
|
544
|
+
let e = this.size.x / this.size.y, t, n;
|
|
545
|
+
this.imageAspect > e ? (t = e / this.imageAspect, n = 1) : (t = 1, n = this.imageAspect / e), this.displayMat.uniforms.uImageScale.value.set(t, n), this.displayMat.uniforms.uImageOffset.value.set((1 - t) / 2, (1 - n) / 2);
|
|
546
|
+
}
|
|
547
|
+
start() {
|
|
548
|
+
if (!this.autoLoop || this._raf) return;
|
|
549
|
+
let e = () => {
|
|
550
|
+
this._raf = requestAnimationFrame(e);
|
|
551
|
+
let t = performance.now(), n = Math.min(.05, (t - this.last) / 1e3);
|
|
552
|
+
this.last = t, this.frame(n);
|
|
553
|
+
};
|
|
554
|
+
this._raf = requestAnimationFrame(e);
|
|
555
|
+
}
|
|
556
|
+
frame(e) {
|
|
557
|
+
this.paused || (this.time += e * this.timeScale);
|
|
558
|
+
let t = B[this.motion.shape];
|
|
559
|
+
if (t) {
|
|
560
|
+
let [e, n] = t(this.time * this.motion.speed, this.motion.size * .5);
|
|
561
|
+
this.target.set(e, n), this.active = 1;
|
|
562
|
+
}
|
|
563
|
+
let n = this.motion.pulse ? 1 + this.motion.pulse * Math.sin(this.time * z * .5 * this.motion.speed) : 1;
|
|
564
|
+
if (this.trailMat.uniforms.uRadius.value = this.params.radius * n, !this.paused && e > 0 || this.active > .001) {
|
|
565
|
+
this.eased.lerp(this.target, .12 * this.timeScale), this.quad.material = this.trailMat, this.trailMat.uniforms.uPrev.value = this.rtA.texture, this.trailMat.uniforms.uMouse.value.copy(this.eased), this.trailMat.uniforms.uActive.value = this.active, this.renderer.setRenderTarget(this.rtB), this.renderer.render(this.scene, this.camera);
|
|
566
|
+
let e = this.rtA;
|
|
567
|
+
this.rtA = this.rtB, this.rtB = e, this.active *= .9;
|
|
568
|
+
}
|
|
569
|
+
this.renderer.setRenderTarget(null), this.texture ? (this.quad.material = this.displayMat, this.displayMat.uniforms.uTrail.value = this.rtA.texture, this.renderer.render(this.scene, this.camera)) : this.renderer.clear();
|
|
570
|
+
}
|
|
571
|
+
dispose() {
|
|
572
|
+
this._raf && cancelAnimationFrame(this._raf), this._raf = null, this.rtA.dispose(), this.rtB.dispose(), this.trailMat.dispose(), this.displayMat.dispose(), this.geo.dispose(), this.texture && this.texture.dispose(), this.renderer.dispose();
|
|
573
|
+
}
|
|
574
|
+
}, K = {
|
|
575
|
+
glass: 0,
|
|
576
|
+
ripple: 1,
|
|
577
|
+
ice: 2,
|
|
578
|
+
mirror: 3,
|
|
579
|
+
kaleido: 4,
|
|
580
|
+
waves: 5
|
|
581
|
+
}, q = "\n varying vec2 vUv;\n void main(){ vUv = uv; gl_Position = vec4(position.xy, 0.0, 1.0); }\n", J = "\n precision highp float;\n varying vec2 vUv;\n uniform sampler2D uPhoto;\n uniform float uHasPhoto, uTime, uScale, uDepth, uChromatic, uFrost, uSheen, uViewAspect, uImgAspect;\n uniform float uLightAngle, uTintAmt, uReflect, uFit, uZoom;\n uniform float uSize, uRadius, uEdge, uMagnify;\n uniform vec2 uOffset, uGlassPos;\n uniform vec3 uTint, uBg;\n uniform int uType, uShape;\n\n float hash(vec2 p){ return fract(sin(dot(p, vec2(127.1,311.7)))*43758.5453); }\n float noise(vec2 p){\n vec2 i=floor(p), f=fract(p); vec2 u=f*f*(3.0-2.0*f);\n return mix(mix(hash(i),hash(i+vec2(1.0,0.0)),u.x),\n mix(hash(i+vec2(0.0,1.0)),hash(i+vec2(1.0,1.0)),u.x), u.y);\n }\n float fbm(vec2 p){ float v=0.0,a=0.5; for(int i=0;i<4;i++){ v+=a*noise(p); p*=2.0; a*=0.5; } return v; }\n\n // ---- LAYER 2 : the glass surface. Height field per surface character. ----\n float H(vec2 uv){\n float t = uTime;\n float f = 1.0 + uScale*6.0;\n if(uType==1){ // ripple — concentric water rings\n float r = length(uv-0.5);\n return sin(r*f*16.0 - t*2.0)*0.5+0.5;\n } else if(uType==2){ // ice — faceted (quantized fbm)\n float n = fbm(uv*f*3.0 + t*0.15);\n return floor(n*7.0)/7.0;\n } else if(uType==3){ // liquid metal — low freq flowing\n return fbm(uv*f*0.7 + t*0.1);\n } else if(uType==4){ // mirror — banded ridges (hall-of-mirrors folds)\n float n = fbm(uv*f*1.2 + t*0.1);\n return abs(sin((uv.x*0.6+uv.y*0.4)*f*10.0 + n*3.0 - t));\n } else if(uType==5){ // waves — directional water, fbm-perturbed\n float n = fbm(uv*f*1.5 + t*0.2);\n return sin((uv.x+uv.y)*f*9.0 + n*4.0 - t*1.6)*0.5+0.5;\n }\n return fbm(uv*f + t*0.12); // glass — organic bumps\n }\n\n // ---- LAYER 1 : the photo, placed in the frame (fit / zoom / offset). ----\n // Returns the image uv; inside-flag tells if it's within [0,1] (contain bars).\n vec2 placeUV(vec2 uv, out bool inside){\n vec2 sCover = uViewAspect > uImgAspect ? vec2(1.0, uImgAspect/uViewAspect) : vec2(uViewAspect/uImgAspect, 1.0);\n vec2 sContain = uViewAspect > uImgAspect ? vec2(uViewAspect/uImgAspect, 1.0) : vec2(1.0, uImgAspect/uViewAspect);\n vec2 s = mix(sCover, sContain, step(0.5, uFit));\n vec2 p = (uv - 0.5) * s / max(uZoom, 0.01) + 0.5 - uOffset;\n inside = p.x > 0.0 && p.x < 1.0 && p.y > 0.0 && p.y < 1.0;\n return p;\n }\n // Sample the photo at a screen-uv; outside the image (contain) gives bg colour.\n vec3 samplePhoto(vec2 uv){\n bool inside; vec2 p = placeUV(uv, inside);\n if(!inside && uFit > 0.5) return uBg;\n return texture2D(uPhoto, clamp(p, 0.001, 0.999)).rgb;\n }\n\n // ---- LAYER 2 bounds : the glass OBJECT. Signed distance, <0 = inside. ----\n float glassSDF(vec2 uv){\n vec2 p = (uv - uGlassPos);\n p.x *= uViewAspect;\n if(uShape == 1){ // circle / lens\n return length(p) - uSize;\n }\n vec2 d = abs(p) - vec2(uSize) + uRadius;\n return min(max(d.x, d.y), 0.0) + length(max(d, 0.0)) - uRadius;\n }\n\n void main(){\n vec2 uv = vUv;\n if(uHasPhoto < 0.5){ gl_FragColor = vec4(0.02,0.025,0.04,1.0); return; }\n\n // === LAYER 1 — the photo, plain. Shows AROUND the glass. ===\n vec3 bg = samplePhoto(uv);\n\n float sd = glassSDF(uv);\n float inside = 1.0 - smoothstep(-0.004, 0.004, sd);\n\n // === LAYER 2 — the photo seen THROUGH the glass (refracted) ===\n float e = 0.004;\n vec2 grad = vec2(H(uv+vec2(e,0.0))-H(uv-vec2(e,0.0)), H(uv+vec2(0.0,e))-H(uv-vec2(0.0,e)));\n vec2 off = grad * uDepth * 8.0;\n float disp = uChromatic*0.0025 * (0.4 + uDepth*30.0);\n float mag = 1.0 + uMagnify + uDepth*3.0;\n vec2 guv = (uv - uGlassPos)/mag + uGlassPos - off;\n\n vec3 refr = vec3(\n samplePhoto(guv - off*disp).r,\n samplePhoto(guv).g,\n samplePhoto(guv + off*disp).b\n );\n if(uFrost > 0.001){\n vec3 acc = refr; float r = uFrost*0.01;\n acc += samplePhoto(guv + vec2(r,0.0));\n acc += samplePhoto(guv + vec2(-r,0.0));\n acc += samplePhoto(guv + vec2(0.0,r));\n acc += samplePhoto(guv + vec2(0.0,-r));\n refr = mix(refr, acc/5.0, clamp(uFrost*0.12, 0.0, 1.0));\n }\n refr = mix(refr, refr * uTint, uTintAmt);\n\n vec2 lightDir = vec2(cos(uLightAngle), sin(uLightAngle));\n float facing = clamp(dot(normalize(grad + 1e-5), lightDir), 0.0, 1.0);\n float steep = clamp(length(grad) * 18.0, 0.0, 1.0);\n refr += uReflect * (H(uv) - 0.5) * 0.8;\n refr += (pow(steep, 1.5) * 0.5 + pow(facing, 3.0)) * steep * uSheen;\n\n // === composite: glass object OVER the photo ===\n vec3 col = mix(bg, refr, inside);\n\n float rim = 1.0 - smoothstep(0.0, max(uEdge, 0.001), abs(sd));\n float lit = 0.5 + 0.5*dot(normalize(uv - uGlassPos + 1e-5), lightDir);\n col += rim * (0.35 + 0.65*lit) * (0.5 + uSheen);\n\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n", Y = {
|
|
582
|
+
trails: T,
|
|
583
|
+
scan: A,
|
|
584
|
+
slitscan: I,
|
|
585
|
+
disco: ee,
|
|
586
|
+
distort: G,
|
|
587
|
+
lens: class {
|
|
588
|
+
constructor(t, { autoLoop: r = !1 } = {}) {
|
|
589
|
+
this.canvas = t, this.autoLoop = r, this.playing = !0, this.time = 0, this.flow = 1, this._raf = null, this.last = performance.now(), this.renderer = new o({
|
|
590
|
+
canvas: t,
|
|
591
|
+
antialias: !0,
|
|
592
|
+
preserveDrawingBuffer: !0
|
|
593
|
+
}), this.scene = new a(), this.cam = new s(), this.uniforms = {
|
|
594
|
+
uPhoto: { value: null },
|
|
595
|
+
uHasPhoto: { value: 0 },
|
|
596
|
+
uTime: { value: 0 },
|
|
597
|
+
uType: { value: 0 },
|
|
598
|
+
uScale: { value: .4 },
|
|
599
|
+
uDepth: { value: .06 },
|
|
600
|
+
uChromatic: { value: 6 },
|
|
601
|
+
uFrost: { value: 0 },
|
|
602
|
+
uSheen: { value: .5 },
|
|
603
|
+
uLightAngle: { value: Math.PI * .25 },
|
|
604
|
+
uTint: { value: new f(1, 1, 1) },
|
|
605
|
+
uTintAmt: { value: 0 },
|
|
606
|
+
uReflect: { value: 0 },
|
|
607
|
+
uFit: { value: 0 },
|
|
608
|
+
uZoom: { value: 1 },
|
|
609
|
+
uOffset: { value: new v(0, 0) },
|
|
610
|
+
uBg: { value: new f(.02, .025, .04) },
|
|
611
|
+
uShape: { value: 0 },
|
|
612
|
+
uSize: { value: .45 },
|
|
613
|
+
uRadius: { value: .08 },
|
|
614
|
+
uEdge: { value: .02 },
|
|
615
|
+
uMagnify: { value: .1 },
|
|
616
|
+
uGlassPos: { value: new v(.5, .5) },
|
|
617
|
+
uViewAspect: { value: 1 },
|
|
618
|
+
uImgAspect: { value: 1 }
|
|
619
|
+
}, this.mat = new n({
|
|
620
|
+
vertexShader: q,
|
|
621
|
+
fragmentShader: J,
|
|
622
|
+
uniforms: this.uniforms
|
|
623
|
+
}), this.geo = new e(2, 2), this.scene.add(new u(this.geo, this.mat)), this.autoLoop && this.start();
|
|
624
|
+
}
|
|
625
|
+
resize(e, t) {
|
|
626
|
+
!this.renderer || e < 1 || t < 1 || (this.renderer.setPixelRatio(Math.min(2, window.devicePixelRatio || 1)), this.renderer.setSize(e, t, !1), this.uniforms.uViewAspect.value = e / t);
|
|
627
|
+
}
|
|
628
|
+
setSource(e) {
|
|
629
|
+
if (!this.uniforms) return;
|
|
630
|
+
if (!e) {
|
|
631
|
+
this.uniforms.uHasPhoto.value = 0;
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
let t = new d(e);
|
|
635
|
+
t.minFilter = i, t.magFilter = i, t.wrapS = t.wrapT = c, this.tex && this.tex.dispose(), this.tex = t, this.uniforms.uPhoto.value = t, this.uniforms.uHasPhoto.value = 1, this.uniforms.uImgAspect.value = (e.width || 1) / (e.height || 1);
|
|
636
|
+
}
|
|
637
|
+
touchSource() {
|
|
638
|
+
this.tex && (this.tex.needsUpdate = !0);
|
|
639
|
+
}
|
|
640
|
+
setParams(e) {
|
|
641
|
+
if (this.uniforms) {
|
|
642
|
+
if (e.type != null && (this.uniforms.uType.value = K[e.type] ?? 0), e.scale != null && (this.uniforms.uScale.value = e.scale), e.depth != null && (this.uniforms.uDepth.value = e.depth / 1e3), e.chromatic != null && (this.uniforms.uChromatic.value = e.chromatic), e.frost != null && (this.uniforms.uFrost.value = e.frost), e.sheen != null && (this.uniforms.uSheen.value = e.sheen), e.reflect != null && (this.uniforms.uReflect.value = e.reflect), e.lightAngle != null && (this.uniforms.uLightAngle.value = e.lightAngle * Math.PI / 180), e.tint != null) {
|
|
643
|
+
let t = parseInt(e.tint.slice(1), 16);
|
|
644
|
+
this.uniforms.uTint.value.set((t >> 16 & 255) / 255, (t >> 8 & 255) / 255, (t & 255) / 255);
|
|
645
|
+
}
|
|
646
|
+
if (e.tintAmt != null && (this.uniforms.uTintAmt.value = e.tintAmt), e.fit != null && (this.uniforms.uFit.value = +(e.fit === "contain")), e.zoom != null && (this.uniforms.uZoom.value = e.zoom), e.offsetX != null && (this.uniforms.uOffset.value.x = e.offsetX), e.offsetY != null && (this.uniforms.uOffset.value.y = e.offsetY), e.bg != null) {
|
|
647
|
+
let t = parseInt(e.bg.slice(1), 16);
|
|
648
|
+
this.uniforms.uBg.value.set((t >> 16 & 255) / 255, (t >> 8 & 255) / 255, (t & 255) / 255);
|
|
649
|
+
}
|
|
650
|
+
e.shape != null && (this.uniforms.uShape.value = +(e.shape === "circle")), e.size != null && (this.uniforms.uSize.value = e.size), e.radius != null && (this.uniforms.uRadius.value = e.radius), e.edge != null && (this.uniforms.uEdge.value = e.edge), e.magnify != null && (this.uniforms.uMagnify.value = e.magnify), e.glassX != null && (this.uniforms.uGlassPos.value.x = e.glassX), e.glassY != null && (this.uniforms.uGlassPos.value.y = e.glassY), e.flow != null && (this.flow = e.flow);
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
setPlaying(e) {
|
|
654
|
+
this.playing = e;
|
|
655
|
+
}
|
|
656
|
+
resetTime() {
|
|
657
|
+
this.time = 0, this.uniforms && (this.uniforms.uTime.value = 0);
|
|
658
|
+
}
|
|
659
|
+
getTime() {
|
|
660
|
+
return this.time;
|
|
661
|
+
}
|
|
662
|
+
frame(e) {
|
|
663
|
+
this.renderer && (this.playing && (this.time += e * this.flow), this.uniforms.uTime.value = this.time, this.renderer.render(this.scene, this.cam));
|
|
664
|
+
}
|
|
665
|
+
start() {
|
|
666
|
+
if (!this.autoLoop || this._raf) return;
|
|
667
|
+
let e = () => {
|
|
668
|
+
this._raf = requestAnimationFrame(e);
|
|
669
|
+
let t = performance.now(), n = Math.min(.05, (t - this.last) / 1e3);
|
|
670
|
+
this.last = t, this.frame(n);
|
|
671
|
+
};
|
|
672
|
+
this._raf = requestAnimationFrame(e);
|
|
673
|
+
}
|
|
674
|
+
async exportBlob(e, t) {
|
|
675
|
+
if (!this.renderer) return null;
|
|
676
|
+
if (e && t) {
|
|
677
|
+
let n = this.canvas.width, r = this.canvas.height, i = this.uniforms.uViewAspect.value;
|
|
678
|
+
this.renderer.setPixelRatio(1), this.renderer.setSize(e, t, !1), this.uniforms.uViewAspect.value = e / t, this.renderer.render(this.scene, this.cam);
|
|
679
|
+
let a = await new Promise((e) => this.canvas.toBlob(e, "image/png"));
|
|
680
|
+
return this.renderer.setSize(n, r, !1), this.uniforms.uViewAspect.value = i, this.renderer.render(this.scene, this.cam), a;
|
|
681
|
+
}
|
|
682
|
+
return this.renderer.render(this.scene, this.cam), new Promise((e) => this.canvas.toBlob(e, "image/png"));
|
|
683
|
+
}
|
|
684
|
+
dispose() {
|
|
685
|
+
this._raf && cancelAnimationFrame(this._raf), this._raf = null, this.tex && this.tex.dispose(), this.mat.dispose(), this.geo.dispose(), this.renderer &&= (this.renderer.dispose(), null);
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
};
|
|
689
|
+
function X(e, t) {
|
|
690
|
+
let n = Y[e?.engine];
|
|
691
|
+
if (!n) throw Error(`unknown gl filter engine "${e?.engine}"`);
|
|
692
|
+
let r = new n(t);
|
|
693
|
+
return r.controls && (r.controls.enabled = !1), r;
|
|
694
|
+
}
|
|
695
|
+
function Z(e, t, n) {
|
|
696
|
+
t?.controls && (t.controls.enabled = !!n);
|
|
697
|
+
}
|
|
698
|
+
function Q(e, t, n) {
|
|
699
|
+
t.setSource(n);
|
|
700
|
+
}
|
|
701
|
+
function $(e, t) {
|
|
702
|
+
t.touchSource?.();
|
|
703
|
+
}
|
|
704
|
+
function te(e, t, n) {
|
|
705
|
+
t.setParams(n);
|
|
706
|
+
}
|
|
707
|
+
function ne(e, t, { dt: n }) {
|
|
708
|
+
t.frame(n);
|
|
709
|
+
}
|
|
710
|
+
function re(e) {
|
|
711
|
+
if (e) try {
|
|
712
|
+
typeof e.dispose == "function" ? e.dispose() : typeof e.destroy == "function" && e.destroy();
|
|
713
|
+
} catch (e) {
|
|
714
|
+
console.warn("[gl] engine dispose failed (ignored):", e?.message ?? e);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
//#endregion
|
|
718
|
+
export { te as applyParams, X as createEngine, re as destroyEngine, ne as driveEngine, Z as setCameraDrag, Q as setSource, $ as touchSource };
|