fancy-ui-vue 0.2.0 → 0.4.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/PORTING.md +123 -2
- package/README.md +20 -15
- package/dist/components/accordion/Accordion.vue.d.ts +44 -0
- package/dist/components/accordion/Accordion.vue.js +88 -0
- package/dist/components/accordion/Accordion.vue2.js +4 -0
- package/dist/components/accordion/AccordionContent.vue.d.ts +25 -0
- package/dist/components/accordion/AccordionContent.vue.js +42 -0
- package/dist/components/accordion/AccordionContent.vue2.js +4 -0
- package/dist/components/accordion/AccordionItem.vue.d.ts +21 -0
- package/dist/components/accordion/AccordionItem.vue.js +66 -0
- package/dist/components/accordion/AccordionItem.vue2.js +4 -0
- package/dist/components/accordion/AccordionTrigger.vue.d.ts +24 -0
- package/dist/components/accordion/AccordionTrigger.vue.js +83 -0
- package/dist/components/accordion/AccordionTrigger.vue2.js +4 -0
- package/dist/components/accordion/accordion-core.d.ts +35 -0
- package/dist/components/accordion/accordion-core.js +44 -0
- package/dist/components/accordion/index.d.ts +11 -0
- package/dist/components/accordion/types.d.ts +45 -0
- package/dist/components/accordion/types.js +7 -0
- package/dist/components/alert-dialog/AlertDialog.vue.js +22 -3
- package/dist/components/animated-testimonials/AnimatedTestimonials.vue.js +3 -3
- package/dist/components/apple-card-carousel/AppleCard.vue.js +1 -1
- package/dist/components/autocomplete/Autocomplete.vue.js +1 -1
- package/dist/components/autocomplete/Autocomplete.vue2.js +22 -15
- package/dist/components/avatar/Avatar.vue.d.ts +27 -0
- package/dist/components/avatar/Avatar.vue.js +119 -0
- package/dist/components/avatar/Avatar.vue2.js +4 -0
- package/dist/components/avatar/avatar-core.d.ts +40 -0
- package/dist/components/avatar/avatar-core.js +57 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/badge/Badge.vue.d.ts +21 -0
- package/dist/components/badge/Badge.vue.js +46 -0
- package/dist/components/badge/Badge.vue2.js +4 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/bento-grid/BentoFrame.vue.js +1 -1
- package/dist/components/bento-grid/BentoFrame.vue2.js +6 -5
- package/dist/components/bento-grid/BentoGrid.vue.js +1 -1
- package/dist/components/bento-grid/BentoGrid.vue2.js +12 -12
- package/dist/components/bento-grid/BentoGridCard.vue.js +6 -5
- package/dist/components/bento-grid/BentoGridItem.vue.js +6 -5
- package/dist/components/bg-falling-stars/FallingStarsBg.vue.d.ts +1 -1
- package/dist/components/bg-falling-stars/FallingStarsBg.vue.js +1 -1
- package/dist/components/bg-falling-stars/bg-falling-stars-core.d.ts +1 -1
- package/dist/components/bg-falling-stars/bg-falling-stars-core.js +47 -12
- package/dist/components/book/Book.vue.js +8 -9
- package/dist/components/book/BookDescription.vue.js +6 -5
- package/dist/components/book/BookHeader.vue.js +6 -5
- package/dist/components/book/BookTitle.vue.js +6 -5
- package/dist/components/box-reveal/BoxReveal.vue.js +6 -5
- package/dist/components/button/Button.vue.d.ts +6 -4
- package/dist/components/button/Button.vue.js +1 -1
- package/dist/components/button/Button.vue2.js +50 -22
- package/dist/components/card-3d/CardContainer.vue.js +1 -1
- package/dist/components/card-3d/CardItem.vue.js +1 -1
- package/dist/components/card-spotlight/CardSpotlight.vue.js +1 -1
- package/dist/components/chat-message/ChatMessageAction.vue.d.ts +4 -2
- package/dist/components/chat-message/ChatMessageAction.vue.js +4 -2
- package/dist/components/checkbox/Checkbox.vue.d.ts +2 -0
- package/dist/components/checkbox/Checkbox.vue.js +1 -1
- package/dist/components/checkbox/Checkbox.vue2.js +17 -7
- package/dist/components/collapsible/Collapsible.vue.d.ts +31 -0
- package/dist/components/collapsible/Collapsible.vue.js +60 -0
- package/dist/components/collapsible/Collapsible.vue2.js +4 -0
- package/dist/components/collapsible/CollapsibleContent.vue.d.ts +26 -0
- package/dist/components/collapsible/CollapsibleContent.vue.js +81 -0
- package/dist/components/collapsible/CollapsibleContent.vue2.js +4 -0
- package/dist/components/collapsible/CollapsibleTrigger.vue.d.ts +21 -0
- package/dist/components/collapsible/CollapsibleTrigger.vue.js +57 -0
- package/dist/components/collapsible/CollapsibleTrigger.vue2.js +4 -0
- package/dist/components/collapsible/collapsible-core.d.ts +47 -0
- package/dist/components/collapsible/collapsible-core.js +40 -0
- package/dist/components/collapsible/index.d.ts +8 -0
- package/dist/components/collapsible/types.d.ts +24 -0
- package/dist/components/collapsible/types.js +5 -0
- package/dist/components/combobox/Combobox.vue.js +1 -1
- package/dist/components/combobox/Combobox.vue2.js +24 -16
- package/dist/components/command-menu/CommandMenu.vue.d.ts +5 -0
- package/dist/components/command-menu/CommandMenu.vue.js +1 -1
- package/dist/components/command-menu/CommandMenu.vue2.js +5 -2
- package/dist/components/compare/Compare.vue.d.ts +15 -5
- package/dist/components/compare/Compare.vue.js +1 -1
- package/dist/components/compare/Compare.vue2.js +28 -13
- package/dist/components/composer/ComposerInput.vue.js +1 -1
- package/dist/components/composer/ComposerInput.vue2.js +11 -11
- package/dist/components/composer/ComposerModelPicker.vue.d.ts +4 -0
- package/dist/components/composer/ComposerModelPicker.vue.js +1 -1
- package/dist/components/composer/ComposerModelPicker.vue2.js +29 -15
- package/dist/components/composer/ComposerSubmit.vue.d.ts +2 -0
- package/dist/components/composer/ComposerSubmit.vue.js +16 -15
- package/dist/components/confetti/ConfettiButton.vue.d.ts +9 -2
- package/dist/components/confetti/ConfettiButton.vue.js +24 -6
- package/dist/components/container-text-flip/ContainerTextFlip.vue.js +1 -1
- package/dist/components/container-text-flip/ContainerTextFlip.vue2.js +12 -13
- package/dist/components/copy-button/CopyButton.vue.d.ts +5 -0
- package/dist/components/copy-button/CopyButton.vue.js +1 -1
- package/dist/components/copy-button/CopyButton.vue2.js +72 -11
- package/dist/components/datamosh-transition/DatamoshTransition.vue.d.ts +6 -2
- package/dist/components/datamosh-transition/DatamoshTransition.vue.js +7 -4
- package/dist/components/date-picker/DatePicker.vue.js +1 -1
- package/dist/components/date-picker/DatePicker.vue2.js +27 -21
- package/dist/components/dialog/Dialog.vue.js +20 -1
- package/dist/components/dialog/DialogSurface.vue.js +1 -1
- package/dist/components/dialog/DialogSurface.vue2.js +5 -2
- package/dist/components/dialog/types.d.ts +2 -0
- package/dist/components/direction-aware-hover/DirectionAwareHover.vue.js +1 -1
- package/dist/components/direction-aware-hover/DirectionAwareHover.vue2.js +9 -7
- package/dist/components/displacement-text/DisplacementText.vue.d.ts +4 -1
- package/dist/components/displacement-text/DisplacementText.vue.js +38 -11
- package/dist/components/displacement-text/displacement-text-core.d.ts +94 -4
- package/dist/components/displacement-text/displacement-text-core.js +287 -97
- package/dist/components/drawer/Drawer.vue.d.ts +5 -0
- package/dist/components/drawer/Drawer.vue.js +1 -1
- package/dist/components/drawer/Drawer.vue2.js +5 -2
- package/dist/components/dropdown-menu/DropdownMenuContent.vue.js +2 -1
- package/dist/components/dropdown-menu/DropdownMenuItem.vue.d.ts +4 -0
- package/dist/components/dropdown-menu/DropdownMenuItem.vue.js +17 -10
- package/dist/components/dropdown-menu/DropdownMenuSubTrigger.vue.d.ts +8 -0
- package/dist/components/dropdown-menu/DropdownMenuSubTrigger.vue.js +28 -13
- package/dist/components/dropdown-menu/DropdownMenuTrigger.vue.d.ts +4 -0
- package/dist/components/dropdown-menu/DropdownMenuTrigger.vue.js +1 -1
- package/dist/components/dropdown-menu/DropdownMenuTrigger.vue2.js +20 -10
- package/dist/components/editorial-engine/EditorialEngine.vue.js +1 -1
- package/dist/components/editorial-engine/engine.js +13 -0
- package/dist/components/file-upload/FileUpload.vue.d.ts +2 -0
- package/dist/components/file-upload/FileUpload.vue.js +1 -1
- package/dist/components/file-upload/FileUpload.vue2.js +20 -10
- package/dist/components/fireworks-hdr/FireworksHdr.vue.js +2 -2
- package/dist/components/flickering-grid/FlickeringGrid.vue.d.ts +1 -1
- package/dist/components/flickering-grid/FlickeringGrid.vue.js +1 -1
- package/dist/components/flickering-grid/flickering-grid-core.d.ts +1 -1
- package/dist/components/flickering-grid/flickering-grid-core.js +51 -9
- package/dist/components/flip-card/FlipCard.vue.d.ts +3 -1
- package/dist/components/flip-card/FlipCard.vue.js +1 -1
- package/dist/components/flip-card/FlipCard.vue2.js +5 -3
- package/dist/components/fluid-cursor/FluidCursor.vue.js +37 -9
- package/dist/components/fluid-cursor/fluid-cursor-core.js +3 -3
- package/dist/components/fluid-cursor/webgpu-engine.js +3 -3
- package/dist/components/focus/Focus.vue.js +1 -1
- package/dist/components/focus/Focus.vue2.js +2 -2
- package/dist/components/follow-button/FollowButton.vue.d.ts +69 -0
- package/dist/components/follow-button/FollowButton.vue.js +7 -0
- package/dist/components/follow-button/FollowButton.vue2.js +239 -0
- package/dist/components/follow-button/follow-core.d.ts +83 -0
- package/dist/components/follow-button/follow-core.js +92 -0
- package/dist/components/follow-button/index.d.ts +2 -0
- package/dist/components/frosted-glass/FrostedGlass.vue.js +1 -1
- package/dist/components/glare-card/GlareCard.vue.js +1 -1
- package/dist/components/glare-card/GlareCard.vue2.js +4 -4
- package/dist/components/glowing-effect/GlowingEffect.vue.js +3 -3
- package/dist/components/glowing-effect/glowing-effect-core.js +4 -1
- package/dist/components/gradient-button/GradientButton.vue.d.ts +6 -4
- package/dist/components/gradient-button/GradientButton.vue.js +1 -1
- package/dist/components/gradient-button/GradientButton.vue2.js +13 -3
- package/dist/components/icon-button/IconButton.vue.d.ts +6 -4
- package/dist/components/icon-button/IconButton.vue.js +11 -8
- package/dist/components/image-trail-cursor/ImageTrailCursor.vue.js +17 -7
- package/dist/components/image-trail-cursor/trail-variants.js +3 -6
- package/dist/components/inline-citation/InlineCitation.vue.js +1 -1
- package/dist/components/inline-citation/InlineCitation.vue2.js +20 -14
- package/dist/components/input/Input.vue.js +1 -1
- package/dist/components/input/Input.vue2.js +18 -8
- package/dist/components/interactive-grid-pattern/InteractiveGridPattern.vue.js +1 -1
- package/dist/components/interactive-grid-pattern/InteractiveGridPattern.vue2.js +1 -1
- package/dist/components/interactive-hover-button/InteractiveHoverButton.vue.d.ts +6 -3
- package/dist/components/interactive-hover-button/InteractiveHoverButton.vue.js +1 -1
- package/dist/components/interactive-hover-button/InteractiveHoverButton.vue2.js +12 -2
- package/dist/components/letter-pullup/LetterPullup.vue.js +4 -4
- package/dist/components/line-hover-link/LineHoverLink.vue.js +1 -1
- package/dist/components/line-hover-link/LineHoverLink.vue2.js +5 -6
- package/dist/components/link/Link.vue.d.ts +4 -2
- package/dist/components/link/Link.vue.js +1 -1
- package/dist/components/link/Link.vue2.js +11 -8
- package/dist/components/magnetic-field/MagnetPuck.vue.d.ts +51 -0
- package/dist/components/magnetic-field/MagnetPuck.vue.js +7 -0
- package/dist/components/magnetic-field/MagnetPuck.vue2.js +191 -0
- package/dist/components/magnetic-field/MagneticField.vue.d.ts +39 -0
- package/dist/components/magnetic-field/MagneticField.vue.js +7 -0
- package/dist/components/magnetic-field/MagneticField.vue2.js +157 -0
- package/dist/components/magnetic-field/MagneticItem.vue.d.ts +28 -0
- package/dist/components/magnetic-field/MagneticItem.vue.js +7 -0
- package/dist/components/magnetic-field/MagneticItem.vue2.js +72 -0
- package/dist/components/magnetic-field/index.d.ts +10 -0
- package/dist/components/magnetic-field/magnetic-field-core.d.ts +163 -0
- package/dist/components/magnetic-field/magnetic-field-core.js +534 -0
- package/dist/components/magnetic-field/magnetic-field-source.d.ts +58 -0
- package/dist/components/magnetic-field/magnetic-field-source.js +58 -0
- package/dist/components/magnetic-field/types.d.ts +14 -0
- package/dist/components/magnetic-field/types.js +5 -0
- package/dist/components/mosaic-glow/MosaicGlow.vue.d.ts +6 -0
- package/dist/components/mosaic-glow/MosaicGlow.vue.js +53 -9
- package/dist/components/mosaic-glow/mosaic-glow-core.d.ts +30 -0
- package/dist/components/mosaic-glow/mosaic-glow-core.js +27 -0
- package/dist/components/mosaic-glow/mosaic-glow-hdr.d.ts +24 -0
- package/dist/components/mosaic-glow/mosaic-glow-hdr.js +200 -0
- package/dist/components/navbar/NavbarLink.vue.d.ts +4 -2
- package/dist/components/navbar/NavbarLink.vue.js +1 -1
- package/dist/components/navbar/NavbarLink.vue2.js +16 -13
- package/dist/components/navigation-menu/NavigationMenu.vue.js +6 -3
- package/dist/components/navigation-menu/NavigationMenuLink.vue.js +1 -1
- package/dist/components/navigation-menu/NavigationMenuLink.vue2.js +8 -8
- package/dist/components/navigation-menu/NavigationMenuTrigger.vue.d.ts +15 -0
- package/dist/components/navigation-menu/NavigationMenuTrigger.vue.js +1 -1
- package/dist/components/navigation-menu/NavigationMenuTrigger.vue2.js +36 -15
- package/dist/components/neon-border/NeonBorder.vue.js +1 -1
- package/dist/components/neon-border/NeonBorder.vue2.js +10 -11
- package/dist/components/number-input/NumberInput.vue.js +1 -1
- package/dist/components/number-input/NumberInput.vue2.js +22 -12
- package/dist/components/password-input/PasswordInput.vue.js +1 -1
- package/dist/components/password-input/PasswordInput.vue2.js +18 -11
- package/dist/components/pixel-loader/PixelLoader.vue.js +1 -1
- package/dist/components/pixel-loader/PixelLoader.vue2.js +6 -6
- package/dist/components/pixel-scene/PixelScene.vue.d.ts +60 -0
- package/dist/components/pixel-scene/PixelScene.vue.js +184 -0
- package/dist/components/pixel-scene/PixelScene.vue2.js +4 -0
- package/dist/components/pixel-scene/index.d.ts +4 -0
- package/dist/components/pixel-scene/pixel-scene-core.d.ts +256 -0
- package/dist/components/pixel-scene/pixel-scene-core.js +878 -0
- package/dist/components/pixel-scene/pixel-scene-hdr.d.ts +68 -0
- package/dist/components/pixel-scene/pixel-scene-hdr.js +312 -0
- package/dist/components/pixel-scene/pixel-scene-scenes.d.ts +31 -0
- package/dist/components/pixel-scene/pixel-scene-scenes.js +1074 -0
- package/dist/components/popover/Popover.vue.d.ts +4 -0
- package/dist/components/popover/Popover.vue.js +1 -1
- package/dist/components/popover/Popover.vue2.js +8 -6
- package/dist/components/popover/PopoverContent.vue.js +6 -2
- package/dist/components/pulse-beam/PulseBeam.vue.d.ts +6 -2
- package/dist/components/pulse-beam/PulseBeam.vue.js +1 -1
- package/dist/components/pulse-beam/PulseBeam.vue2.js +7 -4
- package/dist/components/radio-group/RadioGroup.vue.js +12 -11
- package/dist/components/radio-group/RadioGroupItem.vue.d.ts +2 -0
- package/dist/components/radio-group/RadioGroupItem.vue.js +1 -1
- package/dist/components/radio-group/RadioGroupItem.vue2.js +20 -7
- package/dist/components/rainbow-button/RainbowButton.vue.d.ts +11 -2
- package/dist/components/rainbow-button/RainbowButton.vue.js +1 -1
- package/dist/components/rainbow-button/RainbowButton.vue2.js +35 -18
- package/dist/components/ripple-button/RippleButton.vue.d.ts +6 -4
- package/dist/components/ripple-button/RippleButton.vue.js +1 -1
- package/dist/components/ripple-button/RippleButton.vue2.js +10 -5
- package/dist/components/search-input/SearchInput.vue.js +1 -1
- package/dist/components/search-input/SearchInput.vue2.js +19 -9
- package/dist/components/select/Select.vue.d.ts +1 -1
- package/dist/components/select/Select.vue.js +1 -1
- package/dist/components/select/Select.vue2.js +25 -17
- package/dist/components/sheet/Sheet.vue.d.ts +5 -0
- package/dist/components/sheet/Sheet.vue.js +5 -2
- package/dist/components/shimmer-button/ShimmerButton.vue.d.ts +2 -2
- package/dist/components/shimmer-button/ShimmerButton.vue.js +1 -1
- package/dist/components/shimmer-button/ShimmerButton.vue2.js +14 -6
- package/dist/components/sidebar/SidebarItem.vue.d.ts +4 -2
- package/dist/components/sidebar/SidebarItem.vue.js +1 -1
- package/dist/components/sidebar/SidebarItem.vue2.js +4 -2
- package/dist/components/slider/Slider.vue.d.ts +4 -0
- package/dist/components/slider/Slider.vue.js +1 -1
- package/dist/components/slider/Slider.vue2.js +20 -8
- package/dist/components/sources/SourcesTrigger.vue.js +1 -1
- package/dist/components/sources/SourcesTrigger.vue2.js +11 -11
- package/dist/components/sparkles/sparkles-core.d.ts +1 -1
- package/dist/components/sparkles/sparkles-core.js +36 -2
- package/dist/components/story-thread/StoryNode.vue.d.ts +11 -0
- package/dist/components/story-thread/StoryNode.vue.js +7 -0
- package/dist/components/story-thread/StoryNode.vue2.js +23 -0
- package/dist/components/story-thread/StoryThread.vue.d.ts +56 -0
- package/dist/components/story-thread/StoryThread.vue.js +7 -0
- package/dist/components/story-thread/StoryThread.vue2.js +103 -0
- package/dist/components/story-thread/index.d.ts +5 -0
- package/dist/components/story-thread/story-thread-core.d.ts +119 -0
- package/dist/components/story-thread/story-thread-core.js +491 -0
- package/dist/components/story-thread/types.d.ts +1 -0
- package/dist/components/sun-switch/SunSwitch.vue.d.ts +61 -0
- package/dist/components/sun-switch/SunSwitch.vue.js +7 -0
- package/dist/components/sun-switch/SunSwitch.vue2.js +559 -0
- package/dist/components/sun-switch/index.d.ts +4 -0
- package/dist/components/sun-switch/pixel-wave-core.d.ts +82 -0
- package/dist/components/sun-switch/pixel-wave-core.js +508 -0
- package/dist/components/sun-switch/sun-switch-core.d.ts +251 -0
- package/dist/components/sun-switch/sun-switch-core.js +546 -0
- package/dist/components/sun-switch/sun-switch-hdr.d.ts +70 -0
- package/dist/components/sun-switch/sun-switch-hdr.js +311 -0
- package/dist/components/switch/Switch.vue.d.ts +2 -0
- package/dist/components/switch/Switch.vue.js +1 -1
- package/dist/components/switch/Switch.vue2.js +16 -6
- package/dist/components/tabs/TabsTrigger.vue.d.ts +6 -0
- package/dist/components/tabs/TabsTrigger.vue.js +1 -1
- package/dist/components/tabs/TabsTrigger.vue2.js +28 -15
- package/dist/components/terminal-block/TerminalBlock.vue.js +1 -1
- package/dist/components/terminal-block/TerminalBlock.vue2.js +10 -9
- package/dist/components/text-reveal-card/TextRevealCard.vue.js +1 -2
- package/dist/components/textarea/Textarea.vue.js +1 -1
- package/dist/components/textarea/Textarea.vue2.js +19 -12
- package/dist/components/tick-nav/TickNav.vue.d.ts +71 -0
- package/dist/components/tick-nav/TickNav.vue.js +7 -0
- package/dist/components/tick-nav/TickNav.vue2.js +285 -0
- package/dist/components/tick-nav/index.d.ts +3 -0
- package/dist/components/tick-nav/tick-nav-core.d.ts +102 -0
- package/dist/components/tick-nav/tick-nav-core.js +398 -0
- package/dist/components/tick-nav/tick-nav-hdr.d.ts +60 -0
- package/dist/components/tick-nav/tick-nav-hdr.js +284 -0
- package/dist/components/tick-nav/types.d.ts +13 -0
- package/dist/components/time-picker/TimePicker.vue.js +1 -1
- package/dist/components/time-picker/TimePicker.vue2.js +25 -17
- package/dist/components/toast/Toast.vue.js +1 -1
- package/dist/components/toast/Toast.vue2.js +16 -4
- package/dist/components/toast/index.d.ts +1 -1
- package/dist/components/toast/store.d.ts +23 -0
- package/dist/components/toast/store.js +35 -7
- package/dist/components/toggle/Toggle.vue.d.ts +12 -0
- package/dist/components/toggle/Toggle.vue.js +1 -1
- package/dist/components/toggle/Toggle.vue2.js +27 -11
- package/dist/components/toggle-group/ToggleGroup.vue.d.ts +11 -0
- package/dist/components/toggle-group/ToggleGroup.vue.js +1 -1
- package/dist/components/toggle-group/ToggleGroup.vue2.js +16 -3
- package/dist/components/toggle-group/ToggleGroupItem.vue.d.ts +6 -0
- package/dist/components/toggle-group/ToggleGroupItem.vue.js +1 -1
- package/dist/components/toggle-group/ToggleGroupItem.vue2.js +27 -14
- package/dist/components/tooltip/Tooltip.vue.js +13 -0
- package/dist/components/tracing-beam/TracingBeam.vue.d.ts +20 -1
- package/dist/components/tracing-beam/TracingBeam.vue.js +5 -164
- package/dist/components/tracing-beam/TracingBeam.vue2.js +168 -1
- package/dist/components/typing-indicator/TypingIndicator.vue.js +1 -1
- package/dist/components/typing-indicator/TypingIndicator.vue2.js +7 -6
- package/dist/index.d.ts +10 -0
- package/dist/index.js +466 -413
- package/dist/internals/anchor-position.js +3 -0
- package/dist/internals/call-listener.d.ts +11 -0
- package/dist/internals/call-listener.js +31 -0
- package/dist/internals/dismissable.d.ts +17 -0
- package/dist/internals/dismissable.js +44 -1
- package/dist/internals/env.d.ts +1 -0
- package/dist/internals/env.js +11 -0
- package/dist/internals/focus-trap.js +29 -4
- package/dist/internals/merge-ids.d.ts +6 -0
- package/dist/internals/merge-ids.js +11 -0
- package/dist/internals/motion/presence-core.d.ts +1 -1
- package/dist/sound/engine.js +23 -9
- package/dist/sound/themes.d.ts +4 -3
- package/dist/sound/themes.js +49 -211
- package/dist/sound/types.d.ts +9 -1
- package/dist/sound/types.js +2 -2
- package/dist/styles.css +1473 -571
- package/package.json +2 -2
- package/tailwind.css +9 -9
|
@@ -0,0 +1,1074 @@
|
|
|
1
|
+
import { parseColour, mixHex, ridge, hash, bayer, clamp, grad, createGrid, writeCell, noise1, smooth } from "./pixel-scene-core.js";
|
|
2
|
+
const PIXEL_SCENES = ["alpine", "meadow", "sea", "mountains"];
|
|
3
|
+
const G_STAR = 3.5;
|
|
4
|
+
const G_MOON = 3.5;
|
|
5
|
+
const G_SUN = 4.9;
|
|
6
|
+
const G_LAMP = 4.6;
|
|
7
|
+
const G_LAMP_FLICKER = 0.3;
|
|
8
|
+
const G_SNOWCAP = 1.8;
|
|
9
|
+
const G_FLOWER = 1.8;
|
|
10
|
+
const G_SPARKLE = 2.2;
|
|
11
|
+
const G_DAYLAMP = 1.6;
|
|
12
|
+
const SOFT_CABIN = 1.6;
|
|
13
|
+
const SOFT_CHALET = 1.2;
|
|
14
|
+
const COPY_W = 0.42;
|
|
15
|
+
const COPY_H = 0.52;
|
|
16
|
+
let G = createGrid(0, 0);
|
|
17
|
+
let COLS = 0;
|
|
18
|
+
let ROWS = 0;
|
|
19
|
+
let NIGHT = false;
|
|
20
|
+
const night = () => NIGHT;
|
|
21
|
+
const h = parseColour;
|
|
22
|
+
function put(x, y, c, a = 0, l = false, hl = 0) {
|
|
23
|
+
writeCell(G, x, y, c, a, l, hl);
|
|
24
|
+
}
|
|
25
|
+
function softGlow(x, y, r) {
|
|
26
|
+
x = Math.round(x);
|
|
27
|
+
y = Math.round(y);
|
|
28
|
+
if (x < 0 || y < 0 || x >= COLS || y >= ROWS) return;
|
|
29
|
+
G.soft[y * COLS + x] = r;
|
|
30
|
+
}
|
|
31
|
+
function filled(x, y) {
|
|
32
|
+
x = Math.round(x);
|
|
33
|
+
y = Math.round(y);
|
|
34
|
+
if (x < 0 || y < 0 || x >= COLS || y >= ROWS) return false;
|
|
35
|
+
return G.color[y * COLS + x] >= 0;
|
|
36
|
+
}
|
|
37
|
+
function isLit(x, y) {
|
|
38
|
+
x = Math.round(x);
|
|
39
|
+
y = Math.round(y);
|
|
40
|
+
if (x < 0 || y < 0 || x >= COLS || y >= ROWS) return false;
|
|
41
|
+
return G.lit[y * COLS + x] > 0;
|
|
42
|
+
}
|
|
43
|
+
function disc(cx, cy, r, fn) {
|
|
44
|
+
for (let y = Math.floor(cy - r); y <= Math.ceil(cy + r); y++)
|
|
45
|
+
for (let x = Math.floor(cx - r); x <= Math.ceil(cx + r); x++) {
|
|
46
|
+
const d = Math.hypot(x - cx, y - cy);
|
|
47
|
+
if (d <= r + 1e-3) fn(x, y, d);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function sprite(rows, map, ox, oy, a = 0.9, flip = false) {
|
|
51
|
+
for (let j = 0; j < rows.length; j++) {
|
|
52
|
+
const row = rows[j];
|
|
53
|
+
for (let i = 0; i < row.length; i++) {
|
|
54
|
+
const ch = row[i];
|
|
55
|
+
if (ch === ".") continue;
|
|
56
|
+
const c = map[ch];
|
|
57
|
+
if (c === void 0) continue;
|
|
58
|
+
const x = ox + (flip ? row.length - 1 - i : i);
|
|
59
|
+
if (typeof c === "string" || typeof c === "number") put(x, oy + j, c, a);
|
|
60
|
+
else put(x, oy + j, c[0], c[1], c[2], c[3] ?? 0);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function lamp(t, seed) {
|
|
65
|
+
return G_LAMP + G_LAMP_FLICKER * (0.5 + 0.5 * Math.sin(t * 6e-3 + seed * 2.3));
|
|
66
|
+
}
|
|
67
|
+
const SUN = [h("#f7cf4a"), h("#f6a24e"), h("#ef7a5e"), h("#ea7d9c")];
|
|
68
|
+
const SKY = {
|
|
69
|
+
day: [
|
|
70
|
+
[0, h("#79b6f2")],
|
|
71
|
+
[0.55, h("#bcdcf7")],
|
|
72
|
+
[1, h("#f6e6c9")]
|
|
73
|
+
],
|
|
74
|
+
night: [
|
|
75
|
+
[0, h("#17143a")],
|
|
76
|
+
[0.35, h("#3a2a5e")],
|
|
77
|
+
[0.7, h("#8e4a6a")],
|
|
78
|
+
[1, h("#e39a5a")]
|
|
79
|
+
]
|
|
80
|
+
};
|
|
81
|
+
const GROUND = {
|
|
82
|
+
day: [
|
|
83
|
+
[0, h("#8fbf6e")],
|
|
84
|
+
[1, h("#4e7f45")]
|
|
85
|
+
],
|
|
86
|
+
night: [
|
|
87
|
+
[0, h("#28384a")],
|
|
88
|
+
[1, h("#111a26")]
|
|
89
|
+
]
|
|
90
|
+
};
|
|
91
|
+
const WATER = { day: [h("#3f86d8"), h("#9ed0f6")], night: [h("#243a73"), h("#7aa9d8")] };
|
|
92
|
+
const CLOUD = { day: h("#ffffff"), night: h("#c98ea0") };
|
|
93
|
+
const BIRDC = { day: h("#2b2b2b"), night: h("#b89ad8") };
|
|
94
|
+
const STAR = h("#fff3c4");
|
|
95
|
+
const BLACK = 0;
|
|
96
|
+
const WHITE = 16777215;
|
|
97
|
+
const mode = () => NIGHT ? "night" : "day";
|
|
98
|
+
function skyFill(horizon) {
|
|
99
|
+
const stops = SKY[mode()];
|
|
100
|
+
for (let y = 0; y < horizon; y++) {
|
|
101
|
+
const c = grad(stops, y / horizon);
|
|
102
|
+
for (let x = 0; x < COLS; x++) put(x, y, c, 0);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function stars(t, horizon) {
|
|
106
|
+
if (!night()) return;
|
|
107
|
+
for (let y = 0; y < horizon * 0.8; y++)
|
|
108
|
+
for (let x = 0; x < COLS; x++)
|
|
109
|
+
if (hash(x, y, 41) > 0.988 && Math.sin(t * 3e-3 + hash(x, y, 42) * 30) > 0.2)
|
|
110
|
+
put(x, y, STAR, 0.6, G_STAR);
|
|
111
|
+
}
|
|
112
|
+
const MOON_A = h("#f4ead0");
|
|
113
|
+
const MOON_B = h("#c9b89a");
|
|
114
|
+
function sunDisc(sx, sy, R, cut = 1e9) {
|
|
115
|
+
G.sunX = sx + 0.5;
|
|
116
|
+
G.sunY = sy + 0.5;
|
|
117
|
+
disc(sx, sy, R, (x, y) => {
|
|
118
|
+
if (y >= cut) return;
|
|
119
|
+
const band = clamp(Math.floor((y - (sy - R)) / (2 * R) * 4), 0, 3);
|
|
120
|
+
if (night()) put(x, y, mixHex(MOON_A, MOON_B, band / 3), 0.5, G_MOON, 0.6);
|
|
121
|
+
else put(x, y, SUN[band], 0.9, G_SUN, 0.8);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
function clouds(t, list) {
|
|
125
|
+
const c = CLOUD[mode()];
|
|
126
|
+
list.forEach(([ox, cy, w], i) => {
|
|
127
|
+
const cx = (ox * COLS + t * 11e-4 * (1 + i * 0.3)) % (COLS + 2 * w) - w;
|
|
128
|
+
for (let y = -2; y <= 2; y++)
|
|
129
|
+
for (let x = -w; x <= w; x++) {
|
|
130
|
+
const e = x * x / (w * w) + y * y / 4.5;
|
|
131
|
+
if (e < 1 && hash(Math.round(cx) + x, cy + y, 5 + i) > e * 0.8)
|
|
132
|
+
put(cx + x, cy + y, c, 0.22);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function bird(x, y, phase, alpha = 0.8) {
|
|
137
|
+
const c = BIRDC[mode()];
|
|
138
|
+
const f = Math.sin(phase);
|
|
139
|
+
const wing = f > 0.4 ? -1 : f < -0.4 ? 1 : 0;
|
|
140
|
+
put(x, y, c, alpha);
|
|
141
|
+
put(x - 1, y + wing, c, alpha);
|
|
142
|
+
put(x + 1, y + wing, c, alpha);
|
|
143
|
+
put(x - 2, y + wing * 2 || y, c, alpha * 0.8);
|
|
144
|
+
put(x + 2, y + wing * 2 || y, c, alpha * 0.8);
|
|
145
|
+
}
|
|
146
|
+
function flock(t, n, baseY, speed = 9e-3) {
|
|
147
|
+
for (let i = 0; i < n; i++) {
|
|
148
|
+
const lead = (t * speed + 40) % (COLS + 60) - 30;
|
|
149
|
+
bird(
|
|
150
|
+
lead - i * 5 - i % 2 * 2,
|
|
151
|
+
baseY + Math.abs(i - (n - 1) / 2) * 1.8 + Math.sin(t * 25e-4 + i * 0.8) * 1.2,
|
|
152
|
+
t * 0.011 + i * 0.9
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
const LANTERN = h("#ffd15c");
|
|
157
|
+
const PERSON_MAP = (t) => ({
|
|
158
|
+
k: "#2a1c1c",
|
|
159
|
+
s: "#f3cba6",
|
|
160
|
+
r: "#e0433f",
|
|
161
|
+
b: "#2f4b94",
|
|
162
|
+
n: "#6b4a2b",
|
|
163
|
+
w: "#f6f6f6",
|
|
164
|
+
y: [LANTERN, 0.9, lamp(t, 1), 1.6],
|
|
165
|
+
d: "#a3673a",
|
|
166
|
+
D: "#6f4322",
|
|
167
|
+
t: "#e9a0a0"
|
|
168
|
+
});
|
|
169
|
+
const PERSON = [
|
|
170
|
+
[
|
|
171
|
+
".kkk.",
|
|
172
|
+
".kkk.",
|
|
173
|
+
".sss.",
|
|
174
|
+
"..s..",
|
|
175
|
+
".rrr.",
|
|
176
|
+
"rrrrr",
|
|
177
|
+
"r.r.y",
|
|
178
|
+
".bbb.",
|
|
179
|
+
".b.b.",
|
|
180
|
+
".b.b.",
|
|
181
|
+
".n.n."
|
|
182
|
+
],
|
|
183
|
+
[
|
|
184
|
+
".kkk.",
|
|
185
|
+
".kkk.",
|
|
186
|
+
".sss.",
|
|
187
|
+
"..s..",
|
|
188
|
+
".rrr.",
|
|
189
|
+
"rrrrr",
|
|
190
|
+
"r.r.y",
|
|
191
|
+
".bbb.",
|
|
192
|
+
".b.b.",
|
|
193
|
+
"b...b",
|
|
194
|
+
"n...n"
|
|
195
|
+
]
|
|
196
|
+
];
|
|
197
|
+
const DOG = [
|
|
198
|
+
["......dd", "..ddddd.", ".dddddd.", "dd.d..d.", "d..d..d."],
|
|
199
|
+
[".....dd.", "..ddddd.", ".dddddd.", "d..d..d.", "d..dd.d."]
|
|
200
|
+
];
|
|
201
|
+
const BOAT = [
|
|
202
|
+
"....w....",
|
|
203
|
+
"...ww....",
|
|
204
|
+
"..www....",
|
|
205
|
+
".wwww....",
|
|
206
|
+
"wwwww....",
|
|
207
|
+
"....n....",
|
|
208
|
+
"nnnnnnnnn",
|
|
209
|
+
".nnnnnnn."
|
|
210
|
+
];
|
|
211
|
+
const CABIN = ["...n...", "..nnn..", ".nnnnn.", "nnnnnnn", ".DyDDD.", ".DyDDD.", ".DDDDD."];
|
|
212
|
+
const ALP = {
|
|
213
|
+
day: {
|
|
214
|
+
sky: [
|
|
215
|
+
[0, h("#4f93e6")],
|
|
216
|
+
[0.7, h("#86b8ef")],
|
|
217
|
+
[1, h("#a9cdf3")]
|
|
218
|
+
],
|
|
219
|
+
cirrus: h("#ffffff"),
|
|
220
|
+
rockLit: h("#6b7383"),
|
|
221
|
+
rockShade: h("#454a58"),
|
|
222
|
+
snow: h("#f3f6fb"),
|
|
223
|
+
snowShade: h("#c6d4ea"),
|
|
224
|
+
piste: h("#eef3f9"),
|
|
225
|
+
fold: h("#d6e2f1"),
|
|
226
|
+
track: h("#bccde6"),
|
|
227
|
+
shrub: h("#5b5a3e"),
|
|
228
|
+
conifer: [h("#2f5a3a"), h("#1f3f2a")],
|
|
229
|
+
autumn: [h("#d9712a"), h("#b5402a"), h("#e0a33a"), h("#8a9340")],
|
|
230
|
+
trunk: h("#6e665e"),
|
|
231
|
+
roof: h("#f6f8fc"),
|
|
232
|
+
roofShade: h("#cfdbee"),
|
|
233
|
+
eave: h("#2e2622"),
|
|
234
|
+
wall: h("#7a4a2a"),
|
|
235
|
+
wallD: h("#5a3520"),
|
|
236
|
+
win: h("#2b2420"),
|
|
237
|
+
lamp: h("#ffd15c"),
|
|
238
|
+
road: h("#8a8d93"),
|
|
239
|
+
stone: h("#a9a59c"),
|
|
240
|
+
pylon: h("#3a3d44"),
|
|
241
|
+
cable: h("#565a63"),
|
|
242
|
+
forest: [h("#2a4a33"), h("#1f3a28"), h("#8f9a3a"), h("#c9a53a")],
|
|
243
|
+
glint: h("#ffffff"),
|
|
244
|
+
groomer: h("#c0392b"),
|
|
245
|
+
moon: h("#fff4d2"),
|
|
246
|
+
moonRim: h("#d6ccb0"),
|
|
247
|
+
star: h("#fff3c4"),
|
|
248
|
+
hawk: h("#3a2e28"),
|
|
249
|
+
smoke: h("#a3adbd"),
|
|
250
|
+
cabin: [h("#c8402e"), h("#e0a33a")],
|
|
251
|
+
cabinLamp: h("#ffcf7a"),
|
|
252
|
+
beam: h("#e9eeff"),
|
|
253
|
+
beacon: h("#ffa040"),
|
|
254
|
+
tracks: h("#14161f")
|
|
255
|
+
},
|
|
256
|
+
night: {
|
|
257
|
+
sky: [
|
|
258
|
+
[0, h("#090b26")],
|
|
259
|
+
[0.55, h("#151b4a")],
|
|
260
|
+
[1, h("#2c3772")]
|
|
261
|
+
],
|
|
262
|
+
cirrus: h("#58629a"),
|
|
263
|
+
rockLit: h("#3c4668"),
|
|
264
|
+
rockShade: h("#20263f"),
|
|
265
|
+
snow: h("#cad6f2"),
|
|
266
|
+
snowShade: h("#7484b4"),
|
|
267
|
+
piste: h("#9eacd4"),
|
|
268
|
+
fold: h("#7c8bbb"),
|
|
269
|
+
track: h("#66759f"),
|
|
270
|
+
shrub: h("#1c2030"),
|
|
271
|
+
conifer: [h("#17301f"), h("#0d1f15")],
|
|
272
|
+
autumn: [h("#6e4a3a"), h("#5a3236"), h("#7a6844"), h("#4a5238")],
|
|
273
|
+
trunk: h("#3a3a48"),
|
|
274
|
+
roof: h("#c6d3f1"),
|
|
275
|
+
roofShade: h("#8f9fcc"),
|
|
276
|
+
eave: h("#120f16"),
|
|
277
|
+
wall: h("#3b2a24"),
|
|
278
|
+
wallD: h("#291d19"),
|
|
279
|
+
win: h("#17121a"),
|
|
280
|
+
lamp: h("#ffc650"),
|
|
281
|
+
road: h("#3a3f52"),
|
|
282
|
+
stone: h("#4b5068"),
|
|
283
|
+
pylon: h("#090b14"),
|
|
284
|
+
cable: h("#2a2f45"),
|
|
285
|
+
forest: [h("#0f2018"), h("#0a1711"), h("#2e3a24"), h("#4a4428")],
|
|
286
|
+
glint: h("#e6eeff"),
|
|
287
|
+
groomer: h("#3a2a2a"),
|
|
288
|
+
moon: h("#f1ecd8"),
|
|
289
|
+
moonRim: h("#d6ccb0"),
|
|
290
|
+
star: h("#fff3c4"),
|
|
291
|
+
hawk: h("#b89ad8"),
|
|
292
|
+
smoke: h("#6f78a0"),
|
|
293
|
+
cabin: [h("#4a2a2a"), h("#5a4a2a")],
|
|
294
|
+
cabinLamp: h("#ffcf7a"),
|
|
295
|
+
beam: h("#e9eeff"),
|
|
296
|
+
beacon: h("#ffa040"),
|
|
297
|
+
tracks: h("#14161f")
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
const ALP_DARK = /* @__PURE__ */ new Map();
|
|
301
|
+
function darker(c) {
|
|
302
|
+
let v = ALP_DARK.get(c);
|
|
303
|
+
if (v === void 0) {
|
|
304
|
+
v = mixHex(c, BLACK, 0.28);
|
|
305
|
+
ALP_DARK.set(c, v);
|
|
306
|
+
}
|
|
307
|
+
return v;
|
|
308
|
+
}
|
|
309
|
+
let ALP_TERRAIN = {
|
|
310
|
+
key: "",
|
|
311
|
+
crest: new Float32Array(0),
|
|
312
|
+
rockBase: new Float32Array(0),
|
|
313
|
+
forestTop: new Float32Array(0)
|
|
314
|
+
};
|
|
315
|
+
function alpineTerrain(C, R) {
|
|
316
|
+
const key = C + "x" + R;
|
|
317
|
+
if (ALP_TERRAIN.key === key) return ALP_TERRAIN;
|
|
318
|
+
const crest = new Float32Array(C);
|
|
319
|
+
const rockBase = new Float32Array(C);
|
|
320
|
+
const forestTop = new Float32Array(C);
|
|
321
|
+
for (let x = 0; x < C; x++) {
|
|
322
|
+
const u = x / C;
|
|
323
|
+
const base = R * (0.52 - 0.33 * smooth((u - 0.16) / 0.5) + 0.1 * smooth((u - 0.74) / 0.26));
|
|
324
|
+
const peaks = R * 0.07 * Math.max(0, 1 - Math.abs(u - 0.64) / 0.05) + R * 0.05 * Math.max(0, 1 - Math.abs(u - 0.5) / 0.04) + R * 0.04 * Math.max(0, 1 - Math.abs(u - 0.82) / 0.035);
|
|
325
|
+
const cr = base - peaks + (ridge(x, 71, 8, R * 0.06) - R * 0.04) + (noise1(x / 1.6, 73) - 0.5) * R * 0.035;
|
|
326
|
+
crest[x] = cr;
|
|
327
|
+
rockBase[x] = Math.max(cr + 3, Math.min(R * 0.56, cr + R * (0.17 + noise1(x / 6, 78) * 0.1))) + (noise1(x / 7, 77) - 0.5) * R * 0.06;
|
|
328
|
+
forestTop[x] = R * (0.92 - 0.015 * (1 - smooth(u / 0.32)) - 0.15 * smooth((u - 0.86) / 0.14)) - noise1(x / 4, 51) * R * 0.04;
|
|
329
|
+
}
|
|
330
|
+
ALP_TERRAIN = { key, crest, rockBase, forestTop };
|
|
331
|
+
return ALP_TERRAIN;
|
|
332
|
+
}
|
|
333
|
+
let ALP_SKY = { key: "", rows: new Int32Array(0) };
|
|
334
|
+
const tri = (v) => {
|
|
335
|
+
const f = v - Math.floor(v);
|
|
336
|
+
return 1 - Math.abs(f * 2 - 1);
|
|
337
|
+
};
|
|
338
|
+
const CIRRUS = [
|
|
339
|
+
[0.08, 0.1, 30],
|
|
340
|
+
[0.34, 0.2, 22],
|
|
341
|
+
[0.55, 0.06, 34],
|
|
342
|
+
[0.78, 0.16, 26],
|
|
343
|
+
[0.96, 0.27, 18]
|
|
344
|
+
];
|
|
345
|
+
const BELTS = [
|
|
346
|
+
[0.2, 0.7, 0.08, 0.11, 0.95],
|
|
347
|
+
[0.72, 0.62, 0.12, 0.07, 0.95],
|
|
348
|
+
[0.43, 0.65, 0.04, 0.04, 0.75],
|
|
349
|
+
[0.92, 0.63, 0.05, 0.05, 0.7],
|
|
350
|
+
[0.56, 0.6, 0.05, 0.035, 0.65],
|
|
351
|
+
[0.33, 0.78, 0.05, 0.04, 0.6]
|
|
352
|
+
];
|
|
353
|
+
const VILLAGE_ROWS = [
|
|
354
|
+
[0.745, 0.585, 0.85],
|
|
355
|
+
[0.805, 0.57, 0.86],
|
|
356
|
+
[0.865, 0.6, 0.84]
|
|
357
|
+
];
|
|
358
|
+
const HAWK_SHAPE = [
|
|
359
|
+
[-3, -1, 2],
|
|
360
|
+
[-2, -1, 1],
|
|
361
|
+
[-1, 0, 0],
|
|
362
|
+
[0, 0, 0],
|
|
363
|
+
[1, 0, 0],
|
|
364
|
+
[2, -1, 1],
|
|
365
|
+
[3, -1, 2]
|
|
366
|
+
];
|
|
367
|
+
function alpine(t) {
|
|
368
|
+
const N = night();
|
|
369
|
+
const P = ALP[N ? "night" : "day"];
|
|
370
|
+
const C = COLS;
|
|
371
|
+
const R = ROWS;
|
|
372
|
+
const copyW = C * COPY_W;
|
|
373
|
+
const copyH = R * COPY_H;
|
|
374
|
+
const inCopy = (x, y) => x < copyW && y < copyH;
|
|
375
|
+
const { crest, rockBase, forestTop } = alpineTerrain(C, R);
|
|
376
|
+
const rockAt = (x) => rockBase[clamp(Math.round(x), 0, C - 1)];
|
|
377
|
+
const skyH = Math.max(1, Math.floor(R * 0.58));
|
|
378
|
+
const key = (N ? "n" : "d") + R;
|
|
379
|
+
if (ALP_SKY.key !== key) {
|
|
380
|
+
const rows = new Int32Array(R);
|
|
381
|
+
for (let y = 0; y < R; y++) rows[y] = grad(P.sky, y / skyH);
|
|
382
|
+
ALP_SKY = { key, rows };
|
|
383
|
+
}
|
|
384
|
+
for (let y = 0; y < R; y++) {
|
|
385
|
+
const c = ALP_SKY.rows[y];
|
|
386
|
+
for (let x = 0; x < C; x++) if (y < crest[x] + 1) put(x, y, c, 0);
|
|
387
|
+
}
|
|
388
|
+
if (N) {
|
|
389
|
+
for (let y = 0; y < skyH; y++)
|
|
390
|
+
for (let x = 0; x < C; x++) {
|
|
391
|
+
if (y >= crest[x] - 1) continue;
|
|
392
|
+
if (hash(x, y, 41) < (inCopy(x, y) ? 0.995 : 0.986)) continue;
|
|
393
|
+
if (Math.sin(t * 3e-3 + hash(x, y, 42) * 30) > 0.15) put(x, y, P.star, 0.55, G_STAR);
|
|
394
|
+
}
|
|
395
|
+
const mx = Math.floor(C * 0.9);
|
|
396
|
+
const my = Math.max(4, Math.floor(R * 0.13));
|
|
397
|
+
const mr = 3.2;
|
|
398
|
+
G.sunX = mx + 0.5;
|
|
399
|
+
G.sunY = my + 0.5;
|
|
400
|
+
disc(mx, my, mr, (x, y, dd) => {
|
|
401
|
+
if (x - mx > mr * 0.25 && dd > mr * 0.55) return;
|
|
402
|
+
put(x, y, dd > mr * 0.7 ? P.moonRim : P.moon, 0.6, G_MOON, 0.6);
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
CIRRUS.forEach(([ox, oy, len], k) => {
|
|
406
|
+
const span = C + 2 * len;
|
|
407
|
+
const x0 = (ox * span + t * 5e-4 * (1 + k * 0.15)) % span - len;
|
|
408
|
+
const y0 = R * oy;
|
|
409
|
+
for (let i = 0; i < len; i++) {
|
|
410
|
+
const x = Math.round(x0 + i);
|
|
411
|
+
const y = Math.round(y0 - i * 0.22 + Math.sin(i * 0.25 + k) * 0.6);
|
|
412
|
+
if (x < 0 || x >= C || y < 0 || y >= crest[x] - 1) continue;
|
|
413
|
+
const edge = Math.min(i, len - 1 - i) / (len * 0.5);
|
|
414
|
+
if (hash(i, k, 520) > edge * 1.4) continue;
|
|
415
|
+
put(x, y, P.cirrus, hash(x, y, 521) > 0.45 ? N ? 0.12 : 0.2 : 0);
|
|
416
|
+
if (edge > 0.5 && hash(i, k, 522) > 0.6 && x + 1 < C && y - 1 < crest[x + 1] - 1)
|
|
417
|
+
put(x + 1, y - 1, P.cirrus, 0);
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
for (let x = 0; x < C; x++) {
|
|
421
|
+
const top = crest[x];
|
|
422
|
+
const bottom = rockBase[x];
|
|
423
|
+
const band = bottom - top;
|
|
424
|
+
for (let y = Math.max(0, Math.floor(top)); y < bottom && y < R; y++) {
|
|
425
|
+
const fromTop = y - top;
|
|
426
|
+
const depth = fromTop / band;
|
|
427
|
+
const face = noise1((x - y * 0.6) / 5, 95) > 0.42;
|
|
428
|
+
const stripe = noise1((x + y * 1.4) / 2.6, 91);
|
|
429
|
+
const couloir = noise1(x / 1.7, 93);
|
|
430
|
+
const cap = fromTop < 2 && bayer(x, y) < 0.8 - fromTop * 0.3;
|
|
431
|
+
const snowy = cap || stripe > 0.64 - depth * 0.32 || couloir > 0.8;
|
|
432
|
+
const c = snowy ? face ? P.snow : P.snowShade : face ? P.rockLit : P.rockShade;
|
|
433
|
+
let a = 0;
|
|
434
|
+
if (fromTop < 1) a = 0.8;
|
|
435
|
+
else if (!snowy) a = bayer(x, y) < (face ? 0.2 : 0.42) ? face ? 0.38 : 0.52 : 0;
|
|
436
|
+
else if (!face) a = bayer(x, y) < 0.1 ? 0.22 : 0;
|
|
437
|
+
let l = false;
|
|
438
|
+
if (cap && !inCopy(x, y) && bayer(x, y) < 0.55 - fromTop * 0.25) l = G_SNOWCAP;
|
|
439
|
+
else if (N && snowy && face && hash(x, y, 96) > 0.965) l = true;
|
|
440
|
+
put(x, y, c, a, l);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
for (let x = 0; x < C; x++) {
|
|
444
|
+
const y0 = Math.ceil(rockBase[x]);
|
|
445
|
+
const bend = noise1(x / 14, 61) * 12;
|
|
446
|
+
for (let y = y0; y < R; y++) {
|
|
447
|
+
const fold = noise1((x * 0.6 + y * 2.2 + bend) / 6, 63) > 0.7;
|
|
448
|
+
const c = y - y0 < 2 ? P.snowShade : fold ? P.fold : P.piste;
|
|
449
|
+
let a = 0;
|
|
450
|
+
if (y === y0) a = bayer(x, y) < 0.6 ? 0.4 : 0;
|
|
451
|
+
else if (hash(x, y, 64) > 0.984) a = 0.16;
|
|
452
|
+
put(x, y, c, a);
|
|
453
|
+
if (hash(x, y, 68) > 0.994 && y > y0 + 2) put(x, y, P.shrub, 0.45);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
const trackY = (k, x) => R * (0.63 + k * 0.075) + Math.sin(x * 0.045 + k * 2.1) * R * 0.035;
|
|
457
|
+
for (let k = 0; k < 3; k++)
|
|
458
|
+
for (let x = Math.floor(C * (0.3 + k * 0.05)); x < C * 0.98; x++)
|
|
459
|
+
if (hash(x, k, 65) > 0.22) put(x, trackY(k, x), P.track, 0.2);
|
|
460
|
+
for (let y = 0; y < R; y++)
|
|
461
|
+
for (let x = 0; x < C; x++) {
|
|
462
|
+
if (y <= rockBase[x] + 1 || hash(x, y, 66) < 0.9965) continue;
|
|
463
|
+
if (Math.sin(t * 35e-4 + hash(x, y, 67) * 40) > 0.9) put(x, y, P.glint, 0.2, G_SPARKLE);
|
|
464
|
+
}
|
|
465
|
+
const L0x = C * 0.05;
|
|
466
|
+
const L0y = R * 0.87;
|
|
467
|
+
const L1x = C * 0.33;
|
|
468
|
+
const L1y = R * 0.58;
|
|
469
|
+
const inCorridor = (x, y) => {
|
|
470
|
+
const f = (x - L0x) / (L1x - L0x);
|
|
471
|
+
if (f < -0.04 || f > 1.04) return false;
|
|
472
|
+
const dy = y - (L0y + (L1y - L0y) * clamp(f, 0, 1));
|
|
473
|
+
return dy > -11 && dy < 4;
|
|
474
|
+
};
|
|
475
|
+
const conifer = (x, by, hgt, side) => {
|
|
476
|
+
for (let k = 0; k < hgt; k++) {
|
|
477
|
+
const half = Math.floor(k * 0.45);
|
|
478
|
+
for (let dx = -half; dx <= half; dx++)
|
|
479
|
+
put(
|
|
480
|
+
x + dx,
|
|
481
|
+
by - hgt + k,
|
|
482
|
+
dx * side > 0 ? P.conifer[0] : P.conifer[1],
|
|
483
|
+
k === 0 || Math.abs(dx) === half ? 0.8 : 0.6
|
|
484
|
+
);
|
|
485
|
+
}
|
|
486
|
+
put(x, by, P.trunk, 0.55);
|
|
487
|
+
};
|
|
488
|
+
const canopy = (x, by, r, col, seed) => {
|
|
489
|
+
const cy = by - r - 1;
|
|
490
|
+
disc(x, cy, r, (px, py, dd) => {
|
|
491
|
+
if (hash(px, py, seed) > dd / r * 0.55 + 0.05)
|
|
492
|
+
put(px, py, px < x && py > cy - 0.5 ? darker(col) : col, dd > r - 1 ? 0.75 : 0.55);
|
|
493
|
+
});
|
|
494
|
+
put(x, by, P.trunk, 0.6);
|
|
495
|
+
put(x, by - 1, P.trunk, 0.6);
|
|
496
|
+
};
|
|
497
|
+
for (let gy = 0; gy < R; gy += 3)
|
|
498
|
+
for (let gx = 0; gx < C; gx += 3) {
|
|
499
|
+
const x = gx + Math.floor(hash(gx, gy, 101) * 3);
|
|
500
|
+
const y = gy + Math.floor(hash(gx, gy, 102) * 3);
|
|
501
|
+
if (y < rockAt(Math.min(C - 1, x)) + 4 || y > R * 0.86) continue;
|
|
502
|
+
if (inCorridor(x, y)) continue;
|
|
503
|
+
const u = x / C;
|
|
504
|
+
const v = y / R;
|
|
505
|
+
let p = 0.015;
|
|
506
|
+
for (const [bu, bv, ru, rv, w] of BELTS) {
|
|
507
|
+
const e = ((u - bu) / ru) ** 2 + ((v - bv) / rv) ** 2;
|
|
508
|
+
if (e < 1) p = Math.max(p, w * 0.8 * (1 - e * 0.8));
|
|
509
|
+
}
|
|
510
|
+
if (hash(x, y, 103) > p) continue;
|
|
511
|
+
const kind = hash(x, y, 104);
|
|
512
|
+
if (kind < 0.45) conifer(x, y, 4 + Math.floor(hash(x, y, 105) * 4), 1);
|
|
513
|
+
else if (kind < 0.94)
|
|
514
|
+
canopy(x, y, 1.5 + hash(x, y, 106) * 1.5, P.autumn[Math.floor(hash(x, y, 107) * 4)], 108);
|
|
515
|
+
else
|
|
516
|
+
for (let k = 0; k < 4; k++) {
|
|
517
|
+
put(x, y - k, P.trunk, 0.5);
|
|
518
|
+
if (k === 2) {
|
|
519
|
+
put(x - 1, y - 3, P.trunk, 0.4);
|
|
520
|
+
put(x + 1, y - 3, P.trunk, 0.4);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
const tops = [];
|
|
525
|
+
for (let k = 0; k <= 5; k++) {
|
|
526
|
+
const s = k / 5;
|
|
527
|
+
const px = Math.round(L0x + (L1x - L0x) * s);
|
|
528
|
+
const gy = Math.round(L0y + (L1y - L0y) * s);
|
|
529
|
+
const hgt = 6 + Math.floor(hash(k, 0, 111) * 4);
|
|
530
|
+
for (let j = 0; j < hgt; j++) put(px, gy - j, P.pylon, 0.75);
|
|
531
|
+
put(px - 1, gy - hgt, P.pylon, 0.75);
|
|
532
|
+
put(px + 1, gy - hgt, P.pylon, 0.75);
|
|
533
|
+
tops.push([px, gy - hgt]);
|
|
534
|
+
}
|
|
535
|
+
const first = tops[0];
|
|
536
|
+
const lastTop = tops[tops.length - 1];
|
|
537
|
+
const cableAt = (x) => {
|
|
538
|
+
for (let k = 0; k < tops.length - 1; k++) {
|
|
539
|
+
const [ax, ay] = tops[k];
|
|
540
|
+
const [bx, by] = tops[k + 1];
|
|
541
|
+
if (x >= ax && x <= bx) {
|
|
542
|
+
const f = (x - ax) / (bx - ax || 1);
|
|
543
|
+
return ay + (by - ay) * f + Math.sin(Math.PI * f) * 1.2;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
return null;
|
|
547
|
+
};
|
|
548
|
+
for (let x = first[0]; x <= lastTop[0]; x++) {
|
|
549
|
+
const cy = cableAt(x);
|
|
550
|
+
if (cy === null) continue;
|
|
551
|
+
put(x - 1, cy, P.cable, 0.35);
|
|
552
|
+
put(x + 1, cy, P.cable, 0.35);
|
|
553
|
+
}
|
|
554
|
+
for (let k = 0; k < 5; k++)
|
|
555
|
+
for (const dir of [1, -1]) {
|
|
556
|
+
const ph = (t / 11e4 + k / 5 + (dir < 0 ? 0.1 : 0)) % 1;
|
|
557
|
+
const s = dir > 0 ? ph : 1 - ph;
|
|
558
|
+
if (s < 0.03 || s > 0.97) continue;
|
|
559
|
+
const off = dir > 0 ? 1 : -1;
|
|
560
|
+
const cxm = Math.round(first[0] + (lastTop[0] - first[0]) * s);
|
|
561
|
+
const cy = cableAt(cxm);
|
|
562
|
+
if (cy === null) continue;
|
|
563
|
+
const x = cxm + off;
|
|
564
|
+
const y = Math.round(cy);
|
|
565
|
+
const col = P.cabin[k % 2];
|
|
566
|
+
put(x, y + 1, P.cable, 0.5);
|
|
567
|
+
put(x, y + 2, col, 0.85);
|
|
568
|
+
put(x + 1, y + 2, col, 0.85);
|
|
569
|
+
put(x, y + 3, col, 0.85);
|
|
570
|
+
put(x + 1, y + 3, col, 0.85);
|
|
571
|
+
if (N)
|
|
572
|
+
put(x + (dir > 0 ? 1 : 0), y + 2, P.cabinLamp, 0.9, lamp(t, k * 2 + (dir > 0 ? 0 : 1)));
|
|
573
|
+
}
|
|
574
|
+
const winLit = N ? 0.4 : 0.12;
|
|
575
|
+
const smokers = [];
|
|
576
|
+
const chalet = (x, by, w, storeys, seed, row) => {
|
|
577
|
+
const rh = w + 1 >> 1;
|
|
578
|
+
const wallH = storeys * 2;
|
|
579
|
+
const roofY = by - wallH - rh;
|
|
580
|
+
for (let r = 0; r < rh; r++) {
|
|
581
|
+
const a = rh - 1 - r;
|
|
582
|
+
for (let dx = a; dx <= w - 1 - a; dx++) {
|
|
583
|
+
const edge = dx === a || dx === w - 1 - a;
|
|
584
|
+
put(
|
|
585
|
+
x + dx,
|
|
586
|
+
roofY + r,
|
|
587
|
+
dx < w / 2 - 0.5 ? P.roofShade : P.roof,
|
|
588
|
+
edge ? 0.8 : 0,
|
|
589
|
+
edge && N && bayer(x + dx, roofY + r) < 0.5
|
|
590
|
+
);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
for (let dx = -1; dx <= w; dx++) put(x + dx, by - wallH, P.eave, 0.85);
|
|
594
|
+
for (let j = 1; j < wallH; j++)
|
|
595
|
+
for (let dx = 0; dx < w; dx++) {
|
|
596
|
+
const wx = x + dx;
|
|
597
|
+
const wy = by - wallH + j;
|
|
598
|
+
const isWin = dx % 2 === 1 && dx < w - 1 && j % 2 === 1;
|
|
599
|
+
if (isWin) {
|
|
600
|
+
const hw = hash(wx, wy, seed);
|
|
601
|
+
const breathe = hash(wx, wy, seed + 2) > 0.9 ? Math.sin(t * 31e-5 + hw * 50) > 0 : true;
|
|
602
|
+
if (breathe && hw < winLit) {
|
|
603
|
+
if (N) {
|
|
604
|
+
put(wx, wy, P.lamp, 0.9, lamp(t, wx + wy * 7), 0.9);
|
|
605
|
+
softGlow(wx, wy, SOFT_CHALET);
|
|
606
|
+
} else put(wx, wy, P.lamp, 0.9, G_DAYLAMP);
|
|
607
|
+
} else put(wx, wy, P.win, 0.6);
|
|
608
|
+
} else if (storeys > 1 && j % 2 === 0)
|
|
609
|
+
put(wx, wy, P.eave, 0.7);
|
|
610
|
+
else put(wx, wy, dx % 2 ? P.wallD : P.wall, bayer(wx, wy) < 0.3 ? 0.5 : 0);
|
|
611
|
+
}
|
|
612
|
+
for (let dx = 0; dx < w; dx++) put(x + dx, by, P.wallD, 0.6);
|
|
613
|
+
if (row >= 0 && w >= 5 && smokers.length < 6 && hash(x, row, 904) > 0.62)
|
|
614
|
+
smokers.push([x + w - 3, roofY + Math.max(0, rh - 3) - 1]);
|
|
615
|
+
};
|
|
616
|
+
chalet(Math.floor(C * 0.5), Math.floor(R * 0.8), 15, 3, 120, -1);
|
|
617
|
+
VILLAGE_ROWS.forEach(([v, u0, u1], row) => {
|
|
618
|
+
for (let x = Math.floor(C * u0) + row * 3; x < C * u1; ) {
|
|
619
|
+
const w = [5, 7, 7, 9][Math.floor(hash(x, row, 121) * 4)];
|
|
620
|
+
if (hash(x, row, 122) > 0.12)
|
|
621
|
+
chalet(x, Math.floor(R * v) + Math.floor(hash(x, row, 123) * 2), w, 1, 124 + row, row);
|
|
622
|
+
x += w + 2 + Math.floor(hash(x, row, 125) * 3);
|
|
623
|
+
}
|
|
624
|
+
});
|
|
625
|
+
smokers.forEach(([sx, sy], k) => {
|
|
626
|
+
put(sx, sy, P.eave, 0.9);
|
|
627
|
+
put(sx, sy - 1, P.eave, 0.9);
|
|
628
|
+
for (let i = 0; i < 6; i++) {
|
|
629
|
+
const life = (t * 25e-5 + i / 6 + k * 0.29) % 1;
|
|
630
|
+
put(
|
|
631
|
+
sx + life * 5 + Math.sin(life * 6 + i + k) * 0.8,
|
|
632
|
+
sy - 2 - life * 9,
|
|
633
|
+
P.smoke,
|
|
634
|
+
(N ? 0.3 : 0.42) * (1 - life)
|
|
635
|
+
);
|
|
636
|
+
}
|
|
637
|
+
});
|
|
638
|
+
for (let i = 0; i <= 100; i++) {
|
|
639
|
+
const s = i / 100;
|
|
640
|
+
const x = C * 0.4 + C * 0.12 * s * s + C * 0.02 * s;
|
|
641
|
+
const y = R - R * 0.12 * s - R * 0.02;
|
|
642
|
+
put(x, y, P.road, 0.3);
|
|
643
|
+
put(x + 1, y, P.road, 0.3);
|
|
644
|
+
if (i % 2 === 0) put(x - 1, y, P.stone, 0.5);
|
|
645
|
+
}
|
|
646
|
+
for (let x = 0; x < C; x++) {
|
|
647
|
+
const top = Math.round(forestTop[x]);
|
|
648
|
+
for (let y = top; y < R; y++) {
|
|
649
|
+
if (inCorridor(x, y)) continue;
|
|
650
|
+
const hv = hash(x, y, 131);
|
|
651
|
+
const c = hv < 0.18 ? P.forest[2] : hv < 0.27 ? P.forest[3] : y - top > 2 ? P.forest[1] : P.forest[0];
|
|
652
|
+
put(x, y, c, y === top ? 0.8 : bayer(x, y) < 0.3 ? 0.45 : 0);
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
for (let x = 1; x < C; x += 3 + Math.floor(hash(x, 0, 132) * 2)) {
|
|
656
|
+
const hgt = 3 + Math.floor(hash(x, 1, 133) * 5);
|
|
657
|
+
const by = Math.round(forestTop[x]);
|
|
658
|
+
if (inCorridor(x, by) || inCorridor(x, by - hgt)) continue;
|
|
659
|
+
const larch = hash(x, 2, 134) < 0.25;
|
|
660
|
+
for (let k = 0; k < hgt; k++) {
|
|
661
|
+
const half = Math.floor(k * 0.4);
|
|
662
|
+
for (let dx = -half; dx <= half; dx++)
|
|
663
|
+
put(
|
|
664
|
+
x + dx,
|
|
665
|
+
by - hgt + k,
|
|
666
|
+
larch ? P.forest[2] : dx > 0 ? P.forest[0] : P.forest[1],
|
|
667
|
+
k === 0 || Math.abs(dx) === half ? 0.8 : 0.6
|
|
668
|
+
);
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
if (!N) {
|
|
672
|
+
const a = t * 22e-5;
|
|
673
|
+
const hx = C * 0.62 + Math.cos(a) * 22;
|
|
674
|
+
const hy = R * 0.24 + Math.sin(a) * 4;
|
|
675
|
+
const flap = t % 9e3 < 1400 ? Math.sin(t * 0.012) : 0;
|
|
676
|
+
const wy = flap > 0.3 ? -1 : flap < -0.3 ? 1 : 0;
|
|
677
|
+
for (const [dx, dy, wk] of HAWK_SHAPE) put(hx + dx, hy + dy + wy * wk, P.hawk, 0.8);
|
|
678
|
+
put(hx - Math.sign(-Math.sin(a)), hy + 1, P.hawk, 0.6);
|
|
679
|
+
} else {
|
|
680
|
+
const ph = tri(t * 2e-5);
|
|
681
|
+
const dir = t * 2e-5 % 1 < 0.5 ? 1 : -1;
|
|
682
|
+
const gx = Math.round(C * 0.45 + ph * C * 0.17);
|
|
683
|
+
const gy = Math.round(Math.max(rockAt(gx) + 3, R * 0.55) + Math.sin(gx * 0.08));
|
|
684
|
+
for (let d = 3; d < 34; d++) {
|
|
685
|
+
const x = gx - dir * d;
|
|
686
|
+
if (hash(x, gy, 950) > 0.15) put(x, gy + 1, (x + gy) % 2 ? P.fold : P.track, 0);
|
|
687
|
+
}
|
|
688
|
+
for (let i = -2; i <= 1; i++) {
|
|
689
|
+
put(gx + i * dir, gy, P.groomer, 0.9);
|
|
690
|
+
put(gx + i * dir, gy + 1, P.tracks, 0.9);
|
|
691
|
+
}
|
|
692
|
+
put(gx - dir, gy - 1, P.groomer, 0.9);
|
|
693
|
+
put(gx - 2 * dir, gy - 1, P.groomer, 0.9);
|
|
694
|
+
if (t % 1600 < 500) put(gx - dir, gy - 2, P.beacon, 0.9, G_STAR, 0.6);
|
|
695
|
+
put(gx + 2 * dir, gy, h("#fff4cf"), 0.9, lamp(t, 9), 1.6);
|
|
696
|
+
for (let d = 2; d < 13; d++) {
|
|
697
|
+
const w = Math.floor(d * 0.35);
|
|
698
|
+
const fall = 1 - d / 13;
|
|
699
|
+
for (let j = -w; j <= w + 1; j++) {
|
|
700
|
+
const x = gx + (2 + d) * dir;
|
|
701
|
+
const y = gy + j;
|
|
702
|
+
if (bayer(x, y) < fall * 0.7) put(x, y, P.beam, 0, 1.6 + 1 * fall);
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
const ink = G.inkA;
|
|
707
|
+
for (let y = 0; y < R && y < copyH; y++)
|
|
708
|
+
for (let x = 0; x < C && x < copyW; x++) {
|
|
709
|
+
const i = y * C + x;
|
|
710
|
+
ink[i] = ink[i] * 0.45;
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
const MEADOW = {
|
|
714
|
+
day: { hill1: h("#8cc27a"), hill2: h("#78b568"), grass: h("#7fc45a"), lanternGlow: h("#f3d9a0") },
|
|
715
|
+
night: {
|
|
716
|
+
hill1: h("#2f3f63"),
|
|
717
|
+
hill2: h("#273553"),
|
|
718
|
+
grass: h("#4f7a63"),
|
|
719
|
+
lanternGlow: h("#8a6a3a")
|
|
720
|
+
}
|
|
721
|
+
};
|
|
722
|
+
const TRUNK_A = h("#5a3a22");
|
|
723
|
+
const TRUNK_B = h("#6b4a2b");
|
|
724
|
+
const FIREFLY = h("#e7f28a");
|
|
725
|
+
function meadow(t) {
|
|
726
|
+
const horizon = Math.floor(ROWS * 0.7);
|
|
727
|
+
const m = mode();
|
|
728
|
+
const M = MEADOW[m];
|
|
729
|
+
skyFill(horizon);
|
|
730
|
+
stars(t, horizon);
|
|
731
|
+
sunDisc(COLS - 30, 13, 8);
|
|
732
|
+
clouds(t, [
|
|
733
|
+
[0.15, 7, 10],
|
|
734
|
+
[0.55, 11, 7],
|
|
735
|
+
[0.82, 5, 12]
|
|
736
|
+
]);
|
|
737
|
+
for (let x = 0; x < COLS; x++) {
|
|
738
|
+
const h1 = ridge(x + 30, 9, 40, 10) + 2;
|
|
739
|
+
const h2 = ridge(x, 19, 24, 7);
|
|
740
|
+
const t1 = Math.floor(horizon - h1);
|
|
741
|
+
const t2 = Math.floor(horizon - h2);
|
|
742
|
+
for (let y = t1; y < horizon; y++) put(x, y, M.hill1, y === t1 ? 0.25 : 0);
|
|
743
|
+
for (let y = t2; y < horizon; y++) put(x, y, M.hill2, y === t2 ? 0.3 : 0);
|
|
744
|
+
}
|
|
745
|
+
for (let y = horizon; y < ROWS; y++) {
|
|
746
|
+
const c = grad(GROUND[m], (y - horizon) / (ROWS - horizon));
|
|
747
|
+
for (let x = 0; x < COLS; x++)
|
|
748
|
+
put(
|
|
749
|
+
x,
|
|
750
|
+
y,
|
|
751
|
+
c,
|
|
752
|
+
y === horizon ? 0.75 : y > horizon + 1 && y % 2 === 0 && hash(x, y, 9) > 0.965 ? 0.3 : 0
|
|
753
|
+
);
|
|
754
|
+
}
|
|
755
|
+
const px = Math.floor(COLS * 0.3);
|
|
756
|
+
const py = horizon + 5;
|
|
757
|
+
const pw = 22;
|
|
758
|
+
const ph = 4;
|
|
759
|
+
const W = WATER[m];
|
|
760
|
+
for (let y = -ph; y <= ph; y++)
|
|
761
|
+
for (let x = -pw; x <= pw; x++) {
|
|
762
|
+
const e = x * x / (pw * pw) + y * y / (ph * ph);
|
|
763
|
+
if (e < 1) {
|
|
764
|
+
const flow = Math.floor(t * 4e-3 + y * 3);
|
|
765
|
+
const rip = ((x + flow) % 7 + 7) % 7 < 2 && hash(x, y, 4) > 0.3;
|
|
766
|
+
put(
|
|
767
|
+
px + x,
|
|
768
|
+
py + y,
|
|
769
|
+
rip ? W[1] : W[0],
|
|
770
|
+
rip ? 0.3 : 0,
|
|
771
|
+
rip && m === "night" ? G_SPARKLE : false
|
|
772
|
+
);
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
for (let x = 0; x < COLS; x += 2) {
|
|
776
|
+
const hh = 1 + Math.floor(hash(x, 1, 21) * 3);
|
|
777
|
+
const sway = Math.sin(t * 2e-3 + x * 0.18) * 0.9 + Math.sin(t * 33e-4 + x * 0.05) * 0.5;
|
|
778
|
+
if (Math.abs(x - px) < pw + 2) continue;
|
|
779
|
+
for (let k = 1; k <= hh; k++)
|
|
780
|
+
put(x + Math.round(sway * (k / hh) * 1.6), horizon - k, M.grass, 0.55);
|
|
781
|
+
if (hash(x, 2, 22) > 0.88)
|
|
782
|
+
put(
|
|
783
|
+
x + Math.round(sway * 1.6),
|
|
784
|
+
horizon - hh - 1,
|
|
785
|
+
SUN[Math.floor(hash(x, 3, 23) * 4)],
|
|
786
|
+
0.9,
|
|
787
|
+
G_FLOWER
|
|
788
|
+
);
|
|
789
|
+
}
|
|
790
|
+
const tx = Math.floor(COLS * 0.62);
|
|
791
|
+
const top = horizon - 28;
|
|
792
|
+
for (let y = top + 9; y < horizon; y++) {
|
|
793
|
+
put(tx, y, TRUNK_A, 0.9);
|
|
794
|
+
put(tx + 1, y, TRUNK_B, 0.9);
|
|
795
|
+
}
|
|
796
|
+
for (const [x0, y0, x1, y1] of [
|
|
797
|
+
[tx - 2, top + 13, tx - 4, top + 11],
|
|
798
|
+
[tx + 3, top + 12, tx + 5, top + 10]
|
|
799
|
+
]) {
|
|
800
|
+
put(x0, y0, TRUNK_A, 0.8);
|
|
801
|
+
put(x1, y1, TRUNK_A, 0.8);
|
|
802
|
+
}
|
|
803
|
+
const sw = Math.sin(t * 17e-4) * 1.1;
|
|
804
|
+
[
|
|
805
|
+
[tx + 0.5, top + 7, 9.5],
|
|
806
|
+
[tx - 7, top + 11, 6],
|
|
807
|
+
[tx + 9, top + 10, 6],
|
|
808
|
+
[tx + 2, top + 1.5, 5]
|
|
809
|
+
].forEach(
|
|
810
|
+
([cx, cy, r], i) => disc(cx + sw * (1 - i * 0.15), cy, r, (x, y, dd) => {
|
|
811
|
+
const n = hash(x, y, 30 + i);
|
|
812
|
+
const edge = dd / r;
|
|
813
|
+
if (n > edge * 0.5) {
|
|
814
|
+
const band = clamp(Math.floor((y - top) / 24 * 4), 0, 3);
|
|
815
|
+
const flick = Math.sin(t * 4e-3 + x * 0.6 + y * 0.4) > 0.7 && edge > 0.7;
|
|
816
|
+
put(x + (flick ? 1 : 0), y, SUN[band], 0.8 - edge * 0.3);
|
|
817
|
+
}
|
|
818
|
+
})
|
|
819
|
+
);
|
|
820
|
+
for (let i = 0; i < 6; i++) {
|
|
821
|
+
const life = (t * 35e-5 + i * 0.17) % 1;
|
|
822
|
+
put(
|
|
823
|
+
tx + 2 + Math.sin(life * 9 + i) * 7 + life * 16,
|
|
824
|
+
top + 6 + life * (horizon - top - 4),
|
|
825
|
+
SUN[1 + i % 3],
|
|
826
|
+
0.9,
|
|
827
|
+
true
|
|
828
|
+
);
|
|
829
|
+
}
|
|
830
|
+
const fr = Math.floor(t / 420) % 2;
|
|
831
|
+
const bob = Math.floor(t / 840) % 2;
|
|
832
|
+
const map = PERSON_MAP(t);
|
|
833
|
+
sprite(PERSON[fr], map, px + pw + 6, horizon - 11, 0.9);
|
|
834
|
+
sprite(DOG[bob], map, px + pw + 13, horizon - 5, 0.85);
|
|
835
|
+
disc(px + pw + 10.5, horizon - 5, 4.5, (x, y, dd) => {
|
|
836
|
+
if (hash(x, y, 50) > dd / 4.5 && filled(x, y) && !isLit(x, y)) put(x, y, M.lanternGlow, 0);
|
|
837
|
+
});
|
|
838
|
+
flock(t, 6, 6);
|
|
839
|
+
if (m === "night")
|
|
840
|
+
for (let i = 0; i < 14; i++) {
|
|
841
|
+
const fx = hash(i, 1, 60) * COLS + Math.sin(t * 7e-4 + i) * 6;
|
|
842
|
+
const fy = horizon - 2 - hash(i, 2, 60) * 14 + Math.sin(t * 11e-4 + i * 2) * 2;
|
|
843
|
+
const pulse = Math.sin(t * 4e-3 + i * 1.7);
|
|
844
|
+
if (pulse > 0.3)
|
|
845
|
+
put(fx, fy, FIREFLY, 0.9, 3 + (pulse - 0.3) / 0.7 * 1.9, 0.8 + pulse * 0.6);
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
const SEA = {
|
|
849
|
+
day: {
|
|
850
|
+
ray: SUN[1],
|
|
851
|
+
reflect: SUN,
|
|
852
|
+
deep: h("#2c6bc0"),
|
|
853
|
+
boat: h("#fafafa"),
|
|
854
|
+
pierLamp: h("#f0b840")
|
|
855
|
+
},
|
|
856
|
+
night: {
|
|
857
|
+
ray: h("#d9c89a"),
|
|
858
|
+
reflect: SUN,
|
|
859
|
+
deep: h("#101a33"),
|
|
860
|
+
boat: h("#d8d2c8"),
|
|
861
|
+
pierLamp: h("#ffd15c")
|
|
862
|
+
}
|
|
863
|
+
};
|
|
864
|
+
const PIER = h("#5a3a22");
|
|
865
|
+
const POLE = h("#4a4a4a");
|
|
866
|
+
const MOON_GLINT = h("#e8d9ae");
|
|
867
|
+
const LAMP_GLOW = h("#9a7a3a");
|
|
868
|
+
function sea(t) {
|
|
869
|
+
const horizon = Math.floor(ROWS * 0.6);
|
|
870
|
+
const m = mode();
|
|
871
|
+
const S = SEA[m];
|
|
872
|
+
const W = WATER[m];
|
|
873
|
+
skyFill(horizon);
|
|
874
|
+
stars(t, horizon);
|
|
875
|
+
const sx = COLS - 44;
|
|
876
|
+
const sy = horizon - 1;
|
|
877
|
+
const R = 15;
|
|
878
|
+
for (let r = R + 3; r < R + 22; r++) {
|
|
879
|
+
const n = Math.floor(2 * Math.PI * r / 2.2);
|
|
880
|
+
for (let i = 0; i < n; i++) {
|
|
881
|
+
const a = i / n * Math.PI * 2;
|
|
882
|
+
const x = sx + Math.cos(a) * r;
|
|
883
|
+
const y = sy + Math.sin(a) * r * 0.92;
|
|
884
|
+
if (y > horizon - 1) continue;
|
|
885
|
+
const spoke = 0.5 + 0.5 * Math.cos(a * 24 + t * 9e-4 + r * 0.2);
|
|
886
|
+
const fall = 1 - (r - R - 3) / 19;
|
|
887
|
+
const breath = 0.7 + 0.3 * Math.sin(t * 16e-4 - r * 0.35);
|
|
888
|
+
if (spoke * fall * breath > 0.42 + bayer(Math.round(x), Math.round(y)) * 0.45)
|
|
889
|
+
put(x, y, S.ray, 0.35 * fall + 0.1, m === "day" ? 1.6 + 1 * fall * breath : false);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
sunDisc(sx, sy, R, horizon);
|
|
893
|
+
clouds(t, [
|
|
894
|
+
[0.1, 8, 12],
|
|
895
|
+
[0.4, 5, 8]
|
|
896
|
+
]);
|
|
897
|
+
for (let y = horizon; y < ROWS; y++) {
|
|
898
|
+
const depth = (y - horizon) / (ROWS - horizon);
|
|
899
|
+
const speed = 18e-4 + depth * 3e-3;
|
|
900
|
+
const phase = Math.floor(t * speed + y * 2.3);
|
|
901
|
+
const period = 9 + Math.floor(depth * 5);
|
|
902
|
+
const base = mixHex(W[0], S.deep, depth);
|
|
903
|
+
const band = clamp(Math.floor((1 - depth) * 4), 0, 3);
|
|
904
|
+
const halfW = R * (0.95 - depth * 0.55) + 2 * Math.sin(t * 2e-3 + y);
|
|
905
|
+
for (let x = 0; x < COLS; x++) {
|
|
906
|
+
const on = (x + phase) % period < 3 && y % 2 === 0;
|
|
907
|
+
const underSun = Math.abs(x - sx) < halfW;
|
|
908
|
+
if (underSun && on)
|
|
909
|
+
put(
|
|
910
|
+
x,
|
|
911
|
+
y,
|
|
912
|
+
m === "night" ? MOON_GLINT : S.reflect[band],
|
|
913
|
+
0.55 - depth * 0.3,
|
|
914
|
+
m === "night" ? 2.2 : 3 - depth * 0.8
|
|
915
|
+
);
|
|
916
|
+
else if (on && hash(x, y, 3) > 0.45) put(x, y, W[1], 0.22 + depth * 0.1);
|
|
917
|
+
else put(x, y, base, y === horizon ? 0.6 : 0);
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
for (let y = horizon + 1; y < ROWS; y++)
|
|
921
|
+
for (let x = 0; x < COLS; x++)
|
|
922
|
+
if (hash(x, y, 11) > 0.996 && Math.sin(t * 6e-3 + hash(x, y, 12) * 20) > 0.85)
|
|
923
|
+
put(x, y, WHITE, 0.9, G_SPARKLE);
|
|
924
|
+
const bx = Math.floor(COLS * 0.35 + Math.sin(t * 25e-5) * 6);
|
|
925
|
+
const by = horizon + 6 + Math.round(Math.sin(t * 21e-4) * 1);
|
|
926
|
+
sprite(BOAT, { w: S.boat, n: TRUNK_B }, bx, by - 7, 0.9);
|
|
927
|
+
const pierY = horizon + 2;
|
|
928
|
+
for (let x = 0; x < 22; x++) put(x, pierY, PIER, 0.85);
|
|
929
|
+
for (let x = 2; x < 22; x += 5) {
|
|
930
|
+
put(x, pierY + 1, PIER, 0.7);
|
|
931
|
+
put(x, pierY + 2, PIER, 0.6);
|
|
932
|
+
}
|
|
933
|
+
for (let y = pierY - 7; y < pierY; y++) put(20, y, POLE, 0.8);
|
|
934
|
+
put(
|
|
935
|
+
20,
|
|
936
|
+
pierY - 8,
|
|
937
|
+
S.pierLamp,
|
|
938
|
+
0.9,
|
|
939
|
+
m === "night" ? lamp(t, 3) : G_DAYLAMP,
|
|
940
|
+
m === "night" ? 2 : 0.6
|
|
941
|
+
);
|
|
942
|
+
if (m === "night")
|
|
943
|
+
disc(20, pierY - 8, 3, (x, y, dd) => {
|
|
944
|
+
if (dd > 0.5 && hash(x, y, 70) > dd / 3) put(x, y, LAMP_GLOW, 0);
|
|
945
|
+
});
|
|
946
|
+
for (let i = 0; i < 3; i++)
|
|
947
|
+
bird(
|
|
948
|
+
(t * 4e-3 * (0.6 + i * 0.2) + i * 61) % (COLS + 20) - 10,
|
|
949
|
+
8 + i * 5 + Math.sin(t * 2e-3 + i) * 1.5,
|
|
950
|
+
t * 0.012 + i,
|
|
951
|
+
0.5
|
|
952
|
+
);
|
|
953
|
+
}
|
|
954
|
+
const RIDGE_C = {
|
|
955
|
+
day: [h("#b7a9d6"), h("#7f87b8"), h("#3f5f6e")],
|
|
956
|
+
night: [h("#4b3b6e"), h("#2e2c58"), h("#1a2238")]
|
|
957
|
+
};
|
|
958
|
+
const RIDGES = [
|
|
959
|
+
{ seed: 101, scale: 30, amp: 20, lift: 0.2, alpha: 0.28, speed: 0.25, snow: 5, fade: 5 },
|
|
960
|
+
{ seed: 202, scale: 22, amp: 16, lift: 0.1, alpha: 0.5, speed: 0.55, snow: 3, fade: 5 },
|
|
961
|
+
{ seed: 303, scale: 15, amp: 11, lift: 0, alpha: 0.85, speed: 1, snow: 0, fade: 6 }
|
|
962
|
+
];
|
|
963
|
+
const MTN = {
|
|
964
|
+
day: { snow: h("#f4f6fa"), pine: h("#1f5a3c"), smoke: h("#d8d8d8"), floor: h("#2b3d45") },
|
|
965
|
+
night: { snow: h("#dfe8ff"), pine: h("#0f2a24"), smoke: h("#6f6f7a"), floor: h("#0d131c") }
|
|
966
|
+
};
|
|
967
|
+
const CABIN_WALL = h("#5a3a22");
|
|
968
|
+
const CABIN_DOOR = h("#3b2a1a");
|
|
969
|
+
function mountains(t) {
|
|
970
|
+
const base = Math.floor(ROWS * 0.92);
|
|
971
|
+
const m = mode();
|
|
972
|
+
const isNight = m === "night";
|
|
973
|
+
const K = MTN[m];
|
|
974
|
+
const W = WATER[m];
|
|
975
|
+
const pan = t * 9e-4;
|
|
976
|
+
skyFill(base);
|
|
977
|
+
stars(t, base * 0.7);
|
|
978
|
+
sunDisc(Math.floor(COLS * 0.8), Math.floor(ROWS * 0.3), 11);
|
|
979
|
+
const RC = RIDGE_C[m];
|
|
980
|
+
const tops = RIDGES.map(() => new Float32Array(COLS));
|
|
981
|
+
RIDGES.forEach((r, i) => {
|
|
982
|
+
const lit = RC[i];
|
|
983
|
+
const shaded = mixHex(RC[i], BLACK, 0.25 * 0.6);
|
|
984
|
+
const row = tops[i];
|
|
985
|
+
for (let x = 0; x < COLS; x++) {
|
|
986
|
+
const xs = x + pan * r.speed * 40;
|
|
987
|
+
const hgt = ridge(xs, r.seed, r.scale, r.amp);
|
|
988
|
+
const top = base - Math.floor(ROWS * r.lift) - hgt;
|
|
989
|
+
row[x] = top;
|
|
990
|
+
const shade = Math.sin(xs / r.scale * 2.5) > 0 ? 1 : 0.75;
|
|
991
|
+
for (let y = Math.floor(top); y <= base; y++) {
|
|
992
|
+
const fromTop = y - top;
|
|
993
|
+
const snowy = r.snow > 0 && fromTop < r.snow && hash(Math.round(xs), y, r.seed) > fromTop / r.snow * 0.9;
|
|
994
|
+
const dens = fromTop < 1 ? 1 : Math.max(0.05, 0.6 - fromTop / r.fade);
|
|
995
|
+
const c = snowy ? K.snow : shade === 1 ? lit : shaded;
|
|
996
|
+
put(
|
|
997
|
+
x,
|
|
998
|
+
y,
|
|
999
|
+
c,
|
|
1000
|
+
snowy || bayer(x, y) < dens ? snowy ? 0.95 : r.alpha * shade : 0,
|
|
1001
|
+
snowy && fromTop < 2 && bayer(x, y) < 0.55 - fromTop * 0.25 ? G_SNOWCAP : false
|
|
1002
|
+
);
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
});
|
|
1006
|
+
const front = tops[2];
|
|
1007
|
+
for (let x = 6; x < COLS; x += 9) {
|
|
1008
|
+
const top = front[x];
|
|
1009
|
+
if (!top) continue;
|
|
1010
|
+
const hh = 4 + Math.floor(hash(x, 5, 88) * 3);
|
|
1011
|
+
for (let k = 0; k < hh; k++)
|
|
1012
|
+
for (let dx = -Math.floor(k / 2); dx <= Math.floor(k / 2); dx++)
|
|
1013
|
+
put(x + dx, top - hh + k + 1, K.pine, 0.85);
|
|
1014
|
+
}
|
|
1015
|
+
for (let y = base - 10; y < ROWS; y++) {
|
|
1016
|
+
const depth = (y - (base - 10)) / (ROWS - base + 10);
|
|
1017
|
+
const rx = COLS * 0.6 + Math.sin(y * 0.35 + 1) * 5 + depth * 8;
|
|
1018
|
+
const w = 1 + depth * 7;
|
|
1019
|
+
const flow = Math.floor(t * 6e-3 + y * 0.9);
|
|
1020
|
+
for (let x = Math.floor(rx - w); x <= Math.ceil(rx + w); x++) {
|
|
1021
|
+
if (x >= 0 && x < COLS && y < front[x] + 2 && y < base - 2) continue;
|
|
1022
|
+
const on = ((x - flow) % 5 + 5) % 5 < 2;
|
|
1023
|
+
put(x, y, on ? W[1] : W[0], on ? 0.9 : 0.45, on && isNight ? G_SPARKLE : false);
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
const cx = Math.floor(COLS * 0.3);
|
|
1027
|
+
const cy = Math.floor(front[clamp(cx, 0, COLS - 1)] ?? base) - 6;
|
|
1028
|
+
sprite(
|
|
1029
|
+
CABIN,
|
|
1030
|
+
{
|
|
1031
|
+
n: CABIN_WALL,
|
|
1032
|
+
D: CABIN_DOOR,
|
|
1033
|
+
y: [LANTERN, 0.9, isNight ? lamp(t, 5) : G_DAYLAMP, 0]
|
|
1034
|
+
},
|
|
1035
|
+
cx,
|
|
1036
|
+
cy,
|
|
1037
|
+
0.9
|
|
1038
|
+
);
|
|
1039
|
+
if (isNight) {
|
|
1040
|
+
softGlow(cx + 2, cy + 4, SOFT_CABIN);
|
|
1041
|
+
softGlow(cx + 2, cy + 5, SOFT_CABIN);
|
|
1042
|
+
}
|
|
1043
|
+
for (let i = 0; i < 5; i++) {
|
|
1044
|
+
const life = (t * 5e-4 + i * 0.2) % 1;
|
|
1045
|
+
put(cx + 5 + Math.sin(life * 7 + i) * 1.5, cy - 1 - life * 9, K.smoke, 0.4 * (1 - life));
|
|
1046
|
+
}
|
|
1047
|
+
for (let x = 0; x < COLS; x++) put(x, base + 1, K.floor, 0.6);
|
|
1048
|
+
const a = t * 6e-4;
|
|
1049
|
+
bird(COLS * 0.5 + Math.cos(a) * 24, ROWS * 0.28 + Math.sin(a) * 6, t * 8e-3, 0.7);
|
|
1050
|
+
}
|
|
1051
|
+
const SCENES = { alpine, meadow, sea, mountains };
|
|
1052
|
+
const PAINTERS = /* @__PURE__ */ new Map();
|
|
1053
|
+
function getScenePainter(name) {
|
|
1054
|
+
const key = Object.prototype.hasOwnProperty.call(SCENES, name) ? name : "alpine";
|
|
1055
|
+
let p = PAINTERS.get(key);
|
|
1056
|
+
if (!p) {
|
|
1057
|
+
const fn = SCENES[key];
|
|
1058
|
+
p = (t, g, isNight) => {
|
|
1059
|
+
G = g;
|
|
1060
|
+
COLS = g.cols;
|
|
1061
|
+
ROWS = g.rows;
|
|
1062
|
+
NIGHT = isNight;
|
|
1063
|
+
g.copyW = COLS * COPY_W;
|
|
1064
|
+
g.copyH = ROWS * COPY_H;
|
|
1065
|
+
if (COLS > 0 && ROWS > 0) fn(t);
|
|
1066
|
+
};
|
|
1067
|
+
PAINTERS.set(key, p);
|
|
1068
|
+
}
|
|
1069
|
+
return p;
|
|
1070
|
+
}
|
|
1071
|
+
export {
|
|
1072
|
+
PIXEL_SCENES,
|
|
1073
|
+
getScenePainter
|
|
1074
|
+
};
|