1681-engine 0.0.0-stage → 0.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +304 -0
- package/LICENSE +21 -0
- package/README.md +164 -2
- package/dist/1681-engine.js +417 -0
- package/dist/1681-engine.js.map +1 -0
- package/dist/ambient/ColorGrade.js +41 -0
- package/dist/ambient/ColorGrade.js.map +1 -0
- package/dist/ambient/DayClock.js +57 -0
- package/dist/ambient/DayClock.js.map +1 -0
- package/dist/ambient/WeatherLayer.js +91 -0
- package/dist/ambient/WeatherLayer.js.map +1 -0
- package/dist/ambient/grade.js +13 -0
- package/dist/ambient/grade.js.map +1 -0
- package/dist/ambient/weather.js +52 -0
- package/dist/ambient/weather.js.map +1 -0
- package/dist/anim/AnimStateMachine.js +164 -0
- package/dist/anim/AnimStateMachine.js.map +1 -0
- package/dist/anim/Animator.js +67 -0
- package/dist/anim/Animator.js.map +1 -0
- package/dist/anim/animStateCompile.js +113 -0
- package/dist/anim/animStateCompile.js.map +1 -0
- package/dist/anim/animStateSystem.js +17 -0
- package/dist/anim/animStateSystem.js.map +1 -0
- package/dist/anim/animationSystem.js +15 -0
- package/dist/anim/animationSystem.js.map +1 -0
- package/dist/anim/asepriteSlices.js +22 -0
- package/dist/anim/asepriteSlices.js.map +1 -0
- package/dist/anim/asepriteTags.js +35 -0
- package/dist/anim/asepriteTags.js.map +1 -0
- package/dist/anim/parseAseprite.js +83 -0
- package/dist/anim/parseAseprite.js.map +1 -0
- package/dist/assets/AssetLoader.js +104 -0
- package/dist/assets/AssetLoader.js.map +1 -0
- package/dist/assets/loadAseprite.js +50 -0
- package/dist/assets/loadAseprite.js.map +1 -0
- package/dist/assets/takeCleanerWorker-DTcI_Jqr.js +31 -0
- package/dist/assets/takeCleanerWorker-DTcI_Jqr.js.map +1 -0
- package/dist/audio/Footsteps.js +26 -0
- package/dist/audio/Footsteps.js.map +1 -0
- package/dist/audio/MusicPlayer.js +78 -0
- package/dist/audio/MusicPlayer.js.map +1 -0
- package/dist/audio/SoundEngine.js +119 -0
- package/dist/audio/SoundEngine.js.map +1 -0
- package/dist/audio/cleanTake.js +30 -0
- package/dist/audio/cleanTake.js.map +1 -0
- package/dist/audio/music/ElementVoice.js +35 -0
- package/dist/audio/music/ElementVoice.js.map +1 -0
- package/dist/audio/music/GraphVoice.js +39 -0
- package/dist/audio/music/GraphVoice.js.map +1 -0
- package/dist/audio/music/MusicChannel.js +58 -0
- package/dist/audio/music/MusicChannel.js.map +1 -0
- package/dist/audio/music/musicVoice.js +13 -0
- package/dist/audio/music/musicVoice.js.map +1 -0
- package/dist/audio/sampleBank.js +82 -0
- package/dist/audio/sampleBank.js.map +1 -0
- package/dist/audio/soundTable.js +9 -0
- package/dist/audio/soundTable.js.map +1 -0
- package/dist/audio/synth.js +36 -0
- package/dist/audio/synth.js.map +1 -0
- package/dist/core/BitmapLabel.js +49 -0
- package/dist/core/BitmapLabel.js.map +1 -0
- package/dist/core/Camera.js +150 -0
- package/dist/core/Camera.js.map +1 -0
- package/dist/core/Clock.js +30 -0
- package/dist/core/Clock.js.map +1 -0
- package/dist/core/Graphics.js +69 -0
- package/dist/core/Graphics.js.map +1 -0
- package/dist/core/Group.js +29 -0
- package/dist/core/Group.js.map +1 -0
- package/dist/core/Image.js +51 -0
- package/dist/core/Image.js.map +1 -0
- package/dist/core/ObjectFactory.js +55 -0
- package/dist/core/ObjectFactory.js.map +1 -0
- package/dist/core/Pointer.js +58 -0
- package/dist/core/Pointer.js.map +1 -0
- package/dist/core/Rectangle.js +51 -0
- package/dist/core/Rectangle.js.map +1 -0
- package/dist/core/Stage.js +86 -0
- package/dist/core/Stage.js.map +1 -0
- package/dist/core/Text.js +22 -0
- package/dist/core/Text.js.map +1 -0
- package/dist/core/TextureRegistry.js +111 -0
- package/dist/core/TextureRegistry.js.map +1 -0
- package/dist/core/Timeline.js +211 -0
- package/dist/core/Timeline.js.map +1 -0
- package/dist/core/TimelineBuilder.js +73 -0
- package/dist/core/TimelineBuilder.js.map +1 -0
- package/dist/core/TimelineChild.js +84 -0
- package/dist/core/TimelineChild.js.map +1 -0
- package/dist/core/Tweener.js +136 -0
- package/dist/core/Tweener.js.map +1 -0
- package/dist/core/atlas.js +38 -0
- package/dist/core/atlas.js.map +1 -0
- package/dist/core/atlasPlan.js +22 -0
- package/dist/core/atlasPlan.js.map +1 -0
- package/dist/core/eases.js +21 -0
- package/dist/core/eases.js.map +1 -0
- package/dist/core/gameObject.js +115 -0
- package/dist/core/gameObject.js.map +1 -0
- package/dist/core/pixiPatches.js +18 -0
- package/dist/core/pixiPatches.js.map +1 -0
- package/dist/core/timelinePlace.js +24 -0
- package/dist/core/timelinePlace.js.map +1 -0
- package/dist/core/tweenProps.js +12 -0
- package/dist/core/tweenProps.js.map +1 -0
- package/dist/debug/DebugOverlay.js +94 -0
- package/dist/debug/DebugOverlay.js.map +1 -0
- package/dist/debug/DrawCallCounter.js +41 -0
- package/dist/debug/DrawCallCounter.js.map +1 -0
- package/dist/debug/ErrorLog.js +22 -0
- package/dist/debug/ErrorLog.js.map +1 -0
- package/dist/debug/FrameStats.js +42 -0
- package/dist/debug/FrameStats.js.map +1 -0
- package/dist/debug/inspectWorld.js +29 -0
- package/dist/debug/inspectWorld.js.map +1 -0
- package/dist/diagnostics/ErrorDeduper.js +27 -0
- package/dist/diagnostics/ErrorDeduper.js.map +1 -0
- package/dist/diagnostics/FrameSampler.js +42 -0
- package/dist/diagnostics/FrameSampler.js.map +1 -0
- package/dist/diagnostics/bootWatch.js +21 -0
- package/dist/diagnostics/bootWatch.js.map +1 -0
- package/dist/diagnostics/captureErrors.js +27 -0
- package/dist/diagnostics/captureErrors.js.map +1 -0
- package/dist/diagnostics/contextLoss.js +25 -0
- package/dist/diagnostics/contextLoss.js.map +1 -0
- package/dist/diagnostics/frameStats.js +31 -0
- package/dist/diagnostics/frameStats.js.map +1 -0
- package/dist/diagnostics/gpuInfo.js +22 -0
- package/dist/diagnostics/gpuInfo.js.map +1 -0
- package/dist/diagnostics/renderGuard.js +24 -0
- package/dist/diagnostics/renderGuard.js.map +1 -0
- package/dist/ecs/SparseSet.js +55 -0
- package/dist/ecs/SparseSet.js.map +1 -0
- package/dist/ecs/World.js +307 -0
- package/dist/ecs/World.js.map +1 -0
- package/dist/ecs/fields.js +26 -0
- package/dist/ecs/fields.js.map +1 -0
- package/dist/engine/Engine.js +82 -0
- package/dist/engine/Engine.js.map +1 -0
- package/dist/engine/FixedLoop.js +37 -0
- package/dist/engine/FixedLoop.js.map +1 -0
- package/dist/engine/Scene.js +79 -0
- package/dist/engine/Scene.js.map +1 -0
- package/dist/engine/SceneManager.js +73 -0
- package/dist/engine/SceneManager.js.map +1 -0
- package/dist/events/EventBus.js +42 -0
- package/dist/events/EventBus.js.map +1 -0
- package/dist/fx/FloatingText.js +72 -0
- package/dist/fx/FloatingText.js.map +1 -0
- package/dist/fx/hitStop.js +28 -0
- package/dist/fx/hitStop.js.map +1 -0
- package/dist/fx/viewCull.js +10 -0
- package/dist/fx/viewCull.js.map +1 -0
- package/dist/i18n/Translator.js +72 -0
- package/dist/i18n/Translator.js.map +1 -0
- package/dist/i18n/extractStrings.js +58 -0
- package/dist/i18n/extractStrings.js.map +1 -0
- package/dist/i18n/formatMessage.js +19 -0
- package/dist/i18n/formatMessage.js.map +1 -0
- package/dist/input/Actions.js +131 -0
- package/dist/input/Actions.js.map +1 -0
- package/dist/input/AimGesture.js +75 -0
- package/dist/input/AimGesture.js.map +1 -0
- package/dist/input/Keyboard.js +54 -0
- package/dist/input/Keyboard.js.map +1 -0
- package/dist/input/Keymap.js +171 -0
- package/dist/input/Keymap.js.map +1 -0
- package/dist/input/TargetLock.js +73 -0
- package/dist/input/TargetLock.js.map +1 -0
- package/dist/input/aimAxis.js +8 -0
- package/dist/input/aimAxis.js.map +1 -0
- package/dist/input/keyChord.js +29 -0
- package/dist/input/keyChord.js.map +1 -0
- package/dist/input/longPress.js +32 -0
- package/dist/input/longPress.js.map +1 -0
- package/dist/input/stickAxis.js +23 -0
- package/dist/input/stickAxis.js.map +1 -0
- package/dist/input/touchDetect.js +7 -0
- package/dist/input/touchDetect.js.map +1 -0
- package/dist/light/LightLayer.js +84 -0
- package/dist/light/LightLayer.js.map +1 -0
- package/dist/nav/MinHeap.js +39 -0
- package/dist/nav/MinHeap.js.map +1 -0
- package/dist/nav/findPath.js +78 -0
- package/dist/nav/findPath.js.map +1 -0
- package/dist/nav/navGrid.js +36 -0
- package/dist/nav/navGrid.js.map +1 -0
- package/dist/nav/nearestOpen.js +19 -0
- package/dist/nav/nearestOpen.js.map +1 -0
- package/dist/nav/straightenPath.js +51 -0
- package/dist/nav/straightenPath.js.map +1 -0
- package/dist/net/Connection.js +84 -0
- package/dist/net/Connection.js.map +1 -0
- package/dist/net/InterpolationBuffer.js +57 -0
- package/dist/net/InterpolationBuffer.js.map +1 -0
- package/dist/net/PredictedMover.js +61 -0
- package/dist/net/PredictedMover.js.map +1 -0
- package/dist/net/Room.js +92 -0
- package/dist/net/Room.js.map +1 -0
- package/dist/net/RoomHost.js +101 -0
- package/dist/net/RoomHost.js.map +1 -0
- package/dist/net/cadence.js +22 -0
- package/dist/net/cadence.js.map +1 -0
- package/dist/net/constants.js +11 -0
- package/dist/net/constants.js.map +1 -0
- package/dist/net/lobby/LobbyClient.js +124 -0
- package/dist/net/lobby/LobbyClient.js.map +1 -0
- package/dist/net/lobby/LobbyHost.js +366 -0
- package/dist/net/lobby/LobbyHost.js.map +1 -0
- package/dist/net/lobby/LobbyRooms.js +66 -0
- package/dist/net/lobby/LobbyRooms.js.map +1 -0
- package/dist/net/lobby/Matchmaker.js +106 -0
- package/dist/net/lobby/Matchmaker.js.map +1 -0
- package/dist/net/movement.js +83 -0
- package/dist/net/movement.js.map +1 -0
- package/dist/net/protocol.js +11 -0
- package/dist/net/protocol.js.map +1 -0
- package/dist/net/serverClock.js +22 -0
- package/dist/net/serverClock.js.map +1 -0
- package/dist/net/snapshotCodec.js +92 -0
- package/dist/net/snapshotCodec.js.map +1 -0
- package/dist/parallax/Parallax.js +32 -0
- package/dist/parallax/Parallax.js.map +1 -0
- package/dist/parallax/ParallaxLayer.js +70 -0
- package/dist/parallax/ParallaxLayer.js.map +1 -0
- package/dist/parallax/parallaxMath.js +27 -0
- package/dist/parallax/parallaxMath.js.map +1 -0
- package/dist/particles/Emitter.js +108 -0
- package/dist/particles/Emitter.js.map +1 -0
- package/dist/particles/ParticleBudget.js +32 -0
- package/dist/particles/ParticleBudget.js.map +1 -0
- package/dist/particles/ParticleSim.js +60 -0
- package/dist/particles/ParticleSim.js.map +1 -0
- package/dist/particles/particleCurves.js +48 -0
- package/dist/particles/particleCurves.js.map +1 -0
- package/dist/particles/particleSampling.js +30 -0
- package/dist/particles/particleSampling.js.map +1 -0
- package/dist/physics/Body.js +202 -0
- package/dist/physics/Body.js.map +1 -0
- package/dist/physics/BroadPhase.js +56 -0
- package/dist/physics/BroadPhase.js.map +1 -0
- package/dist/physics/Contact.js +76 -0
- package/dist/physics/Contact.js.map +1 -0
- package/dist/physics/ContactSolver.js +70 -0
- package/dist/physics/ContactSolver.js.map +1 -0
- package/dist/physics/PhysicsWorld.js +221 -0
- package/dist/physics/PhysicsWorld.js.map +1 -0
- package/dist/physics/SpatialHash.js +39 -0
- package/dist/physics/SpatialHash.js.map +1 -0
- package/dist/physics/collide.js +76 -0
- package/dist/physics/collide.js.map +1 -0
- package/dist/physics/collidePolygon.js +94 -0
- package/dist/physics/collidePolygon.js.map +1 -0
- package/dist/physics/contactReport.js +14 -0
- package/dist/physics/contactReport.js.map +1 -0
- package/dist/physics/drawColliders.js +31 -0
- package/dist/physics/drawColliders.js.map +1 -0
- package/dist/physics/physicsSystem.js +8 -0
- package/dist/physics/physicsSystem.js.map +1 -0
- package/dist/physics/polygon.js +80 -0
- package/dist/physics/polygon.js.map +1 -0
- package/dist/physics/raycast.js +62 -0
- package/dist/physics/raycast.js.map +1 -0
- package/dist/physics/syncToBody.js +19 -0
- package/dist/physics/syncToBody.js.map +1 -0
- package/dist/physics/tileBodies.js +59 -0
- package/dist/physics/tileBodies.js.map +1 -0
- package/dist/physics/types.js +8 -0
- package/dist/physics/types.js.map +1 -0
- package/dist/pixel/Darkness.js +166 -0
- package/dist/pixel/Darkness.js.map +1 -0
- package/dist/pixel/DitherVignette.js +57 -0
- package/dist/pixel/DitherVignette.js.map +1 -0
- package/dist/pixel/Evaporation.js +85 -0
- package/dist/pixel/Evaporation.js.map +1 -0
- package/dist/pixel/NightShade.js +34 -0
- package/dist/pixel/NightShade.js.map +1 -0
- package/dist/pixel/PixelLayer.js +211 -0
- package/dist/pixel/PixelLayer.js.map +1 -0
- package/dist/pixel/SwayProp.js +75 -0
- package/dist/pixel/SwayProp.js.map +1 -0
- package/dist/pixel/lights.js +44 -0
- package/dist/pixel/lights.js.map +1 -0
- package/dist/pixel/nineSlice.js +62 -0
- package/dist/pixel/nineSlice.js.map +1 -0
- package/dist/pixel/paintLayer.js +36 -0
- package/dist/pixel/paintLayer.js.map +1 -0
- package/dist/pixel/palette.js +57 -0
- package/dist/pixel/palette.js.map +1 -0
- package/dist/pixel/pixel.js +278 -0
- package/dist/pixel/pixel.js.map +1 -0
- package/dist/pixel/pixelPaint.js +194 -0
- package/dist/pixel/pixelPaint.js.map +1 -0
- package/dist/pixel/pixelTone.js +164 -0
- package/dist/pixel/pixelTone.js.map +1 -0
- package/dist/pixel/propKit.js +41 -0
- package/dist/pixel/propKit.js.map +1 -0
- package/dist/pixel/ramp.js +102 -0
- package/dist/pixel/ramp.js.map +1 -0
- package/dist/pixel/selout.js +35 -0
- package/dist/pixel/selout.js.map +1 -0
- package/dist/pixel/spritePixels.js +59 -0
- package/dist/pixel/spritePixels.js.map +1 -0
- package/dist/pixel/swayRig.js +87 -0
- package/dist/pixel/swayRig.js.map +1 -0
- package/dist/pixel/vignetteMask.js +24 -0
- package/dist/pixel/vignetteMask.js.map +1 -0
- package/dist/pixel/weatherArt.js +61 -0
- package/dist/pixel/weatherArt.js.map +1 -0
- package/dist/pixel.js +90 -0
- package/dist/pixel.js.map +1 -0
- package/dist/platform/touch.js +33 -0
- package/dist/platform/touch.js.map +1 -0
- package/dist/postfx/BloomFilter.js +65 -0
- package/dist/postfx/BloomFilter.js.map +1 -0
- package/dist/postfx/ChromaticAberrationFilter.js +25 -0
- package/dist/postfx/ChromaticAberrationFilter.js.map +1 -0
- package/dist/postfx/ColorAdjustFilter.js +76 -0
- package/dist/postfx/ColorAdjustFilter.js.map +1 -0
- package/dist/postfx/CrtFilter.js +42 -0
- package/dist/postfx/CrtFilter.js.map +1 -0
- package/dist/postfx/PixelateFilter.js +27 -0
- package/dist/postfx/PixelateFilter.js.map +1 -0
- package/dist/postfx/PostFx.js +123 -0
- package/dist/postfx/PostFx.js.map +1 -0
- package/dist/postfx/ShockwaveFilter.js +49 -0
- package/dist/postfx/ShockwaveFilter.js.map +1 -0
- package/dist/postfx/VignetteFilter.js +37 -0
- package/dist/postfx/VignetteFilter.js.map +1 -0
- package/dist/postfx/fxAnimator.js +38 -0
- package/dist/postfx/fxAnimator.js.map +1 -0
- package/dist/postfx/fxShader.js +128 -0
- package/dist/postfx/fxShader.js.map +1 -0
- package/dist/postfx.js +26 -0
- package/dist/postfx.js.map +1 -0
- package/dist/react/ChoiceDialog.js +51 -0
- package/dist/react/ChoiceDialog.js.map +1 -0
- package/dist/react/ConfirmDialog.js +53 -0
- package/dist/react/ConfirmDialog.js.map +1 -0
- package/dist/react/Glyph.js +63 -0
- package/dist/react/Glyph.js.map +1 -0
- package/dist/react/Modal.js +38 -0
- package/dist/react/Modal.js.map +1 -0
- package/dist/react/Panel.js +24 -0
- package/dist/react/Panel.js.map +1 -0
- package/dist/react/PixelImage.js +24 -0
- package/dist/react/PixelImage.js.map +1 -0
- package/dist/react/Select.js +99 -0
- package/dist/react/Select.js.map +1 -0
- package/dist/react/Slider.js +62 -0
- package/dist/react/Slider.js.map +1 -0
- package/dist/react/SplitPane.js +24 -0
- package/dist/react/SplitPane.js.map +1 -0
- package/dist/react/TabStrip.js +32 -0
- package/dist/react/TabStrip.js.map +1 -0
- package/dist/react/TitleTips.js +42 -0
- package/dist/react/TitleTips.js.map +1 -0
- package/dist/react/Tooltip.js +28 -0
- package/dist/react/Tooltip.js.map +1 -0
- package/dist/react/UiProvider.js +50 -0
- package/dist/react/UiProvider.js.map +1 -0
- package/dist/react/baseCss.js +222 -0
- package/dist/react/baseCss.js.map +1 -0
- package/dist/react/choiceStore.js +23 -0
- package/dist/react/choiceStore.js.map +1 -0
- package/dist/react/classNames.js +19 -0
- package/dist/react/classNames.js.map +1 -0
- package/dist/react/confirmStore.js +30 -0
- package/dist/react/confirmStore.js.map +1 -0
- package/dist/react/labels.js +18 -0
- package/dist/react/labels.js.map +1 -0
- package/dist/react/placement.js +49 -0
- package/dist/react/placement.js.map +1 -0
- package/dist/react/useFillSheet.js +23 -0
- package/dist/react/useFillSheet.js.map +1 -0
- package/dist/react/useFitToViewport.js +29 -0
- package/dist/react/useFitToViewport.js.map +1 -0
- package/dist/react/usePicked.js +13 -0
- package/dist/react/usePicked.js.map +1 -0
- package/dist/react/useStore.js +9 -0
- package/dist/react/useStore.js.map +1 -0
- package/dist/react/useViewport.js +17 -0
- package/dist/react/useViewport.js.map +1 -0
- package/dist/react.js +78 -0
- package/dist/react.js.map +1 -0
- package/dist/rig/PosePlayer.js +92 -0
- package/dist/rig/PosePlayer.js.map +1 -0
- package/dist/rig/RigView.js +125 -0
- package/dist/rig/RigView.js.map +1 -0
- package/dist/rig/Skeleton.js +31 -0
- package/dist/rig/Skeleton.js.map +1 -0
- package/dist/rig/humanoid.js +6 -0
- package/dist/rig/humanoid.js.map +1 -0
- package/dist/rig/humanoid.json.js +30 -0
- package/dist/rig/humanoid.json.js.map +1 -0
- package/dist/rig/humanoidPoses.js +30 -0
- package/dist/rig/humanoidPoses.js.map +1 -0
- package/dist/rig/poseMath.js +54 -0
- package/dist/rig/poseMath.js.map +1 -0
- package/dist/rig/poses.json.js +150 -0
- package/dist/rig/poses.json.js.map +1 -0
- package/dist/save/Autosaver.js +54 -0
- package/dist/save/Autosaver.js.map +1 -0
- package/dist/save/MemoryBackend.js +19 -0
- package/dist/save/MemoryBackend.js.map +1 -0
- package/dist/save/SaveStore.js +103 -0
- package/dist/save/SaveStore.js.map +1 -0
- package/dist/save/WebStorageBackend.js +27 -0
- package/dist/save/WebStorageBackend.js.map +1 -0
- package/dist/save/checksum.js +10 -0
- package/dist/save/checksum.js.map +1 -0
- package/dist/save/migrateSave.js +27 -0
- package/dist/save/migrateSave.js.map +1 -0
- package/dist/settings.js +27 -0
- package/dist/settings.js.map +1 -0
- package/dist/tilemap/TilemapView.js +69 -0
- package/dist/tilemap/TilemapView.js.map +1 -0
- package/dist/tilemap/collision.js +25 -0
- package/dist/tilemap/collision.js.map +1 -0
- package/dist/tilemap/tiled.js +138 -0
- package/dist/tilemap/tiled.js.map +1 -0
- package/dist/transitions/CrossfadeTransition.js +24 -0
- package/dist/transitions/CrossfadeTransition.js.map +1 -0
- package/dist/transitions/DitherWipeTransition.js +70 -0
- package/dist/transitions/DitherWipeTransition.js.map +1 -0
- package/dist/transitions/FadeTransition.js +34 -0
- package/dist/transitions/FadeTransition.js.map +1 -0
- package/dist/transitions/Letterbox.js +42 -0
- package/dist/transitions/Letterbox.js.map +1 -0
- package/dist/transitions/ditherMask.js +15 -0
- package/dist/transitions/ditherMask.js.map +1 -0
- package/dist/transitions/transitionTo.js +28 -0
- package/dist/transitions/transitionTo.js.map +1 -0
- package/dist/transitions/tweenDone.js +15 -0
- package/dist/transitions/tweenDone.js.map +1 -0
- package/dist/types/ambient/ColorGrade.d.ts +41 -0
- package/dist/types/ambient/ColorGrade.d.ts.map +1 -0
- package/dist/types/ambient/DayClock.d.ts +80 -0
- package/dist/types/ambient/DayClock.d.ts.map +1 -0
- package/dist/types/ambient/WeatherLayer.d.ts +78 -0
- package/dist/types/ambient/WeatherLayer.d.ts.map +1 -0
- package/dist/types/ambient/grade.d.ts +22 -0
- package/dist/types/ambient/grade.d.ts.map +1 -0
- package/dist/types/ambient/weather.d.ts +49 -0
- package/dist/types/ambient/weather.d.ts.map +1 -0
- package/dist/types/anim/AnimStateMachine.d.ts +80 -0
- package/dist/types/anim/AnimStateMachine.d.ts.map +1 -0
- package/dist/types/anim/Animator.d.ts +50 -0
- package/dist/types/anim/Animator.d.ts.map +1 -0
- package/dist/types/anim/animStateCompile.d.ts +52 -0
- package/dist/types/anim/animStateCompile.d.ts.map +1 -0
- package/dist/types/anim/animStateSystem.d.ts +10 -0
- package/dist/types/anim/animStateSystem.d.ts.map +1 -0
- package/dist/types/anim/animStateTypes.d.ts +50 -0
- package/dist/types/anim/animStateTypes.d.ts.map +1 -0
- package/dist/types/anim/animationSystem.d.ts +13 -0
- package/dist/types/anim/animationSystem.d.ts.map +1 -0
- package/dist/types/anim/asepriteSlices.d.ts +19 -0
- package/dist/types/anim/asepriteSlices.d.ts.map +1 -0
- package/dist/types/anim/asepriteTags.d.ts +16 -0
- package/dist/types/anim/asepriteTags.d.ts.map +1 -0
- package/dist/types/anim/asepriteTypes.d.ts +159 -0
- package/dist/types/anim/asepriteTypes.d.ts.map +1 -0
- package/dist/types/anim/parseAseprite.d.ts +21 -0
- package/dist/types/anim/parseAseprite.d.ts.map +1 -0
- package/dist/types/assets/AssetLoader.d.ts +85 -0
- package/dist/types/assets/AssetLoader.d.ts.map +1 -0
- package/dist/types/assets/loadAseprite.d.ts +27 -0
- package/dist/types/assets/loadAseprite.d.ts.map +1 -0
- package/dist/types/audio/Footsteps.d.ts +33 -0
- package/dist/types/audio/Footsteps.d.ts.map +1 -0
- package/dist/types/audio/MusicPlayer.d.ts +65 -0
- package/dist/types/audio/MusicPlayer.d.ts.map +1 -0
- package/dist/types/audio/SoundEngine.d.ts +42 -0
- package/dist/types/audio/SoundEngine.d.ts.map +1 -0
- package/dist/types/audio/cleanTake.d.ts +3 -0
- package/dist/types/audio/cleanTake.d.ts.map +1 -0
- package/dist/types/audio/music/ElementVoice.d.ts +14 -0
- package/dist/types/audio/music/ElementVoice.d.ts.map +1 -0
- package/dist/types/audio/music/GraphVoice.d.ts +22 -0
- package/dist/types/audio/music/GraphVoice.d.ts.map +1 -0
- package/dist/types/audio/music/MusicChannel.d.ts +35 -0
- package/dist/types/audio/music/MusicChannel.d.ts.map +1 -0
- package/dist/types/audio/music/musicVoice.d.ts +26 -0
- package/dist/types/audio/music/musicVoice.d.ts.map +1 -0
- package/dist/types/audio/sampleBank.d.ts +27 -0
- package/dist/types/audio/sampleBank.d.ts.map +1 -0
- package/dist/types/audio/soundTable.d.ts +14 -0
- package/dist/types/audio/soundTable.d.ts.map +1 -0
- package/dist/types/audio/synth.d.ts +34 -0
- package/dist/types/audio/synth.d.ts.map +1 -0
- package/dist/types/audio/takeCleanerWorker.d.ts +2 -0
- package/dist/types/audio/takeCleanerWorker.d.ts.map +1 -0
- package/dist/types/core/BitmapLabel.d.ts +36 -0
- package/dist/types/core/BitmapLabel.d.ts.map +1 -0
- package/dist/types/core/Camera.d.ts +115 -0
- package/dist/types/core/Camera.d.ts.map +1 -0
- package/dist/types/core/Clock.d.ts +11 -0
- package/dist/types/core/Clock.d.ts.map +1 -0
- package/dist/types/core/Graphics.d.ts +37 -0
- package/dist/types/core/Graphics.d.ts.map +1 -0
- package/dist/types/core/Group.d.ts +15 -0
- package/dist/types/core/Group.d.ts.map +1 -0
- package/dist/types/core/Image.d.ts +25 -0
- package/dist/types/core/Image.d.ts.map +1 -0
- package/dist/types/core/ObjectFactory.d.ts +34 -0
- package/dist/types/core/ObjectFactory.d.ts.map +1 -0
- package/dist/types/core/Pointer.d.ts +27 -0
- package/dist/types/core/Pointer.d.ts.map +1 -0
- package/dist/types/core/Rectangle.d.ts +26 -0
- package/dist/types/core/Rectangle.d.ts.map +1 -0
- package/dist/types/core/Stage.d.ts +58 -0
- package/dist/types/core/Stage.d.ts.map +1 -0
- package/dist/types/core/Text.d.ts +22 -0
- package/dist/types/core/Text.d.ts.map +1 -0
- package/dist/types/core/TextureRegistry.d.ts +51 -0
- package/dist/types/core/TextureRegistry.d.ts.map +1 -0
- package/dist/types/core/Timeline.d.ts +115 -0
- package/dist/types/core/Timeline.d.ts.map +1 -0
- package/dist/types/core/TimelineBuilder.d.ts +53 -0
- package/dist/types/core/TimelineBuilder.d.ts.map +1 -0
- package/dist/types/core/TimelineChild.d.ts +51 -0
- package/dist/types/core/TimelineChild.d.ts.map +1 -0
- package/dist/types/core/Tweener.d.ts +70 -0
- package/dist/types/core/Tweener.d.ts.map +1 -0
- package/dist/types/core/atlas.d.ts +16 -0
- package/dist/types/core/atlas.d.ts.map +1 -0
- package/dist/types/core/atlasPlan.d.ts +34 -0
- package/dist/types/core/atlasPlan.d.ts.map +1 -0
- package/dist/types/core/eases.d.ts +3 -0
- package/dist/types/core/eases.d.ts.map +1 -0
- package/dist/types/core/gameObject.d.ts +42 -0
- package/dist/types/core/gameObject.d.ts.map +1 -0
- package/dist/types/core/pixiPatches.d.ts +9 -0
- package/dist/types/core/pixiPatches.d.ts.map +1 -0
- package/dist/types/core/timelinePlace.d.ts +23 -0
- package/dist/types/core/timelinePlace.d.ts.map +1 -0
- package/dist/types/core/tweenProps.d.ts +8 -0
- package/dist/types/core/tweenProps.d.ts.map +1 -0
- package/dist/types/core/types.d.ts +4 -0
- package/dist/types/core/types.d.ts.map +1 -0
- package/dist/types/debug/DebugOverlay.d.ts +63 -0
- package/dist/types/debug/DebugOverlay.d.ts.map +1 -0
- package/dist/types/debug/DrawCallCounter.d.ts +20 -0
- package/dist/types/debug/DrawCallCounter.d.ts.map +1 -0
- package/dist/types/debug/ErrorLog.d.ts +20 -0
- package/dist/types/debug/ErrorLog.d.ts.map +1 -0
- package/dist/types/debug/FrameStats.d.ts +21 -0
- package/dist/types/debug/FrameStats.d.ts.map +1 -0
- package/dist/types/debug/inspectWorld.d.ts +14 -0
- package/dist/types/debug/inspectWorld.d.ts.map +1 -0
- package/dist/types/diagnostics/ErrorDeduper.d.ts +17 -0
- package/dist/types/diagnostics/ErrorDeduper.d.ts.map +1 -0
- package/dist/types/diagnostics/FrameSampler.d.ts +37 -0
- package/dist/types/diagnostics/FrameSampler.d.ts.map +1 -0
- package/dist/types/diagnostics/bootWatch.d.ts +25 -0
- package/dist/types/diagnostics/bootWatch.d.ts.map +1 -0
- package/dist/types/diagnostics/captureErrors.d.ts +24 -0
- package/dist/types/diagnostics/captureErrors.d.ts.map +1 -0
- package/dist/types/diagnostics/contextLoss.d.ts +35 -0
- package/dist/types/diagnostics/contextLoss.d.ts.map +1 -0
- package/dist/types/diagnostics/frameStats.d.ts +30 -0
- package/dist/types/diagnostics/frameStats.d.ts.map +1 -0
- package/dist/types/diagnostics/gpuInfo.d.ts +9 -0
- package/dist/types/diagnostics/gpuInfo.d.ts.map +1 -0
- package/dist/types/diagnostics/renderGuard.d.ts +12 -0
- package/dist/types/diagnostics/renderGuard.d.ts.map +1 -0
- package/dist/types/ecs/SparseSet.d.ts +25 -0
- package/dist/types/ecs/SparseSet.d.ts.map +1 -0
- package/dist/types/ecs/World.d.ts +137 -0
- package/dist/types/ecs/World.d.ts.map +1 -0
- package/dist/types/ecs/fields.d.ts +34 -0
- package/dist/types/ecs/fields.d.ts.map +1 -0
- package/dist/types/engine/Engine.d.ts +80 -0
- package/dist/types/engine/Engine.d.ts.map +1 -0
- package/dist/types/engine/FixedLoop.d.ts +32 -0
- package/dist/types/engine/FixedLoop.d.ts.map +1 -0
- package/dist/types/engine/Scene.d.ts +67 -0
- package/dist/types/engine/Scene.d.ts.map +1 -0
- package/dist/types/engine/SceneManager.d.ts +36 -0
- package/dist/types/engine/SceneManager.d.ts.map +1 -0
- package/dist/types/events/EventBus.d.ts +20 -0
- package/dist/types/events/EventBus.d.ts.map +1 -0
- package/dist/types/fx/FloatingText.d.ts +71 -0
- package/dist/types/fx/FloatingText.d.ts.map +1 -0
- package/dist/types/fx/hitStop.d.ts +20 -0
- package/dist/types/fx/hitStop.d.ts.map +1 -0
- package/dist/types/fx/viewCull.d.ts +14 -0
- package/dist/types/fx/viewCull.d.ts.map +1 -0
- package/dist/types/i18n/Translator.d.ts +52 -0
- package/dist/types/i18n/Translator.d.ts.map +1 -0
- package/dist/types/i18n/extractStrings.d.ts +25 -0
- package/dist/types/i18n/extractStrings.d.ts.map +1 -0
- package/dist/types/i18n/formatMessage.d.ts +10 -0
- package/dist/types/i18n/formatMessage.d.ts.map +1 -0
- package/dist/types/index.d.ts +149 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/input/Actions.d.ts +94 -0
- package/dist/types/input/Actions.d.ts.map +1 -0
- package/dist/types/input/AimGesture.d.ts +106 -0
- package/dist/types/input/AimGesture.d.ts.map +1 -0
- package/dist/types/input/Keyboard.d.ts +30 -0
- package/dist/types/input/Keyboard.d.ts.map +1 -0
- package/dist/types/input/Keymap.d.ts +85 -0
- package/dist/types/input/Keymap.d.ts.map +1 -0
- package/dist/types/input/TargetLock.d.ts +56 -0
- package/dist/types/input/TargetLock.d.ts.map +1 -0
- package/dist/types/input/aimAxis.d.ts +9 -0
- package/dist/types/input/aimAxis.d.ts.map +1 -0
- package/dist/types/input/keyChord.d.ts +15 -0
- package/dist/types/input/keyChord.d.ts.map +1 -0
- package/dist/types/input/longPress.d.ts +21 -0
- package/dist/types/input/longPress.d.ts.map +1 -0
- package/dist/types/input/stickAxis.d.ts +26 -0
- package/dist/types/input/stickAxis.d.ts.map +1 -0
- package/dist/types/input/touchDetect.d.ts +18 -0
- package/dist/types/input/touchDetect.d.ts.map +1 -0
- package/dist/types/light/LightLayer.d.ts +65 -0
- package/dist/types/light/LightLayer.d.ts.map +1 -0
- package/dist/types/nav/MinHeap.d.ts +15 -0
- package/dist/types/nav/MinHeap.d.ts.map +1 -0
- package/dist/types/nav/findPath.d.ts +38 -0
- package/dist/types/nav/findPath.d.ts.map +1 -0
- package/dist/types/nav/navGrid.d.ts +48 -0
- package/dist/types/nav/navGrid.d.ts.map +1 -0
- package/dist/types/nav/nearestOpen.d.ts +8 -0
- package/dist/types/nav/nearestOpen.d.ts.map +1 -0
- package/dist/types/nav/straightenPath.d.ts +13 -0
- package/dist/types/nav/straightenPath.d.ts.map +1 -0
- package/dist/types/net/Connection.d.ts +66 -0
- package/dist/types/net/Connection.d.ts.map +1 -0
- package/dist/types/net/InterpolationBuffer.d.ts +36 -0
- package/dist/types/net/InterpolationBuffer.d.ts.map +1 -0
- package/dist/types/net/PredictedMover.d.ts +43 -0
- package/dist/types/net/PredictedMover.d.ts.map +1 -0
- package/dist/types/net/Room.d.ts +69 -0
- package/dist/types/net/Room.d.ts.map +1 -0
- package/dist/types/net/RoomHost.d.ts +74 -0
- package/dist/types/net/RoomHost.d.ts.map +1 -0
- package/dist/types/net/cadence.d.ts +22 -0
- package/dist/types/net/cadence.d.ts.map +1 -0
- package/dist/types/net/constants.d.ts +24 -0
- package/dist/types/net/constants.d.ts.map +1 -0
- package/dist/types/net/lobby/LobbyClient.d.ts +107 -0
- package/dist/types/net/lobby/LobbyClient.d.ts.map +1 -0
- package/dist/types/net/lobby/LobbyHost.d.ts +147 -0
- package/dist/types/net/lobby/LobbyHost.d.ts.map +1 -0
- package/dist/types/net/lobby/LobbyRooms.d.ts +56 -0
- package/dist/types/net/lobby/LobbyRooms.d.ts.map +1 -0
- package/dist/types/net/lobby/Matchmaker.d.ts +57 -0
- package/dist/types/net/lobby/Matchmaker.d.ts.map +1 -0
- package/dist/types/net/lobby/index.d.ts +6 -0
- package/dist/types/net/lobby/index.d.ts.map +1 -0
- package/dist/types/net/lobby/lobbyProtocol.d.ts +143 -0
- package/dist/types/net/lobby/lobbyProtocol.d.ts.map +1 -0
- package/dist/types/net/movement.d.ts +50 -0
- package/dist/types/net/movement.d.ts.map +1 -0
- package/dist/types/net/protocol.d.ts +59 -0
- package/dist/types/net/protocol.d.ts.map +1 -0
- package/dist/types/net/serverClock.d.ts +14 -0
- package/dist/types/net/serverClock.d.ts.map +1 -0
- package/dist/types/net/snapshotCodec.d.ts +55 -0
- package/dist/types/net/snapshotCodec.d.ts.map +1 -0
- package/dist/types/parallax/Parallax.d.ts +37 -0
- package/dist/types/parallax/Parallax.d.ts.map +1 -0
- package/dist/types/parallax/ParallaxLayer.d.ts +80 -0
- package/dist/types/parallax/ParallaxLayer.d.ts.map +1 -0
- package/dist/types/parallax/parallaxMath.d.ts +50 -0
- package/dist/types/parallax/parallaxMath.d.ts.map +1 -0
- package/dist/types/particles/Emitter.d.ts +97 -0
- package/dist/types/particles/Emitter.d.ts.map +1 -0
- package/dist/types/particles/ParticleBudget.d.ts +28 -0
- package/dist/types/particles/ParticleBudget.d.ts.map +1 -0
- package/dist/types/particles/ParticleSim.d.ts +38 -0
- package/dist/types/particles/ParticleSim.d.ts.map +1 -0
- package/dist/types/particles/particleCurves.d.ts +21 -0
- package/dist/types/particles/particleCurves.d.ts.map +1 -0
- package/dist/types/particles/particleSampling.d.ts +20 -0
- package/dist/types/particles/particleSampling.d.ts.map +1 -0
- package/dist/types/physics/Body.d.ts +130 -0
- package/dist/types/physics/Body.d.ts.map +1 -0
- package/dist/types/physics/BroadPhase.d.ts +26 -0
- package/dist/types/physics/BroadPhase.d.ts.map +1 -0
- package/dist/types/physics/Contact.d.ts +62 -0
- package/dist/types/physics/Contact.d.ts.map +1 -0
- package/dist/types/physics/ContactSolver.d.ts +29 -0
- package/dist/types/physics/ContactSolver.d.ts.map +1 -0
- package/dist/types/physics/PhysicsWorld.d.ts +78 -0
- package/dist/types/physics/PhysicsWorld.d.ts.map +1 -0
- package/dist/types/physics/PhysicsWorldOptions.d.ts +24 -0
- package/dist/types/physics/PhysicsWorldOptions.d.ts.map +1 -0
- package/dist/types/physics/SpatialHash.d.ts +23 -0
- package/dist/types/physics/SpatialHash.d.ts.map +1 -0
- package/dist/types/physics/collide.d.ts +27 -0
- package/dist/types/physics/collide.d.ts.map +1 -0
- package/dist/types/physics/collidePolygon.d.ts +14 -0
- package/dist/types/physics/collidePolygon.d.ts.map +1 -0
- package/dist/types/physics/contactReport.d.ts +8 -0
- package/dist/types/physics/contactReport.d.ts.map +1 -0
- package/dist/types/physics/drawColliders.d.ts +43 -0
- package/dist/types/physics/drawColliders.d.ts.map +1 -0
- package/dist/types/physics/physicsSystem.d.ts +5 -0
- package/dist/types/physics/physicsSystem.d.ts.map +1 -0
- package/dist/types/physics/polygon.d.ts +28 -0
- package/dist/types/physics/polygon.d.ts.map +1 -0
- package/dist/types/physics/raycast.d.ts +19 -0
- package/dist/types/physics/raycast.d.ts.map +1 -0
- package/dist/types/physics/syncToBody.d.ts +16 -0
- package/dist/types/physics/syncToBody.d.ts.map +1 -0
- package/dist/types/physics/tileBodies.d.ts +36 -0
- package/dist/types/physics/tileBodies.d.ts.map +1 -0
- package/dist/types/physics/types.d.ts +116 -0
- package/dist/types/physics/types.d.ts.map +1 -0
- package/dist/types/pixel/Darkness.d.ts +78 -0
- package/dist/types/pixel/Darkness.d.ts.map +1 -0
- package/dist/types/pixel/DitherVignette.d.ts +35 -0
- package/dist/types/pixel/DitherVignette.d.ts.map +1 -0
- package/dist/types/pixel/Evaporation.d.ts +30 -0
- package/dist/types/pixel/Evaporation.d.ts.map +1 -0
- package/dist/types/pixel/NightShade.d.ts +38 -0
- package/dist/types/pixel/NightShade.d.ts.map +1 -0
- package/dist/types/pixel/PixelLayer.d.ts +85 -0
- package/dist/types/pixel/PixelLayer.d.ts.map +1 -0
- package/dist/types/pixel/SwayProp.d.ts +52 -0
- package/dist/types/pixel/SwayProp.d.ts.map +1 -0
- package/dist/types/pixel/index.d.ts +31 -0
- package/dist/types/pixel/index.d.ts.map +1 -0
- package/dist/types/pixel/lights.d.ts +34 -0
- package/dist/types/pixel/lights.d.ts.map +1 -0
- package/dist/types/pixel/nineSlice.d.ts +71 -0
- package/dist/types/pixel/nineSlice.d.ts.map +1 -0
- package/dist/types/pixel/paintLayer.d.ts +35 -0
- package/dist/types/pixel/paintLayer.d.ts.map +1 -0
- package/dist/types/pixel/palette.d.ts +58 -0
- package/dist/types/pixel/palette.d.ts.map +1 -0
- package/dist/types/pixel/pixel.d.ts +80 -0
- package/dist/types/pixel/pixel.d.ts.map +1 -0
- package/dist/types/pixel/pixelPaint.d.ts +43 -0
- package/dist/types/pixel/pixelPaint.d.ts.map +1 -0
- package/dist/types/pixel/pixelTone.d.ts +51 -0
- package/dist/types/pixel/pixelTone.d.ts.map +1 -0
- package/dist/types/pixel/propKit.d.ts +26 -0
- package/dist/types/pixel/propKit.d.ts.map +1 -0
- package/dist/types/pixel/ramp.d.ts +57 -0
- package/dist/types/pixel/ramp.d.ts.map +1 -0
- package/dist/types/pixel/selout.d.ts +3 -0
- package/dist/types/pixel/selout.d.ts.map +1 -0
- package/dist/types/pixel/spritePixels.d.ts +29 -0
- package/dist/types/pixel/spritePixels.d.ts.map +1 -0
- package/dist/types/pixel/swayRig.d.ts +72 -0
- package/dist/types/pixel/swayRig.d.ts.map +1 -0
- package/dist/types/pixel/vignetteMask.d.ts +16 -0
- package/dist/types/pixel/vignetteMask.d.ts.map +1 -0
- package/dist/types/pixel/weatherArt.d.ts +29 -0
- package/dist/types/pixel/weatherArt.d.ts.map +1 -0
- package/dist/types/platform/touch.d.ts +10 -0
- package/dist/types/platform/touch.d.ts.map +1 -0
- package/dist/types/postfx/BloomFilter.d.ts +33 -0
- package/dist/types/postfx/BloomFilter.d.ts.map +1 -0
- package/dist/types/postfx/ChromaticAberrationFilter.d.ts +11 -0
- package/dist/types/postfx/ChromaticAberrationFilter.d.ts.map +1 -0
- package/dist/types/postfx/ColorAdjustFilter.d.ts +32 -0
- package/dist/types/postfx/ColorAdjustFilter.d.ts.map +1 -0
- package/dist/types/postfx/CrtFilter.d.ts +16 -0
- package/dist/types/postfx/CrtFilter.d.ts.map +1 -0
- package/dist/types/postfx/PixelateFilter.d.ts +8 -0
- package/dist/types/postfx/PixelateFilter.d.ts.map +1 -0
- package/dist/types/postfx/PostFx.d.ts +92 -0
- package/dist/types/postfx/PostFx.d.ts.map +1 -0
- package/dist/types/postfx/ShockwaveFilter.d.ts +20 -0
- package/dist/types/postfx/ShockwaveFilter.d.ts.map +1 -0
- package/dist/types/postfx/VignetteFilter.d.ts +19 -0
- package/dist/types/postfx/VignetteFilter.d.ts.map +1 -0
- package/dist/types/postfx/fxAnimator.d.ts +32 -0
- package/dist/types/postfx/fxAnimator.d.ts.map +1 -0
- package/dist/types/postfx/fxShader.d.ts +49 -0
- package/dist/types/postfx/fxShader.d.ts.map +1 -0
- package/dist/types/postfx/index.d.ts +11 -0
- package/dist/types/postfx/index.d.ts.map +1 -0
- package/dist/types/react/ChoiceDialog.d.ts +8 -0
- package/dist/types/react/ChoiceDialog.d.ts.map +1 -0
- package/dist/types/react/ConfirmDialog.d.ts +9 -0
- package/dist/types/react/ConfirmDialog.d.ts.map +1 -0
- package/dist/types/react/Glyph.d.ts +54 -0
- package/dist/types/react/Glyph.d.ts.map +1 -0
- package/dist/types/react/Modal.d.ts +22 -0
- package/dist/types/react/Modal.d.ts.map +1 -0
- package/dist/types/react/Panel.d.ts +29 -0
- package/dist/types/react/Panel.d.ts.map +1 -0
- package/dist/types/react/PixelImage.d.ts +19 -0
- package/dist/types/react/PixelImage.d.ts.map +1 -0
- package/dist/types/react/Select.d.ts +27 -0
- package/dist/types/react/Select.d.ts.map +1 -0
- package/dist/types/react/Slider.d.ts +24 -0
- package/dist/types/react/Slider.d.ts.map +1 -0
- package/dist/types/react/SplitPane.d.ts +26 -0
- package/dist/types/react/SplitPane.d.ts.map +1 -0
- package/dist/types/react/TabStrip.d.ts +31 -0
- package/dist/types/react/TabStrip.d.ts.map +1 -0
- package/dist/types/react/TitleTips.d.ts +15 -0
- package/dist/types/react/TitleTips.d.ts.map +1 -0
- package/dist/types/react/Tooltip.d.ts +22 -0
- package/dist/types/react/Tooltip.d.ts.map +1 -0
- package/dist/types/react/UiProvider.d.ts +52 -0
- package/dist/types/react/UiProvider.d.ts.map +1 -0
- package/dist/types/react/baseCss.d.ts +27 -0
- package/dist/types/react/baseCss.d.ts.map +1 -0
- package/dist/types/react/choiceStore.d.ts +34 -0
- package/dist/types/react/choiceStore.d.ts.map +1 -0
- package/dist/types/react/classNames.d.ts +12 -0
- package/dist/types/react/classNames.d.ts.map +1 -0
- package/dist/types/react/confirmStore.d.ts +30 -0
- package/dist/types/react/confirmStore.d.ts.map +1 -0
- package/dist/types/react/index.d.ts +33 -0
- package/dist/types/react/index.d.ts.map +1 -0
- package/dist/types/react/labels.d.ts +24 -0
- package/dist/types/react/labels.d.ts.map +1 -0
- package/dist/types/react/placement.d.ts +59 -0
- package/dist/types/react/placement.d.ts.map +1 -0
- package/dist/types/react/useFillSheet.d.ts +9 -0
- package/dist/types/react/useFillSheet.d.ts.map +1 -0
- package/dist/types/react/useFitToViewport.d.ts +20 -0
- package/dist/types/react/useFitToViewport.d.ts.map +1 -0
- package/dist/types/react/usePicked.d.ts +9 -0
- package/dist/types/react/usePicked.d.ts.map +1 -0
- package/dist/types/react/useStore.d.ts +8 -0
- package/dist/types/react/useStore.d.ts.map +1 -0
- package/dist/types/react/useViewport.d.ts +4 -0
- package/dist/types/react/useViewport.d.ts.map +1 -0
- package/dist/types/rig/PosePlayer.d.ts +64 -0
- package/dist/types/rig/PosePlayer.d.ts.map +1 -0
- package/dist/types/rig/RigView.d.ts +68 -0
- package/dist/types/rig/RigView.d.ts.map +1 -0
- package/dist/types/rig/Skeleton.d.ts +14 -0
- package/dist/types/rig/Skeleton.d.ts.map +1 -0
- package/dist/types/rig/humanoid.d.ts +4 -0
- package/dist/types/rig/humanoid.d.ts.map +1 -0
- package/dist/types/rig/humanoidPoses.d.ts +117 -0
- package/dist/types/rig/humanoidPoses.d.ts.map +1 -0
- package/dist/types/rig/poseMath.d.ts +14 -0
- package/dist/types/rig/poseMath.d.ts.map +1 -0
- package/dist/types/rig/rigTypes.d.ts +82 -0
- package/dist/types/rig/rigTypes.d.ts.map +1 -0
- package/dist/types/save/Autosaver.d.ts +43 -0
- package/dist/types/save/Autosaver.d.ts.map +1 -0
- package/dist/types/save/MemoryBackend.d.ts +10 -0
- package/dist/types/save/MemoryBackend.d.ts.map +1 -0
- package/dist/types/save/SaveBackend.d.ts +14 -0
- package/dist/types/save/SaveBackend.d.ts.map +1 -0
- package/dist/types/save/SaveStore.d.ts +73 -0
- package/dist/types/save/SaveStore.d.ts.map +1 -0
- package/dist/types/save/WebStorageBackend.d.ts +14 -0
- package/dist/types/save/WebStorageBackend.d.ts.map +1 -0
- package/dist/types/save/checksum.d.ts +7 -0
- package/dist/types/save/checksum.d.ts.map +1 -0
- package/dist/types/save/migrateSave.d.ts +17 -0
- package/dist/types/save/migrateSave.d.ts.map +1 -0
- package/dist/types/settings.d.ts +25 -0
- package/dist/types/settings.d.ts.map +1 -0
- package/dist/types/tilemap/TilemapView.d.ts +42 -0
- package/dist/types/tilemap/TilemapView.d.ts.map +1 -0
- package/dist/types/tilemap/collision.d.ts +16 -0
- package/dist/types/tilemap/collision.d.ts.map +1 -0
- package/dist/types/tilemap/tiled.d.ts +104 -0
- package/dist/types/tilemap/tiled.d.ts.map +1 -0
- package/dist/types/transitions/CrossfadeTransition.d.ts +20 -0
- package/dist/types/transitions/CrossfadeTransition.d.ts.map +1 -0
- package/dist/types/transitions/DitherWipeTransition.d.ts +35 -0
- package/dist/types/transitions/DitherWipeTransition.d.ts.map +1 -0
- package/dist/types/transitions/FadeTransition.d.ts +20 -0
- package/dist/types/transitions/FadeTransition.d.ts.map +1 -0
- package/dist/types/transitions/Letterbox.d.ts +33 -0
- package/dist/types/transitions/Letterbox.d.ts.map +1 -0
- package/dist/types/transitions/Transition.d.ts +22 -0
- package/dist/types/transitions/Transition.d.ts.map +1 -0
- package/dist/types/transitions/ditherMask.d.ts +13 -0
- package/dist/types/transitions/ditherMask.d.ts.map +1 -0
- package/dist/types/transitions/transitionTo.d.ts +16 -0
- package/dist/types/transitions/transitionTo.d.ts.map +1 -0
- package/dist/types/transitions/tweenDone.d.ts +5 -0
- package/dist/types/transitions/tweenDone.d.ts.map +1 -0
- package/dist/types/ui/Bar.d.ts +41 -0
- package/dist/types/ui/Bar.d.ts.map +1 -0
- package/dist/types/ui/Button.d.ts +47 -0
- package/dist/types/ui/Button.d.ts.map +1 -0
- package/dist/types/ui/Dialog.d.ts +47 -0
- package/dist/types/ui/Dialog.d.ts.map +1 -0
- package/dist/types/ui/FocusManager.d.ts +53 -0
- package/dist/types/ui/FocusManager.d.ts.map +1 -0
- package/dist/types/ui/Label.d.ts +24 -0
- package/dist/types/ui/Label.d.ts.map +1 -0
- package/dist/types/ui/List.d.ts +23 -0
- package/dist/types/ui/List.d.ts.map +1 -0
- package/dist/types/ui/Panel.d.ts +38 -0
- package/dist/types/ui/Panel.d.ts.map +1 -0
- package/dist/types/ui/ScrollView.d.ts +56 -0
- package/dist/types/ui/ScrollView.d.ts.map +1 -0
- package/dist/types/ui/Slider.d.ts +47 -0
- package/dist/types/ui/Slider.d.ts.map +1 -0
- package/dist/types/ui/Stack.d.ts +16 -0
- package/dist/types/ui/Stack.d.ts.map +1 -0
- package/dist/types/ui/Toggle.d.ts +31 -0
- package/dist/types/ui/Toggle.d.ts.map +1 -0
- package/dist/types/ui/UiHost.d.ts +18 -0
- package/dist/types/ui/UiHost.d.ts.map +1 -0
- package/dist/types/ui/UiPointerGate.d.ts +17 -0
- package/dist/types/ui/UiPointerGate.d.ts.map +1 -0
- package/dist/types/ui/UiRoot.d.ts +73 -0
- package/dist/types/ui/UiRoot.d.ts.map +1 -0
- package/dist/types/ui/Widget.d.ts +56 -0
- package/dist/types/ui/Widget.d.ts.map +1 -0
- package/dist/types/ui/dom/DomOverlay.d.ts +52 -0
- package/dist/types/ui/dom/DomOverlay.d.ts.map +1 -0
- package/dist/types/ui/dom/DomWorldAnchors.d.ts +50 -0
- package/dist/types/ui/dom/DomWorldAnchors.d.ts.map +1 -0
- package/dist/types/ui/dom/InputShield.d.ts +20 -0
- package/dist/types/ui/dom/InputShield.d.ts.map +1 -0
- package/dist/types/ui/dom/createStore.d.ts +22 -0
- package/dist/types/ui/dom/createStore.d.ts.map +1 -0
- package/dist/types/ui/dom/shieldDecision.d.ts +34 -0
- package/dist/types/ui/dom/shieldDecision.d.ts.map +1 -0
- package/dist/types/ui/dom/worldToScreen.d.ts +24 -0
- package/dist/types/ui/dom/worldToScreen.d.ts.map +1 -0
- package/dist/types/ui/index.d.ts +38 -0
- package/dist/types/ui/index.d.ts.map +1 -0
- package/dist/types/ui/layout/anchor.d.ts +9 -0
- package/dist/types/ui/layout/anchor.d.ts.map +1 -0
- package/dist/types/ui/layout/barDrain.d.ts +25 -0
- package/dist/types/ui/layout/barDrain.d.ts.map +1 -0
- package/dist/types/ui/layout/fitToViewport.d.ts +32 -0
- package/dist/types/ui/layout/fitToViewport.d.ts.map +1 -0
- package/dist/types/ui/layout/focusNav.d.ts +13 -0
- package/dist/types/ui/layout/focusNav.d.ts.map +1 -0
- package/dist/types/ui/layout/geometry.d.ts +35 -0
- package/dist/types/ui/layout/geometry.d.ts.map +1 -0
- package/dist/types/ui/layout/listWidth.d.ts +13 -0
- package/dist/types/ui/layout/listWidth.d.ts.map +1 -0
- package/dist/types/ui/layout/placeTooltip.d.ts +23 -0
- package/dist/types/ui/layout/placeTooltip.d.ts.map +1 -0
- package/dist/types/ui/layout/scroll.d.ts +17 -0
- package/dist/types/ui/layout/scroll.d.ts.map +1 -0
- package/dist/types/ui/layout/slider.d.ts +7 -0
- package/dist/types/ui/layout/slider.d.ts.map +1 -0
- package/dist/types/ui/layout/stack.d.ts +26 -0
- package/dist/types/ui/layout/stack.d.ts.map +1 -0
- package/dist/types/ui/layout/wrapRow.d.ts +6 -0
- package/dist/types/ui/layout/wrapRow.d.ts.map +1 -0
- package/dist/ui/Bar.js +54 -0
- package/dist/ui/Bar.js.map +1 -0
- package/dist/ui/Button.js +58 -0
- package/dist/ui/Button.js.map +1 -0
- package/dist/ui/Dialog.js +56 -0
- package/dist/ui/Dialog.js.map +1 -0
- package/dist/ui/FocusManager.js +97 -0
- package/dist/ui/FocusManager.js.map +1 -0
- package/dist/ui/Label.js +36 -0
- package/dist/ui/Label.js.map +1 -0
- package/dist/ui/List.js +45 -0
- package/dist/ui/List.js.map +1 -0
- package/dist/ui/Panel.js +38 -0
- package/dist/ui/Panel.js.map +1 -0
- package/dist/ui/ScrollView.js +96 -0
- package/dist/ui/ScrollView.js.map +1 -0
- package/dist/ui/Slider.js +55 -0
- package/dist/ui/Slider.js.map +1 -0
- package/dist/ui/Stack.js +28 -0
- package/dist/ui/Stack.js.map +1 -0
- package/dist/ui/Toggle.js +37 -0
- package/dist/ui/Toggle.js.map +1 -0
- package/dist/ui/UiHost.js +9 -0
- package/dist/ui/UiHost.js.map +1 -0
- package/dist/ui/UiPointerGate.js +25 -0
- package/dist/ui/UiPointerGate.js.map +1 -0
- package/dist/ui/UiRoot.js +93 -0
- package/dist/ui/UiRoot.js.map +1 -0
- package/dist/ui/Widget.js +90 -0
- package/dist/ui/Widget.js.map +1 -0
- package/dist/ui/dom/DomOverlay.js +59 -0
- package/dist/ui/dom/DomOverlay.js.map +1 -0
- package/dist/ui/dom/DomWorldAnchors.js +59 -0
- package/dist/ui/dom/DomWorldAnchors.js.map +1 -0
- package/dist/ui/dom/InputShield.js +27 -0
- package/dist/ui/dom/InputShield.js.map +1 -0
- package/dist/ui/dom/createStore.js +42 -0
- package/dist/ui/dom/createStore.js.map +1 -0
- package/dist/ui/dom/shieldDecision.js +36 -0
- package/dist/ui/dom/shieldDecision.js.map +1 -0
- package/dist/ui/dom/worldToScreen.js +11 -0
- package/dist/ui/dom/worldToScreen.js.map +1 -0
- package/dist/ui/layout/anchor.js +20 -0
- package/dist/ui/layout/anchor.js.map +1 -0
- package/dist/ui/layout/barDrain.js +25 -0
- package/dist/ui/layout/barDrain.js.map +1 -0
- package/dist/ui/layout/fitToViewport.js +17 -0
- package/dist/ui/layout/fitToViewport.js.map +1 -0
- package/dist/ui/layout/focusNav.js +42 -0
- package/dist/ui/layout/focusNav.js.map +1 -0
- package/dist/ui/layout/geometry.js +21 -0
- package/dist/ui/layout/geometry.js.map +1 -0
- package/dist/ui/layout/listWidth.js +10 -0
- package/dist/ui/layout/listWidth.js.map +1 -0
- package/dist/ui/layout/placeTooltip.js +28 -0
- package/dist/ui/layout/placeTooltip.js.map +1 -0
- package/dist/ui/layout/scroll.js +24 -0
- package/dist/ui/layout/scroll.js.map +1 -0
- package/dist/ui/layout/slider.js +20 -0
- package/dist/ui/layout/slider.js.map +1 -0
- package/dist/ui/layout/stack.js +27 -0
- package/dist/ui/layout/stack.js.map +1 -0
- package/dist/ui/layout/wrapRow.js +13 -0
- package/dist/ui/layout/wrapRow.js.map +1 -0
- package/dist/ui.js +85 -0
- package/dist/ui.js.map +1 -0
- package/package.json +115 -4
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { shade as R, mix as T, channels as $, rgba as x } from "./pixel.js";
|
|
2
|
+
const d = {
|
|
3
|
+
// wool and linen: violet shadows, faintly warm lights
|
|
4
|
+
cloth: { cool: 255, coolDeg: 14, coolSat: 0.06, warm: 50, warmDeg: 6 },
|
|
5
|
+
// hide: its shadows go red-brown, never grey
|
|
6
|
+
leather: { cool: 8, coolDeg: 12, coolSat: 0.08, warm: 45, warmDeg: 8 },
|
|
7
|
+
// steel: blue shadows, lights close to white
|
|
8
|
+
mail: { cool: 232, coolDeg: 16, coolSat: 0.07, warm: 52, warmDeg: 4 },
|
|
9
|
+
plate: { cool: 235, coolDeg: 18, coolSat: 0.08, warm: 50, warmDeg: 6 },
|
|
10
|
+
// scale: crimson-violet shadows, ember-orange lights
|
|
11
|
+
dragon: { cool: 330, coolDeg: 16, coolSat: 0.06, warm: 36, warmDeg: 12 },
|
|
12
|
+
fur: { cool: 262, coolDeg: 10, coolSat: 0.04, warm: 48, warmDeg: 6 },
|
|
13
|
+
// skin: shadows go to blood-red, never to grey or green
|
|
14
|
+
skin: { cool: 350, coolDeg: 14, coolSat: 0.09, warm: 42, warmDeg: 5 },
|
|
15
|
+
hair: { cool: 262, coolDeg: 14, coolSat: 0.05, warm: 46, warmDeg: 10 },
|
|
16
|
+
gold: { cool: 14, coolDeg: 14, coolSat: 0.05, warm: 58, warmDeg: 8 },
|
|
17
|
+
gem: { cool: 262, coolDeg: 8, coolSat: 0.02, warm: 50, warmDeg: 2 },
|
|
18
|
+
// the side turned away from the light, whatever it is made of (the far limbs)
|
|
19
|
+
shadow: { cool: 255, coolDeg: 12, coolSat: 0.04, warm: 50, warmDeg: 0 }
|
|
20
|
+
}, D = {
|
|
21
|
+
cloth: [0.5, 0.66, 0.82, 1.12, 1.25],
|
|
22
|
+
leather: [0.46, 0.62, 0.8, 1.16, 1.3],
|
|
23
|
+
mail: [0.44, 0.6, 0.78, 1.22, 1.42],
|
|
24
|
+
plate: [0.44, 0.56, 0.72, 1.2, 1.45],
|
|
25
|
+
dragon: [0.42, 0.56, 0.74, 1.14, 1.32],
|
|
26
|
+
fur: [0.56, 0.7, 0.84, 1.15, 1.26],
|
|
27
|
+
skin: [0.6, 0.72, 0.86, 1.12, 1.24],
|
|
28
|
+
hair: [0.5, 0.66, 0.8, 1.2, 1.36],
|
|
29
|
+
gold: [0.42, 0.62, 0.8, 1.3, 1.5],
|
|
30
|
+
gem: [0.32, 0.5, 0.78, 1.45, 1.65],
|
|
31
|
+
shadow: [0.5, 0.66, 0.82, 1.12, 1.25]
|
|
32
|
+
}, b = Object.keys(d), E = [...new Set(Object.values(D).flat())];
|
|
33
|
+
function _(t, c) {
|
|
34
|
+
d[t] = c.light, D[t] = c.factors, b.includes(t) || b.push(t);
|
|
35
|
+
const o = E;
|
|
36
|
+
for (const e of c.factors) o.includes(e) || o.push(e);
|
|
37
|
+
for (const e of [p, k]) for (const n of [...e.keys()]) n.endsWith(`:${t}`) && e.delete(n);
|
|
38
|
+
}
|
|
39
|
+
const C = (t) => d[t] ?? d.cloth, H = (t) => D[t] ?? D.cloth;
|
|
40
|
+
function M(t) {
|
|
41
|
+
const [c, o, e] = $(t), n = Math.max(c, o, e), l = Math.min(c, o, e), r = n - l;
|
|
42
|
+
let a = 0;
|
|
43
|
+
return r > 0 && (n === c ? a = ((o - e) / r + 6) % 6 : n === o ? a = (e - c) / r + 2 : a = (c - o) / r + 4), [a * 60, n === 0 ? 0 : r / n, n / 255];
|
|
44
|
+
}
|
|
45
|
+
function w(t, c, o, e) {
|
|
46
|
+
const n = (t % 360 + 360) % 360 / 60, l = Math.floor(n), r = n - l, a = o * (1 - c), s = o * (1 - c * r), i = o * (1 - c * (1 - r)), [g, u, m] = [[o, i, a], [s, o, a], [a, o, i], [a, s, o], [i, a, o], [o, a, s]][l % 6];
|
|
47
|
+
return x(g * 255, u * 255, m * 255, e);
|
|
48
|
+
}
|
|
49
|
+
function A(t, c, o) {
|
|
50
|
+
let e = c - t;
|
|
51
|
+
return e > 180 && (e -= 360), e < -180 && (e += 360), t + Math.sign(e) * Math.min(Math.abs(e), o);
|
|
52
|
+
}
|
|
53
|
+
const h = (t) => Math.max(0, Math.min(1, t)), p = /* @__PURE__ */ new Map();
|
|
54
|
+
function y(t, c, o) {
|
|
55
|
+
if (c === 1) return t;
|
|
56
|
+
const e = `${t}:${c}:${o}`;
|
|
57
|
+
let n = p.get(e);
|
|
58
|
+
if (n !== void 0) return n;
|
|
59
|
+
const l = C(o), r = R(t, c), [a, s, i] = M(r), g = r >>> 24, u = h(1 - M(t)[1] / 0.14);
|
|
60
|
+
let m, S;
|
|
61
|
+
if (c < 1) {
|
|
62
|
+
const f = (1 - c) / 0.5;
|
|
63
|
+
m = w(A(a, l.cool, l.coolDeg * f), h(s + l.coolSat * f), i, g), S = w(l.cool, h(s + l.coolSat * f * 1.2), i, g);
|
|
64
|
+
} else {
|
|
65
|
+
const f = Math.min(1.5, (c - 1) / 0.3);
|
|
66
|
+
m = w(A(a, l.warm, l.warmDeg * f), h(s * 1.08), i, g), S = w(l.warm, h(s + 0.03 * f), i, g);
|
|
67
|
+
}
|
|
68
|
+
return n = u > 0 ? T(m, S, u) : m, p.set(e, n), n;
|
|
69
|
+
}
|
|
70
|
+
const k = /* @__PURE__ */ new Map();
|
|
71
|
+
function P(t, c) {
|
|
72
|
+
const o = `${t}:${c}`;
|
|
73
|
+
let e = k.get(o);
|
|
74
|
+
if (!e) {
|
|
75
|
+
const [n, l, r, a, s] = H(c).map((i) => y(t, i, c));
|
|
76
|
+
e = { deep: n, dark: l, mid: r, base: t, light: a, glint: s }, k.set(o, e);
|
|
77
|
+
}
|
|
78
|
+
return e;
|
|
79
|
+
}
|
|
80
|
+
function j(t, c) {
|
|
81
|
+
const o = P(t, c);
|
|
82
|
+
return [o.deep, o.dark, o.mid, o.base, o.light, o.glint];
|
|
83
|
+
}
|
|
84
|
+
const O = /* @__PURE__ */ new Map();
|
|
85
|
+
function F(t) {
|
|
86
|
+
let c = O.get(t);
|
|
87
|
+
if (c === void 0) {
|
|
88
|
+
const [o, e, n] = M(y(t, 0.42, "shadow"));
|
|
89
|
+
c = w(o, h(e * 1.1 + 0.08), Math.min(n, 0.3), 255), O.set(t, c);
|
|
90
|
+
}
|
|
91
|
+
return c;
|
|
92
|
+
}
|
|
93
|
+
export {
|
|
94
|
+
b as MATERIALS,
|
|
95
|
+
E as RAMP_FACTOR_SET,
|
|
96
|
+
y as hueShade,
|
|
97
|
+
F as outlineOf,
|
|
98
|
+
P as ramp,
|
|
99
|
+
j as rampTones,
|
|
100
|
+
_ as registerMaterial
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=ramp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ramp.js","sources":["../../src/pixel/ramp.ts"],"sourcesContent":["import { type Color, channels, mix, rgba, shade } from './pixel';\n\n/*\n * Hue-shifted ramps: the one place a character's colours get their shadows and lights. A small pixel body cannot get\n * detail from extra pixels, so it gets it from colour — a shadow that only darkens reads as dirt, a light that only\n * whitens reads as chalk. Here a shadow drifts toward its material's cool (or, for skin and leather, warm red) hue\n * and gains a little saturation; a light drifts toward warm yellow and loses a little. Everything the rig paints\n * goes through `hueShade`.\n *\n * The materials below are built in; a game adds its own (glass, slime, bark…) with `registerMaterial`, or changes how a\n * built-in one shades by registering it again. A material nobody registered shades as cloth.\n */\n\n/** The materials every game starts with. */\nexport type BuiltinMaterial = 'cloth' | 'leather' | 'mail' | 'plate' | 'dragon' | 'fur' | 'skin' | 'hair' | 'gold' | 'gem' | 'shadow';\n/** A built-in material or one a game registered (`registerMaterial`). */\nexport type Material = BuiltinMaterial | (string & {});\n\n/** How a material's shadows and lights move its hue. */\nexport interface MaterialLight {\n /** Hue (degrees) a shadow drifts toward, and how far it drifts at a factor of 0.5. */\n cool: number;\n coolDeg: number;\n /** Saturation a shadow gains at a factor of 0.5. */\n coolSat: number;\n /** Hue a light drifts toward, and how far it drifts at a factor of 1.3. */\n warm: number;\n warmDeg: number;\n}\n\nconst LIGHT: Record<string, MaterialLight> = {\n // wool and linen: violet shadows, faintly warm lights\n cloth: { cool: 255, coolDeg: 14, coolSat: 0.06, warm: 50, warmDeg: 6 },\n // hide: its shadows go red-brown, never grey\n leather: { cool: 8, coolDeg: 12, coolSat: 0.08, warm: 45, warmDeg: 8 },\n // steel: blue shadows, lights close to white\n mail: { cool: 232, coolDeg: 16, coolSat: 0.07, warm: 52, warmDeg: 4 },\n plate: { cool: 235, coolDeg: 18, coolSat: 0.08, warm: 50, warmDeg: 6 },\n // scale: crimson-violet shadows, ember-orange lights\n dragon: { cool: 330, coolDeg: 16, coolSat: 0.06, warm: 36, warmDeg: 12 },\n fur: { cool: 262, coolDeg: 10, coolSat: 0.04, warm: 48, warmDeg: 6 },\n // skin: shadows go to blood-red, never to grey or green\n skin: { cool: 350, coolDeg: 14, coolSat: 0.09, warm: 42, warmDeg: 5 },\n hair: { cool: 262, coolDeg: 14, coolSat: 0.05, warm: 46, warmDeg: 10 },\n gold: { cool: 14, coolDeg: 14, coolSat: 0.05, warm: 58, warmDeg: 8 },\n gem: { cool: 262, coolDeg: 8, coolSat: 0.02, warm: 50, warmDeg: 2 },\n // the side turned away from the light, whatever it is made of (the far limbs)\n shadow: { cool: 255, coolDeg: 12, coolSat: 0.04, warm: 50, warmDeg: 0 },\n};\n\n/** Tones of one colour in one material, darkest to brightest. `base` is the colour itself. */\nexport interface Ramp {\n /** Under-edges, rivets, seams: the darkest tone that is still the material. */\n deep: Color;\n dark: Color;\n mid: Color;\n base: Color;\n light: Color;\n /** One specular pixel: a plate's glint, a strand of hair, a buckle. */\n glint: Color;\n}\n\n/** Five shading factors, darkest to brightest. */\nexport type RampFactors = [number, number, number, number, number];\n\n/** The factors each material's ramp is built from: metal is contrasty, fur and skin are soft. */\nconst RAMP_FACTORS: Record<string, RampFactors> = {\n cloth: [0.5, 0.66, 0.82, 1.12, 1.25],\n leather: [0.46, 0.62, 0.8, 1.16, 1.3],\n mail: [0.44, 0.6, 0.78, 1.22, 1.42],\n plate: [0.44, 0.56, 0.72, 1.2, 1.45],\n dragon: [0.42, 0.56, 0.74, 1.14, 1.32],\n fur: [0.56, 0.7, 0.84, 1.15, 1.26],\n skin: [0.6, 0.72, 0.86, 1.12, 1.24],\n hair: [0.5, 0.66, 0.8, 1.2, 1.36],\n gold: [0.42, 0.62, 0.8, 1.3, 1.5],\n gem: [0.32, 0.5, 0.78, 1.45, 1.65],\n shadow: [0.5, 0.66, 0.82, 1.12, 1.25],\n};\n\n/** Every registered material, built-in ones first. */\nexport const MATERIALS: readonly Material[] = Object.keys(LIGHT);\n\n/** Every factor a ramp or a painter shades by — what a recolour or a fine-pass mask has to recognise. */\nexport const RAMP_FACTOR_SET: readonly number[] = [...new Set(Object.values(RAMP_FACTORS).flat())];\n\n/**\n * Adds a material, or changes a built-in one: how its shadows and lights drift (`light`) and the five factors its\n * ramp is built from, darkest to brightest (`factors`, around 1: below darkens, above lifts). Register before painting\n * with it; tones already worked out for that material are forgotten.\n */\nexport function registerMaterial(name: string, material: { light: MaterialLight; factors: RampFactors }): void {\n LIGHT[name] = material.light;\n RAMP_FACTORS[name] = material.factors;\n if (!(MATERIALS as Material[]).includes(name)) (MATERIALS as Material[]).push(name);\n const factors = RAMP_FACTOR_SET as number[];\n for (const f of material.factors) if (!factors.includes(f)) factors.push(f);\n for (const cache of [CACHE, RAMPS] as Map<string, unknown>[]) for (const key of [...cache.keys()]) if (key.endsWith(`:${name}`)) cache.delete(key);\n}\n\nconst lightOf = (m: Material): MaterialLight => LIGHT[m] ?? LIGHT.cloth!;\nconst factorsOf = (m: Material): RampFactors => RAMP_FACTORS[m] ?? RAMP_FACTORS.cloth!;\n\nfunction toHsv(c: Color): [number, number, number] {\n const [r, g, b] = channels(c);\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n const d = max - min;\n let h = 0;\n if (d > 0) {\n if (max === r) h = ((g - b) / d + 6) % 6;\n else if (max === g) h = (b - r) / d + 2;\n else h = (r - g) / d + 4;\n }\n return [h * 60, max === 0 ? 0 : d / max, max / 255];\n}\n\nfunction fromHsv(h: number, s: number, v: number, a: number): Color {\n const hh = (((h % 360) + 360) % 360) / 60;\n const i = Math.floor(hh);\n const f = hh - i;\n const p = v * (1 - s);\n const q = v * (1 - s * f);\n const t = v * (1 - s * (1 - f));\n const [r, g, b] = [[v, t, p], [q, v, p], [p, v, t], [p, q, v], [t, p, v], [v, p, q]][i % 6]!;\n return rgba(r! * 255, g! * 255, b! * 255, a);\n}\n\n/** Hue `h` moved up to `deg` degrees toward `target`, the short way round. */\nfunction drift(h: number, target: number, deg: number): number {\n let d = target - h;\n if (d > 180) d -= 360;\n if (d < -180) d += 360;\n return h + Math.sign(d) * Math.min(Math.abs(d), deg);\n}\n\nconst clamp01 = (x: number) => Math.max(0, Math.min(1, x));\nconst CACHE = new Map<string, Color>();\n\n/**\n * `c` shaded by `f` the way `shade` would (f < 1 darkens, f > 1 lifts toward white), with the hue moved the way\n * `material` moves it. `f === 1` returns `c` itself. A colour with too little saturation to have a hue (steel,\n * grey wool, white linen) takes the material's hue outright, faintly, so a grey coat still has a violet shadow.\n */\nexport function hueShade(c: Color, f: number, material: Material): Color {\n if (f === 1) return c;\n const key = `${c}:${f}:${material}`;\n let out = CACHE.get(key);\n if (out !== undefined) return out;\n const L = lightOf(material);\n const plain = shade(c, f);\n const [h, s, v] = toHsv(plain);\n const a = plain >>> 24;\n // how grey the colour is: a grey has no hue of its own to move, so it is tinted with the target hue instead —\n // drifting a grey's accidental hue partway round the wheel is how steel turned green in its lights\n const grey = clamp01(1 - toHsv(c)[1] / 0.14);\n let coloured: Color;\n let tinted: Color;\n if (f < 1) {\n const k = (1 - f) / 0.5;\n coloured = fromHsv(drift(h, L.cool, L.coolDeg * k), clamp01(s + L.coolSat * k), v, a);\n tinted = fromHsv(L.cool, clamp01(s + L.coolSat * k * 1.2), v, a);\n } else {\n const k = Math.min(1.5, (f - 1) / 0.3);\n // lifting toward white bleaches; a warm light keeps a little of its colour back\n coloured = fromHsv(drift(h, L.warm, L.warmDeg * k), clamp01(s * 1.08), v, a);\n tinted = fromHsv(L.warm, clamp01(s + 0.03 * k), v, a);\n }\n out = grey > 0 ? mix(coloured, tinted, grey) : coloured;\n CACHE.set(key, out);\n return out;\n}\n\nconst RAMPS = new Map<string, Ramp>();\n\nexport function ramp(c: Color, material: Material): Ramp {\n const key = `${c}:${material}`;\n let r = RAMPS.get(key);\n if (!r) {\n const [deep, dark, mid, light, glint] = factorsOf(material).map((f) => hueShade(c, f, material)) as [Color, Color, Color, Color, Color];\n r = { deep, dark, mid, base: c, light, glint };\n RAMPS.set(key, r);\n }\n return r;\n}\n\n/** Every tone of `c`'s ramp, for masking a material cue to that material. */\nexport function rampTones(c: Color, material: Material): Color[] {\n const r = ramp(c, material);\n return [r.deep, r.dark, r.mid, r.base, r.light, r.glint];\n}\n\nconst DEEP = new Map<Color, Color>();\n\n/**\n * The selective-outline tone of a fill: its own hue, cooled and pushed dark enough to hold an edge against grass\n * (value at most 0.3), so the outline on the lit side is the fill's own darkest shade instead of flat black.\n */\nexport function outlineOf(c: Color): Color {\n let d = DEEP.get(c);\n if (d === undefined) {\n const [h, s, v] = toHsv(hueShade(c, 0.42, 'shadow'));\n d = fromHsv(h, clamp01(s * 1.1 + 0.08), Math.min(v, 0.3), 255);\n DEEP.set(c, d);\n }\n return d;\n}\n"],"names":["LIGHT","RAMP_FACTORS","MATERIALS","RAMP_FACTOR_SET","registerMaterial","name","material","factors","f","cache","CACHE","RAMPS","key","lightOf","m","factorsOf","toHsv","c","r","g","b","channels","max","min","d","h","fromHsv","s","v","a","hh","i","p","q","t","rgba","drift","target","deg","clamp01","x","hueShade","out","L","plain","shade","grey","coloured","tinted","k","mix","ramp","deep","dark","mid","light","glint","rampTones","DEEP","outlineOf"],"mappings":";AA8BA,MAAMA,IAAuC;AAAA;AAAA,EAE3C,OAAO,EAAE,MAAM,KAAK,SAAS,IAAI,SAAS,MAAM,MAAM,IAAI,SAAS,EAAA;AAAA;AAAA,EAEnE,SAAS,EAAE,MAAM,GAAG,SAAS,IAAI,SAAS,MAAM,MAAM,IAAI,SAAS,EAAA;AAAA;AAAA,EAEnE,MAAM,EAAE,MAAM,KAAK,SAAS,IAAI,SAAS,MAAM,MAAM,IAAI,SAAS,EAAA;AAAA,EAClE,OAAO,EAAE,MAAM,KAAK,SAAS,IAAI,SAAS,MAAM,MAAM,IAAI,SAAS,EAAA;AAAA;AAAA,EAEnE,QAAQ,EAAE,MAAM,KAAK,SAAS,IAAI,SAAS,MAAM,MAAM,IAAI,SAAS,GAAA;AAAA,EACpE,KAAK,EAAE,MAAM,KAAK,SAAS,IAAI,SAAS,MAAM,MAAM,IAAI,SAAS,EAAA;AAAA;AAAA,EAEjE,MAAM,EAAE,MAAM,KAAK,SAAS,IAAI,SAAS,MAAM,MAAM,IAAI,SAAS,EAAA;AAAA,EAClE,MAAM,EAAE,MAAM,KAAK,SAAS,IAAI,SAAS,MAAM,MAAM,IAAI,SAAS,GAAA;AAAA,EAClE,MAAM,EAAE,MAAM,IAAI,SAAS,IAAI,SAAS,MAAM,MAAM,IAAI,SAAS,EAAA;AAAA,EACjE,KAAK,EAAE,MAAM,KAAK,SAAS,GAAG,SAAS,MAAM,MAAM,IAAI,SAAS,EAAA;AAAA;AA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C;AAAA,EACf;AACA,SAAOA;AACT;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { P as d } from "./palette.js";
|
|
2
|
+
import { outlineOf as v } from "./ramp.js";
|
|
3
|
+
function P(w, g = 1, M = d.outline) {
|
|
4
|
+
const { w: n, h: c, data: f } = w, i = new Uint8Array(f.length);
|
|
5
|
+
let m = n, p = c, h = -1, y = -1;
|
|
6
|
+
for (let o = 0; o < c; o++) {
|
|
7
|
+
const e = o * n;
|
|
8
|
+
for (let t = 0; t < n; t++)
|
|
9
|
+
f[e + t] >>> 24 && (i[e + t] = 1, t < m && (m = t), t > h && (h = t), o < p && (p = o), y = o);
|
|
10
|
+
}
|
|
11
|
+
if (h < 0) return;
|
|
12
|
+
let s = [];
|
|
13
|
+
for (let o = Math.max(0, p - 1); o <= Math.min(c - 1, y + 1); o++)
|
|
14
|
+
for (let e = Math.max(0, m - 1); e <= Math.min(n - 1, h + 1); e++) {
|
|
15
|
+
const t = o * n + e;
|
|
16
|
+
if (i[t]) continue;
|
|
17
|
+
const l = o > 0 && i[t - n] === 1, a = e + 1 < n && i[t + 1] === 1, u = e > 0 && i[t - 1] === 1, r = o + 1 < c && i[t + n] === 1;
|
|
18
|
+
(l || a || u || r) && (f[t] = l || a ? M : v(f[u ? t - 1 : t + n]), s.push(t));
|
|
19
|
+
}
|
|
20
|
+
for (const o of s) i[o] = 1;
|
|
21
|
+
for (let o = 1; o < g && s.length; o++) {
|
|
22
|
+
const e = [];
|
|
23
|
+
for (const t of s) {
|
|
24
|
+
const l = t % n, a = t / n | 0, u = f[t], r = (b, x) => {
|
|
25
|
+
!b || i[x] || (i[x] = 1, f[x] = u, e.push(x));
|
|
26
|
+
};
|
|
27
|
+
r(l > 0, t - 1), r(l + 1 < n, t + 1), r(a > 0, t - n), r(a + 1 < c, t + n);
|
|
28
|
+
}
|
|
29
|
+
s = e;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
P as selectiveOutline
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=selout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selout.js","sources":["../../src/pixel/selout.ts"],"sourcesContent":["import { P } from './palette';\nimport type { Color, PixelGrid } from './pixel';\nimport { outlineOf } from './ramp';\n\n/*\n * The selective outline (\"selout\") round an assembled body. It lands on exactly the pixels a plain outline would —\n * one ring outside the silhouette per grid pixel of `width` — so nothing about the silhouette changes, only the\n * colour of the ring: where the body turns away from the light (the back, facing left of a body facing right) and\n * where it stands on the ground (under the feet, under an arm) the ring stays full dark; on the lit side (the front\n * and the top of the head and shoulders) it takes the dark tone of the fill it borders (`outlineOf`). `dark` is the\n * full-dark ring's colour (the default palette's outline unless a game passes its own). A hard black\n * line all round a small pixel body is a sticker; a line that is the coat's own darkest shade on its lit side is a body.\n */\nexport function selectiveOutline(g: PixelGrid, width = 1, dark: Color = P.outline): void {\n const { w, h, data } = g;\n const solid = new Uint8Array(data.length);\n let x0 = w, y0 = h, x1 = -1, y1 = -1;\n for (let y = 0; y < h; y++) {\n const row = y * w;\n for (let x = 0; x < w; x++)\n if (data[row + x]! >>> 24) {\n solid[row + x] = 1;\n if (x < x0) x0 = x;\n if (x > x1) x1 = x;\n if (y < y0) y0 = y;\n y1 = y;\n }\n }\n if (x1 < 0) return;\n let frontier: number[] = [];\n for (let y = Math.max(0, y0 - 1); y <= Math.min(h - 1, y1 + 1); y++)\n for (let x = Math.max(0, x0 - 1); x <= Math.min(w - 1, x1 + 1); x++) {\n const i = y * w + x;\n if (solid[i]) continue;\n const above = y > 0 && solid[i - w] === 1;\n const right = x + 1 < w && solid[i + 1] === 1;\n const left = x > 0 && solid[i - 1] === 1;\n const below = y + 1 < h && solid[i + w] === 1;\n if (!(above || right || left || below)) continue;\n // under the body or behind it: full dark; in front of it or over it: the fill's own darkest tone\n data[i] = above || right ? dark : outlineOf(data[left ? i - 1 : i + w]!);\n frontier.push(i);\n }\n for (const i of frontier) solid[i] = 1;\n // a thicker outline (tools that paint above 1x) grows each ring from the one before it, keeping its colour\n for (let step = 1; step < width && frontier.length; step++) {\n const next: number[] = [];\n for (const i of frontier) {\n const x = i % w;\n const y = (i / w) | 0;\n const c = data[i]!;\n const grow = (ok: boolean, k: number) => {\n if (!ok || solid[k]) return;\n solid[k] = 1;\n data[k] = c;\n next.push(k);\n };\n grow(x > 0, i - 1);\n grow(x + 1 < w, i + 1);\n grow(y > 0, i - w);\n grow(y + 1 < h, i + w);\n }\n frontier = next;\n }\n}\n"],"names":["selectiveOutline","g","width","dark","P","w","h","data","solid","x0","y0","x1","y1","y","row","x","frontier","i","above","right","left","below","outlineOf","step","next","c","grow","ok","k"],"mappings":";;AAaO,SAASA,EAAiBC,GAAcC,IAAQ,GAAGC,IAAcC,EAAE,SAAe;AACvF,QAAM,EAAE,GAAAC,GAAG,GAAAC,GAAG,MAAAC,EAAA,IAASN,GACjBO,IAAQ,IAAI,WAAWD,EAAK,MAAM;AACxC,MAAIE,IAAKJ,GAAGK,IAAKJ,GAAGK,IAAK,IAAIC,IAAK;AAClC,WAASC,IAAI,GAAGA,IAAIP,GAAGO,KAAK;AAC1B,UAAMC,IAAMD,IAAIR;AAChB,aAASU,IAAI,GAAGA,IAAIV,GAAGU;AACrB,MAAIR,EAAKO,IAAMC,CAAC,MAAO,OACrBP,EAAMM,IAAMC,CAAC,IAAI,GACbA,IAAIN,MAAIA,IAAKM,IACbA,IAAIJ,MAAIA,IAAKI,IACbF,IAAIH,MAAIA,IAAKG,IACjBD,IAAKC;AAAA,EAEX;AACA,MAAIF,IAAK,EAAG;AACZ,MAAIK,IAAqB,CAAA;AACzB,WAASH,IAAI,KAAK,IAAI,GAAGH,IAAK,CAAC,GAAGG,KAAK,KAAK,IAAIP,IAAI,GAAGM,IAAK,CAAC,GAAGC;AAC9D,aAASE,IAAI,KAAK,IAAI,GAAGN,IAAK,CAAC,GAAGM,KAAK,KAAK,IAAIV,IAAI,GAAGM,IAAK,CAAC,GA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
this.dx = e, this.dy = t, this.color = a, this.length = d;
|
|
4
|
+
}
|
|
5
|
+
dx;
|
|
6
|
+
dy;
|
|
7
|
+
color;
|
|
8
|
+
length;
|
|
9
|
+
*[Symbol.iterator]() {
|
|
10
|
+
const e = { dx: 0, dy: 0, color: 0 };
|
|
11
|
+
for (let t = 0; t < this.length; t++)
|
|
12
|
+
e.dx = this.dx[t], e.dy = this.dy[t], e.color = this.color[t], yield e;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
const M = new C(new Float32Array(0), new Float32Array(0), new Uint32Array(0), 0), I = M, b = 512 * 512, k = 256, p = 3e5, r = /* @__PURE__ */ new Map();
|
|
16
|
+
let E = 0;
|
|
17
|
+
function v(c, e) {
|
|
18
|
+
for (r.set(c, e), E += e.length; r.size > k || E > p; ) {
|
|
19
|
+
const t = r.keys().next();
|
|
20
|
+
if (t.done) break;
|
|
21
|
+
E -= r.get(t.value).length, r.delete(t.value);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function L(c, e, t) {
|
|
25
|
+
const a = `${c.textureKey}|${c.frameName}|${e}`;
|
|
26
|
+
if (!t) {
|
|
27
|
+
const o = r.get(a);
|
|
28
|
+
if (o)
|
|
29
|
+
return r.delete(a), r.set(a, o), o;
|
|
30
|
+
}
|
|
31
|
+
const d = c.texture, m = d.source.resource;
|
|
32
|
+
if (!(m instanceof HTMLCanvasElement)) return M;
|
|
33
|
+
const f = d.frame, l = Math.round(f.width), u = Math.round(f.height);
|
|
34
|
+
if (l <= 0 || u <= 0 || l * u > b) return M;
|
|
35
|
+
let h;
|
|
36
|
+
try {
|
|
37
|
+
h = m.getContext("2d").getImageData(Math.round(f.x), Math.round(f.y), l, u).data;
|
|
38
|
+
} catch {
|
|
39
|
+
return M;
|
|
40
|
+
}
|
|
41
|
+
const s = Math.max(1, Math.round(e)), A = Math.floor(l / s), g = Math.floor(u / s), y = Math.floor(s / 2);
|
|
42
|
+
let i = 0;
|
|
43
|
+
for (let o = 0; o < g; o++) for (let n = 0; n < A; n++) h[((o * s + y) * l + n * s + y) * 4 + 3] >= 128 && i++;
|
|
44
|
+
const P = new Float32Array(i), F = new Float32Array(i), X = new Uint32Array(i);
|
|
45
|
+
let w = 0;
|
|
46
|
+
for (let o = 0; o < g; o++)
|
|
47
|
+
for (let n = 0; n < A; n++) {
|
|
48
|
+
const x = ((o * s + y) * l + n * s + y) * 4;
|
|
49
|
+
h[x + 3] < 128 || (P[w] = n - A / 2, F[w] = o - g, X[w] = h[x] << 16 | h[x + 1] << 8 | h[x + 2], w++);
|
|
50
|
+
}
|
|
51
|
+
const _ = new C(P, F, X, i);
|
|
52
|
+
return t || v(a, _), _;
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
I as NO_PIXELS,
|
|
56
|
+
C as PackedPixels,
|
|
57
|
+
L as spritePixels
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=spritePixels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spritePixels.js","sources":["../../src/pixel/spritePixels.ts"],"sourcesContent":["import type { Image } from '../core/Image';\n\n/** One opaque world pixel of a sprite frame: offset from the frame's feet (origin 0.5, 1) and its colour. */\nexport interface SpritePixel {\n dx: number;\n dy: number;\n color: number;\n}\n\n/**\n * A frame's opaque pixels packed in typed arrays (12 bytes a pixel instead of an object each). Iterating hands out one\n * reused `SpritePixel`, so read it in the loop and keep nothing of it; `at(i)` reads one into a given object.\n */\nexport class PackedPixels implements Iterable<SpritePixel> {\n constructor(\n readonly dx: Float32Array,\n readonly dy: Float32Array,\n readonly color: Uint32Array,\n readonly length: number,\n ) {}\n\n *[Symbol.iterator](): Iterator<SpritePixel> {\n const p: SpritePixel = { dx: 0, dy: 0, color: 0 };\n for (let i = 0; i < this.length; i++) {\n p.dx = this.dx[i]!;\n p.dy = this.dy[i]!;\n p.color = this.color[i]!;\n yield p;\n }\n }\n}\n\nconst EMPTY = new PackedPixels(new Float32Array(0), new Float32Array(0), new Uint32Array(0), 0);\n/** No pixels: what a body hands over when there is nothing of it worth lifting (a death with nothing to evaporate). */\nexport const NO_PIXELS = EMPTY;\n/**\n * The largest frame read, in image pixels: well over any sheet's (192x180 is about the largest). An image with no frame shows\n * its whole atlas page, and reading that — 4096x3520, 4.4 million pixels, ~110 MB a death — is what took mobile web views\n * down.\n */\nconst MAX_FRAME_AREA = 512 * 512;\n/** Frames kept, the least recently read going first once either bound is passed. */\nconst MAX_FRAMES = 256;\nconst MAX_PIXELS = 300_000;\nconst CACHE = new Map<string, PackedPixels>();\nlet cachedPixels = 0;\n\nfunction remember(key: string, packed: PackedPixels): void {\n CACHE.set(key, packed);\n cachedPixels += packed.length;\n while (CACHE.size > MAX_FRAMES || cachedPixels > MAX_PIXELS) {\n const oldest = CACHE.keys().next();\n if (oldest.done) break;\n cachedPixels -= CACHE.get(oldest.value)!.length;\n CACHE.delete(oldest.value);\n }\n}\n\n/**\n * The opaque pixels of an image's current frame, one per **world** pixel (`artScale` image pixels to one), as offsets\n * from the frame's feet in unscaled, unflipped world pixels. Read straight off the texture's canvas, so it is the\n * frame actually on screen. Atlas frames are shared by every body of one kind and cached (least recently read out\n * first); a texture repainted while in use (a rig body) is read fresh.\n */\nexport function spritePixels(img: Image, artScale: number, live: boolean): PackedPixels {\n const cacheKey = `${img.textureKey}|${img.frameName}|${artScale}`;\n if (!live) {\n const hit = CACHE.get(cacheKey);\n if (hit) {\n // most recently read goes to the back\n CACHE.delete(cacheKey);\n CACHE.set(cacheKey, hit);\n return hit;\n }\n }\n const tex = img.texture;\n const canvas = tex.source.resource as unknown;\n if (!(canvas instanceof HTMLCanvasElement)) return EMPTY;\n const f = tex.frame;\n const fw = Math.round(f.width);\n const fh = Math.round(f.height);\n if (fw <= 0 || fh <= 0 || fw * fh > MAX_FRAME_AREA) return EMPTY;\n let data: Uint8ClampedArray;\n try {\n data = canvas.getContext('2d')!.getImageData(Math.round(f.x), Math.round(f.y), fw, fh).data;\n } catch {\n return EMPTY;\n }\n const s = Math.max(1, Math.round(artScale));\n const ww = Math.floor(fw / s);\n const wh = Math.floor(fh / s);\n const half = Math.floor(s / 2);\n let n = 0;\n for (let wy = 0; wy < wh; wy++) for (let wx = 0; wx < ww; wx++) if (data[((wy * s + half) * fw + wx * s + half) * 4 + 3]! >= 128) n++;\n const dx = new Float32Array(n);\n const dy = new Float32Array(n);\n const color = new Uint32Array(n);\n let k = 0;\n for (let wy = 0; wy < wh; wy++) {\n for (let wx = 0; wx < ww; wx++) {\n const i = ((wy * s + half) * fw + wx * s + half) * 4;\n if (data[i + 3]! < 128) continue;\n dx[k] = wx - ww / 2;\n dy[k] = wy - wh;\n color[k] = (data[i]! << 16) | (data[i + 1]! << 8) | data[i + 2]!;\n k++;\n }\n }\n const out = new PackedPixels(dx, dy, color, n);\n if (!live) remember(cacheKey, out);\n return out;\n}\n"],"names":["PackedPixels","dx","dy","color","length","p","i","EMPTY","NO_PIXELS","MAX_FRAME_AREA","MAX_FRAMES","MAX_PIXELS","CACHE","cachedPixels","remember","key","packed","oldest","spritePixels","img","artScale","live","cacheKey","hit","tex","canvas","fw","fh","data","ww","wh","half","n","wy","wx","k","out"],"mappings":"AAaO,MAAMA,EAA8C;AAAA,EACzD,YACWC,GACAC,GACAC,GACAC,GACT;AAJS,SAAA,KAAAH,GACA,KAAA,KAAAC,GACA,KAAA,QAAAC,GACA,KAAA,SAAAC;AAAA,EACR;AAAA,EAJQ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAGX,EAAE,OAAO,QAAQ,IAA2B;AAC1C,UAAMC,IAAiB,EAAE,IAAI,GAAG,IAAI,GAAG,OAAO,EAAA;AAC9C,aAASC,IAAI,GAAGA,IAAI,KAAK,QAAQA;AAC/B,MAAAD,EAAE,KAAK,KAAK,GAAGC,CAAC,GAChBD,EAAE,KAAK,KAAK,GAAGC,CAAC,GAChBD,EAAE,QAAQ,KAAK,MAAMC,CAAC,GACtB,MAAMD;AAAA,EAEV;AACF;AAEA,MAAME,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
if (!Number.isFinite(i)) return null;
|
|
6
|
+
const e = i + 2;
|
|
7
|
+
let c = null, t = -1;
|
|
8
|
+
for (let o = Math.floor(r * 0.3); o <= r; o++) {
|
|
9
|
+
const f = o < r && n[o] > 0 && n[o] <= e;
|
|
10
|
+
f && t < 0 && (t = o), !f && t >= 0 && ((!c || o - t > c[1] - c[0]) && (c = [t, o]), t = -1);
|
|
11
|
+
}
|
|
12
|
+
if (!c || c[1] - c[0] < 3) return null;
|
|
13
|
+
let s = 0;
|
|
14
|
+
for (let o = 0; o < c[0]; o++) s = Math.max(s, n[o]);
|
|
15
|
+
return s >= e * 1.5 ? c[0] : null;
|
|
16
|
+
}
|
|
17
|
+
function p(n, r, i) {
|
|
18
|
+
const e = r - n;
|
|
19
|
+
if (e <= 0) return [];
|
|
20
|
+
if (e < 20) return [{ rect: { x: 0, y: n, w: i, h: e }, weight: 1, lag: 0 }];
|
|
21
|
+
const c = n + Math.round(e * 0.5);
|
|
22
|
+
return [
|
|
23
|
+
{ rect: { x: 0, y: n, w: i, h: c - n }, weight: 1, lag: 0 },
|
|
24
|
+
{ rect: { x: 0, y: c, w: i, h: r - c }, weight: 0.55, lag: 0.04 }
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
function g(n, r, i) {
|
|
28
|
+
const e = [.../* @__PURE__ */ new Set([0, r, ...i.flatMap((t) => [t.y, t.y + t.h])])].filter((t) => t >= 0 && t <= r).sort((t, s) => t - s), c = [];
|
|
29
|
+
for (let t = 0; t + 1 < e.length; t++) {
|
|
30
|
+
const s = e[t], o = e[t + 1] - s, f = i.filter((u) => u.y <= s && u.y + u.h >= s + o).sort((u, h) => u.x - h.x);
|
|
31
|
+
let a = 0;
|
|
32
|
+
for (const u of f)
|
|
33
|
+
u.x > a && c.push({ x: a, y: s, w: u.x - a, h: o }), a = Math.max(a, u.x + u.w);
|
|
34
|
+
a < n && c.push({ x: a, y: s, w: n - a, h: o });
|
|
35
|
+
}
|
|
36
|
+
return c.sort((t, s) => s.w * s.h - t.w * t.h);
|
|
37
|
+
}
|
|
38
|
+
function w(n, r, i, e) {
|
|
39
|
+
const c = n.tufts?.[String(e)] ?? n.tufts?.["*"] ?? [], t = [];
|
|
40
|
+
for (const [s, o, f, a, u = 1] of c) {
|
|
41
|
+
const h = Math.min(r, f), l = Math.min(i, a);
|
|
42
|
+
h <= s || l <= o || t.push({ rect: { x: s, y: o, w: h - s, h: l - o }, weight: u, lag: (1 - u) * 0.08 });
|
|
43
|
+
}
|
|
44
|
+
return t;
|
|
45
|
+
}
|
|
46
|
+
function b(n, r, i, e, c = 0) {
|
|
47
|
+
if (n.mode === "tufts") {
|
|
48
|
+
const s = w(n, r, i, c);
|
|
49
|
+
return { pieces: s.length ? g(r, i, s.map((o) => o.rect)) : [], strips: s };
|
|
50
|
+
}
|
|
51
|
+
if (n.mode === "hang" && n.cloth) {
|
|
52
|
+
const [s, o, f, a] = n.cloth, u = Math.min(r, f), h = Math.min(i, a), l = o + Math.round((h - o) * 0.3), x = [];
|
|
53
|
+
for (let M = l; M < h; M += 2) {
|
|
54
|
+
const y = Math.min(2, h - M);
|
|
55
|
+
x.push({ rect: { x: s, y: M, w: u - s, h: y }, weight: (M + y - l) / (h - l), lag: (M - l) * 0.03 });
|
|
56
|
+
}
|
|
57
|
+
return { pieces: [
|
|
58
|
+
{ x: 0, y: 0, w: r, h: l },
|
|
59
|
+
{ x: 0, y: h, w: r, h: i - h },
|
|
60
|
+
{ x: 0, y: l, w: s, h: h - l },
|
|
61
|
+
{ x: u, y: l, w: r - u, h: h - l }
|
|
62
|
+
].filter((M) => M.w > 0 && M.h > 0), strips: x };
|
|
63
|
+
}
|
|
64
|
+
let t = null;
|
|
65
|
+
return n.mode === "crown" && e && (t = m(e)), t === null && (t = Math.round(i * Math.min(0.9, n.mode === "top" ? n.top ?? 0.5 : 0.6))), t = Math.max(1, Math.min(i - 1, t)), { pieces: [{ x: 0, y: t, w: r, h: i - t }], strips: p(0, t, r) };
|
|
66
|
+
}
|
|
67
|
+
function I(n, r, i = 0) {
|
|
68
|
+
let e = Math.imul(n + 40503, 2246822507) ^ Math.imul(r + 31161 + i * 131, 3266489909);
|
|
69
|
+
return e ^= e >>> 15, e = Math.imul(e, 668265263), e ^= e >>> 13, (e >>> 0) / 4294967296;
|
|
70
|
+
}
|
|
71
|
+
function P(n, r, i, e) {
|
|
72
|
+
return 0.65 + 0.35 * Math.sin(2 * Math.PI * (n / i - r / e));
|
|
73
|
+
}
|
|
74
|
+
function S(n, r, i, e, c, t, s, o, f = 0) {
|
|
75
|
+
if (t <= 0) return 0;
|
|
76
|
+
const a = n * r + i - e, u = 0.3 * t + 0.72 * Math.sin(2 * Math.PI * a) + 0.28 * Math.sin(2 * Math.PI * (a * 0.43 + i * 1.7)), h = Math.max(c * t * s, f), l = Math.round(h * o * u);
|
|
77
|
+
return l === 0 ? 0 : l;
|
|
78
|
+
}
|
|
79
|
+
export {
|
|
80
|
+
b as buildRig,
|
|
81
|
+
g as complement,
|
|
82
|
+
P as gustAt,
|
|
83
|
+
S as swayOffset,
|
|
84
|
+
I as tileHash,
|
|
85
|
+
m as trunkPivot
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=swayRig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swayRig.js","sources":["../../src/pixel/swayRig.ts"],"sourcesContent":["/*\n * How a swaying sprite is cut up, and how far each cut moves. Pure (no Pixi, no canvas), so it is unit-tested.\n *\n * A tree, a bush, a reed bank or a banner is never repainted to sway: its frame — painted or loaded alike — is sliced\n * into rects. The `pieces` stay where they are; each `strip` is the same pixels moved sideways by a whole number of\n * world pixels. The strips partition the moving region and the pieces partition the rest, so no pixel is ever drawn\n * twice and none is lost; a strip that moves one pixel leaves a one-pixel step against its neighbour, which is how a\n * pixel artist draws a bough bending. `SwayProp` puts a rig on screen.\n */\n\n/**\n * - `crown`: a tree; the canopy above the trunk sways, the trunk found in the pixels (`trunkPivot`);\n * - `top`: the top `top` share of the frame sways (a bush, a reed clump);\n * - `hang`: a cloth hanging off a bar (`cloth`), each pair of rows swinging wider and later down it;\n * - `tufts`: only the given rects move (reeds painted into a bigger sprite), per variant.\n */\nexport type SwayMode = 'crown' | 'top' | 'hang' | 'tufts';\n\n/** [x0, y0, x1, y1) in the frame's pixels, and an optional weight (share of the full reach, default 1). */\nexport type TuftRect = readonly [number, number, number, number] | readonly [number, number, number, number, number];\n\nexport interface SwayDef {\n mode: SwayMode;\n /** `top`: the share of the frame's height, from its top, that moves. */\n top?: number;\n /** `hang`: the cloth, [x0, y0, x1, y1) in the frame's pixels. */\n cloth?: readonly [number, number, number, number];\n /** `tufts`: the moving rects per variant (\"*\" for every variant without its own). */\n tufts?: Readonly<Record<string, readonly TuftRect[]>>;\n /** Whole world pixels of reach at wind 1. */\n amp: number;\n /** Sway cycles a second. */\n speed: number;\n}\nexport interface Rect {\n x: number;\n y: number;\n w: number;\n h: number;\n}\n\nexport interface SwayStrip {\n rect: Rect;\n /** Share of the full reach this strip moves (the crown's top moves furthest, a banner's hem most). */\n weight: number;\n /** How far behind the top of the prop this strip swings, in cycles: the wave runs down a banner. */\n lag: number;\n}\n\nexport interface SwayRig {\n pieces: Rect[];\n strips: SwayStrip[];\n}\n\n/**\n * The first row of a tree's trunk (the canopy is every row above it), from the width of the opaque run on each row\n * of its sprite (0 = empty). The trunk is the longest run of narrow rows in the lower part of the sprite, \"narrow\"\n * meaning within two pixels of the narrowest row there — so a root flare at the foot does not end it. Null when\n * the sprite has no trunk worth the name (a bush, a heap of reeds).\n */\nexport function trunkPivot(widths: readonly number[]): number | null {\n const n = widths.length;\n let minW = Infinity;\n for (let y = Math.floor(n * 0.4); y < n; y++) if (widths[y]! > 0) minW = Math.min(minW, widths[y]!);\n if (!Number.isFinite(minW)) return null;\n const lim = minW + 2;\n let best: [number, number] | null = null;\n let start = -1;\n for (let y = Math.floor(n * 0.3); y <= n; y++) {\n const narrow = y < n && widths[y]! > 0 && widths[y]! <= lim;\n if (narrow && start < 0) start = y;\n if (!narrow && start >= 0) {\n if (!best || y - start > best[1] - best[0]) best = [start, y];\n start = -1;\n }\n }\n if (!best || best[1] - best[0] < 3) return null;\n let crown = 0;\n for (let y = 0; y < best[0]; y++) crown = Math.max(crown, widths[y]!);\n return crown >= lim * 1.5 ? best[0] : null;\n}\n\n/** A row band split in two: the top moving full reach, the lower half-way. One band when it is short. */\nfunction bands(from: number, to: number, w: number): SwayStrip[] {\n const h = to - from;\n if (h <= 0) return [];\n if (h < 20) return [{ rect: { x: 0, y: from, w, h }, weight: 1, lag: 0 }];\n const split = from + Math.round(h * 0.5);\n return [\n { rect: { x: 0, y: from, w, h: split - from }, weight: 1, lag: 0 },\n { rect: { x: 0, y: split, w, h: to - split }, weight: 0.55, lag: 0.04 },\n ];\n}\n\n/**\n * The frame `w`x`h` less the given rects (which must not overlap), as rects: cut into row bands at every rect's\n * top and bottom, and each band into the runs no rect covers.\n */\nexport function complement(w: number, h: number, holes: Rect[]): Rect[] {\n const ys = [...new Set([0, h, ...holes.flatMap((r) => [r.y, r.y + r.h])])].filter((y) => y >= 0 && y <= h).sort((a, b) => a - b);\n const out: Rect[] = [];\n for (let i = 0; i + 1 < ys.length; i++) {\n const y = ys[i]!;\n const bh = ys[i + 1]! - y;\n const cover = holes.filter((r) => r.y <= y && r.y + r.h >= y + bh).sort((a, b) => a.x - b.x);\n let x = 0;\n for (const r of cover) {\n if (r.x > x) out.push({ x, y, w: r.x - x, h: bh });\n x = Math.max(x, r.x + r.w);\n }\n if (x < w) out.push({ x, y, w: w - x, h: bh });\n }\n // the biggest still piece first: it becomes the placed image the map culls and fades\n return out.sort((a, b) => b.w * b.h - a.w * a.h);\n}\n\n/** The tuft rects of one variant (its own list, else the \"*\" one), clipped to the frame. */\nfunction tuftStrips(def: SwayDef, w: number, h: number, variant: number): SwayStrip[] {\n const list = def.tufts?.[String(variant)] ?? def.tufts?.['*'] ?? [];\n const strips: SwayStrip[] = [];\n for (const [x0, y0, x1raw, y1raw, weight = 1] of list) {\n const x1 = Math.min(w, x1raw);\n const y1 = Math.min(h, y1raw);\n if (x1 <= x0 || y1 <= y0) continue;\n // a reed's lower half follows its tip a beat late\n strips.push({ rect: { x: x0, y: y0, w: x1 - x0, h: y1 - y0 }, weight, lag: (1 - weight) * 0.08 });\n }\n return strips;\n}\n\n/**\n * The rig for one prop frame `w`x`h`. `rowWidths` is only read by a `crown`, whose pivot comes from the pixels\n * (without it, or without a trunk in them, the crown falls back to the top 60%). `variant` is only read by\n * `tufts`, whose rects are drawn per variant.\n */\nexport function buildRig(def: SwayDef, w: number, h: number, rowWidths?: readonly number[], variant = 0): SwayRig {\n if (def.mode === 'tufts') {\n const strips = tuftStrips(def, w, h, variant);\n return { pieces: strips.length ? complement(w, h, strips.map((s) => s.rect)) : [], strips };\n }\n if (def.mode === 'hang' && def.cloth) {\n const [x0, y0, x1raw, y1raw] = def.cloth;\n const x1 = Math.min(w, x1raw);\n const y1 = Math.min(h, y1raw);\n // the top third of the cloth hangs straight off its bar; below that each pair of rows swings wider\n const ys = y0 + Math.round((y1 - y0) * 0.3);\n const strips: SwayStrip[] = [];\n for (let y = ys; y < y1; y += 2) {\n const sh = Math.min(2, y1 - y);\n strips.push({ rect: { x: x0, y, w: x1 - x0, h: sh }, weight: (y + sh - ys) / (y1 - ys), lag: (y - ys) * 0.03 });\n }\n const pieces: Rect[] = [\n { x: 0, y: 0, w, h: ys },\n { x: 0, y: y1, w, h: h - y1 },\n { x: 0, y: ys, w: x0, h: y1 - ys },\n { x: x1, y: ys, w: w - x1, h: y1 - ys },\n ].filter((r) => r.w > 0 && r.h > 0);\n return { pieces, strips };\n }\n let pivot: number | null = null;\n if (def.mode === 'crown' && rowWidths) pivot = trunkPivot(rowWidths);\n if (pivot === null) pivot = Math.round(h * Math.min(0.9, def.mode === 'top' ? (def.top ?? 0.5) : 0.6));\n pivot = Math.max(1, Math.min(h - 1, pivot));\n return { pieces: [{ x: 0, y: pivot, w, h: h - pivot }], strips: bands(0, pivot, w) };\n}\n\n/** A stable [0, 1) per tile (or any two integers), so each prop keeps its own phase and pace from one visit to the next. */\nexport function tileHash(tx: number, ty: number, salt = 0): number {\n let h = Math.imul(tx + 0x9e37, 0x85ebca6b) ^ Math.imul(ty + 0x79b9 + salt * 131, 0xc2b2ae35);\n h ^= h >>> 15;\n h = Math.imul(h, 0x27d4eb2f);\n h ^= h >>> 13;\n return (h >>> 0) / 4294967296;\n}\n\n/** A gust rolling across the world from the west: every tree it passes bends a little further, then less. */\nexport function gustAt(tSec: number, worldX: number, gustSeconds: number, gustPx: number): number {\n return 0.65 + 0.35 * Math.sin(2 * Math.PI * (tSec / gustSeconds - worldX / gustPx));\n}\n\n/**\n * How many whole pixels a strip stands off at `tSec`: a main swing with a slower second one riding it (so no two\n * trees ever meet in step), leaning a little downwind as the wind rises, scaled by the reach, the wind, the gust\n * and the strip's weight, and rounded — the sway moves in pixel steps, 0 → 1 → 0, never smeared between them.\n *\n * `minReach` is the least that reach × wind × gust may come to while any wind blows (a still place's\n * floor, chosen by the game): without it a faint breeze never rounds to a whole pixel and the trees stand dead still, and\n * rounding is the rule, so the floor is what lets the crest of a swing tick one pixel over and back.\n */\nexport function swayOffset(\n tSec: number,\n speed: number,\n phase: number,\n lag: number,\n amp: number,\n wind: number,\n gust: number,\n weight: number,\n minReach = 0,\n): number {\n if (wind <= 0) return 0;\n const c = tSec * speed + phase - lag;\n const wave = 0.3 * wind + 0.72 * Math.sin(2 * Math.PI * c) + 0.28 * Math.sin(2 * Math.PI * (c * 0.43 + phase * 1.7));\n const reach = Math.max(amp * wind * gust, minReach);\n const v = Math.round(reach * weight * wave);\n return v === 0 ? 0 : v;\n}\n"],"names":["trunkPivot","widths","n","minW","y","lim","best","start","narrow","crown","bands","from","to","w","h","split","complement","holes","ys","r","a","b","out","i","bh","cover","x","tuftStrips","def","variant","list","strips","x0","y0","x1raw","y1raw","weight","x1","y1","buildRig","rowWidths","s","sh","pivot","tileHash","tx","ty","salt","gustAt","tSec","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nF;AAGO,SAAS+B,EAASC,GAAYC,GAAYC,IAAO,GAAW;AACjE,MAAIjC,IAAI,KAAK,KAAK+B,IAAK,OAAQ,UAAU,IAAI,KAAK,KAAKC,IAAK,QAASC,IAAO,KAAK,UAAU;AAC3F,SAAAjC,KAAKA,MAAM,IACXA,IAAI,KAAK,KAAKA,GAAG,SAAU,GAC3BA,KAAKA,MAAM,KACHA,MAAM,KAAK;AACrB;AAGO,SAASkC,EAAOC,GAAcC,GAAgBC,GAAqBC,GAAwB;AAChG,SAAO,OAAO,OAAO,KAAK,IAAI,IAAI,KAAK,MAAMH,IAAOE,IAAcD,IAASE,EAAO;AACpF;AAWO,SAASC,EACdJ,GACAK,GACAC,GACAC,GACAC,GACAC,GACAC,GACAvB,GACAwB,IAAW,GACH;AACR,MAAIF,KAAQ,EAAG,QAAO;AACtB,QAAMG,IAAIZ,IAAOK,IAAQC,IAAQC,GAC3BM,IAAO,MAAMJ,IAAO,OAAO,KAAK,IAAI,IAAI,KAAK,KAAKG,CAAC,IAAI,OAAO,KAAK,IAAI,IAAI,KAAK,MAAMA,IAAI,OAAON,IAAQ,IAAI,GAC7GQ,IAAQ,KAAK,IAAIN,IAAMC,IAAOC,GAAMC,CAAQ,GAC5CI,IAAI,KAAK,MAAMD,IAAQ3B,IAAS0B,CAAI;AAC1C,SAAOE,MAAM,IAAI,IAAIA;AACvB;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const x = [0, 8, 2, 10, 12, 4, 14, 6, 3, 11, 1, 9, 15, 7, 13, 5].map((n) => (n + 0.5) / 16);
|
|
2
|
+
function d(n, c) {
|
|
3
|
+
if (n <= c) return 0;
|
|
4
|
+
const a = Math.min(1, (n - c) / (1 - c));
|
|
5
|
+
return a * a;
|
|
6
|
+
}
|
|
7
|
+
function f(n, c, a, i = 0.55) {
|
|
8
|
+
const r = Math.max(1, Math.ceil(n)), h = Math.max(1, Math.ceil(c)), e = new Uint8Array(r * h);
|
|
9
|
+
for (let t = 0; t < h; t++)
|
|
10
|
+
for (let o = 0; o < r; o++) {
|
|
11
|
+
const u = (o + 0.5) / r - 0.5, M = (t + 0.5) / h - 0.5, s = (u * u + M * M) * 2;
|
|
12
|
+
s <= i * i || d(Math.sqrt(s), i) * a <= x[(t & 3) * 4 + (o & 3)] || (e[t * r + o] = 1);
|
|
13
|
+
}
|
|
14
|
+
return e;
|
|
15
|
+
}
|
|
16
|
+
function l(n, c, a = 6, i = 1e3, r = 500) {
|
|
17
|
+
const h = Math.max(0, Math.min(1, c)), e = i - h * (i - r), t = (n % e + e) % e / e, o = t < 0.15 ? t / 0.15 : Math.max(0, 1 - (t - 0.15) / 0.55), u = (0.35 + h * 0.4) * (0.45 + 0.55 * o);
|
|
18
|
+
return a > 0 ? Math.round(u * a) / a : u;
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
l as heartbeat,
|
|
22
|
+
f as vignetteMask
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=vignetteMask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vignetteMask.js","sources":["../../src/pixel/vignetteMask.ts"],"sourcesContent":["/**\n * The pure half of `DitherVignette`: which pixels of a `w`×`h` screen (in world pixels) the edge sets, its falloff an\n * ordered 4×4 Bayer dither rather than a gradient — the grammar `Darkness` lights the night in, so the edge reads as\n * pixel art and not as a blur over it.\n */\n\nconst BAYER = [0, 8, 2, 10, 12, 4, 14, 6, 3, 11, 1, 9, 15, 7, 13, 5].map((v) => (v + 0.5) / 16);\n\n/** How strongly a pixel `d` of the way from the centre to the corner is darkened: 0 inside `from`, 1 at the corner. */\nfunction edge(d: number, from: number): number {\n if (d <= from) return 0;\n const t = Math.min(1, (d - from) / (1 - from));\n return t * t;\n}\n\n/**\n * One byte a pixel, 1 where the edge is set. `strength` (0..1) is the share of pixels set at the very corner; `from`\n * (0..1) is how far from the centre toward a corner the edge begins.\n */\nexport function vignetteMask(w: number, h: number, strength: number, from = 0.55): Uint8Array {\n const tw = Math.max(1, Math.ceil(w));\n const th = Math.max(1, Math.ceil(h));\n const out = new Uint8Array(tw * th);\n for (let y = 0; y < th; y++)\n for (let x = 0; x < tw; x++) {\n const dx = (x + 0.5) / tw - 0.5;\n const dy = (y + 0.5) / th - 0.5;\n // squared distance against squared bounds: no root for the many pixels inside `from`\n const d2 = (dx * dx + dy * dy) * 2;\n if (d2 <= from * from) continue;\n if (edge(Math.sqrt(d2), from) * strength <= BAYER[(y & 3) * 4 + (x & 3)]!) continue;\n out[y * tw + x] = 1;\n }\n return out;\n}\n\n/**\n * A pulse's opacity at `now` (ms): a quick rise and a slower fall, a beat every `slowMs` at `urgency` 0 quickening to\n * every `fastMs` at 1, deeper as it quickens, in `steps` levels rather than a smooth swell (0 for smooth).\n */\nexport function heartbeat(now: number, urgency: number, steps = 6, slowMs = 1000, fastMs = 500): number {\n const u = Math.max(0, Math.min(1, urgency));\n const period = slowMs - u * (slowMs - fastMs);\n const t = (((now % period) + period) % period) / period;\n const beat = t < 0.15 ? t / 0.15 : Math.max(0, 1 - (t - 0.15) / 0.55);\n const v = (0.35 + u * 0.4) * (0.45 + 0.55 * beat);\n return steps > 0 ? Math.round(v * steps) / steps : v;\n}\n"],"names":["BAYER","v","edge","d","from","t","vignetteMask","w","h","strength","tw","th","out","y","x","dx","dy","d2","heartbeat","now","urgency","steps","slowMs","fastMs","u","period","beat"],"mappings":"AAMA,MAAMA,IAAQ,CAAC,GAAG,GAAG,GAAG,IAAI,IAAI,GAAG,IAAI,GAAG,GAAG,IAAI,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC,EAAE,IAAI,CAACC,OAAOA,IAAI,OAAO,EAAE;AAG9F,SAASC,EAAKC,GAAWC,GAAsB;AAC7C,MAAID,KAAKC,EAAM,QAAO;AACtB,QAAMC,IAAI,KAAK,IAAI,IAAIF,IAAIC,MAAS,IAAIA,EAAK;AAC7C,SAAOC,IAAIA;AACb;AAMO,SAASC,EAAaC,GAAWC,GAAWC,GAAkBL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
7
|
+
ashLight: "#8a827c",
|
|
8
|
+
ash: "#5c5652",
|
|
9
|
+
ashDark: "#3e3a38",
|
|
10
|
+
ember: "#ffa040",
|
|
11
|
+
emberDeep: "#c0501c",
|
|
12
|
+
mist: "rgba(226,232,222,0.62)"
|
|
13
|
+
};
|
|
14
|
+
function w(i, t, l, a) {
|
|
15
|
+
const n = [];
|
|
16
|
+
let s = l;
|
|
17
|
+
const _ = () => (s = Math.imul(s, 1103515245) + 12345 & 2147483647, s / 2147483647);
|
|
18
|
+
for (let r = 0; r < t; r++)
|
|
19
|
+
for (let h = 0; h < i; h++) {
|
|
20
|
+
if ((h + r) % 2) continue;
|
|
21
|
+
const c = (h - i / 2) / (i / 2), e = (r - t / 2) / (t / 2), f = 1 - (c * c + e * e);
|
|
22
|
+
f > 0 && _() < f * 0.9 && n.push([h, r, a]);
|
|
23
|
+
}
|
|
24
|
+
return n;
|
|
25
|
+
}
|
|
26
|
+
function o(i, t, l, a, n) {
|
|
27
|
+
if (i.exists(t)) return;
|
|
28
|
+
const s = document.createElement("canvas");
|
|
29
|
+
s.width = l, s.height = a;
|
|
30
|
+
const _ = s.getContext("2d");
|
|
31
|
+
if (_) {
|
|
32
|
+
for (const [r, h, c] of n)
|
|
33
|
+
_.fillStyle = c, _.fillRect(r, h, 1, 1);
|
|
34
|
+
i.addCanvas(t, s);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function m(i, t = {}, l = "wx_") {
|
|
38
|
+
const a = { ...d, ...t }, n = (s) => l + s;
|
|
39
|
+
return o(i, n("rain_0"), 2, 5, [[1, 0, a.rainHead], [1, 1, a.rainBody], [1, 2, a.rainBody], [0, 3, a.rainTail], [0, 4, a.rainTail]]), o(i, n("rain_1"), 2, 4, [[1, 0, a.rainHead], [1, 1, a.rainBody], [0, 2, a.rainBody], [0, 3, a.rainTail]]), o(i, n("splash_0"), 5, 2, [[2, 0, a.rainHead], [1, 1, a.rainBody], [3, 1, a.rainBody]]), o(i, n("splash_1"), 5, 2, [[0, 0, a.rainTail], [4, 0, a.rainTail], [2, 1, a.rainTail]]), o(i, n("snow_0"), 1, 1, [[0, 0, a.snow]]), o(i, n("snow_1"), 2, 2, [[0, 0, a.snow], [1, 0, a.snow], [0, 1, a.snow], [1, 1, a.snowShade]]), o(i, n("snow_2"), 3, 3, [[1, 0, a.snow], [0, 1, a.snow], [1, 1, a.snow], [2, 1, a.snowShade], [1, 2, a.snowShade]]), o(i, n("ash_0"), 2, 1, [[0, 0, a.ashLight], [1, 0, a.ash]]), o(i, n("ash_1"), 2, 2, [[0, 0, a.ash], [1, 1, a.ashDark]]), o(i, n("ash_2"), 1, 2, [[0, 0, a.ember], [0, 1, a.emberDeep]]), o(i, n("fog_0"), 72, 14, w(72, 14, 7, a.mist)), o(i, n("fog_1"), 56, 12, w(56, 12, 31, a.mist)), {
|
|
40
|
+
rain: { motion: "fall", max: 170, keys: [n("rain_0"), n("rain_1")], splash: [n("splash_0"), n("splash_1")], tint: 4214890, tintAlpha: 0.1 },
|
|
41
|
+
// the big flake one in five, the big ash an ember one in seven
|
|
42
|
+
snow: { motion: "flake", max: 120, keys: [n("snow_2"), n("snow_1"), n("snow_0"), n("snow_1"), n("snow_0")], sway: 5, tint: 14214384, tintAlpha: 0.08 },
|
|
43
|
+
ash: {
|
|
44
|
+
motion: "flake",
|
|
45
|
+
max: 90,
|
|
46
|
+
keys: [n("ash_2"), n("ash_1"), n("ash_0"), n("ash_1"), n("ash_0"), n("ash_1"), n("ash_0")],
|
|
47
|
+
vx: [12, 24],
|
|
48
|
+
vy: [10, 22],
|
|
49
|
+
sway: 3,
|
|
50
|
+
tint: 5917248,
|
|
51
|
+
tintAlpha: 0.08
|
|
52
|
+
},
|
|
53
|
+
fog: { motion: "bank", max: 12, keys: [n("fog_0"), n("fog_1")], tint: 13160644, tintAlpha: 0.24 }
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export {
|
|
57
|
+
d as WEATHER_COLORS,
|
|
58
|
+
w as mistPixels,
|
|
59
|
+
m as paintWeatherArt
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=weatherArt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"weatherArt.js","sources":["../../src/pixel/weatherArt.ts"],"sourcesContent":["import type { TextureRegistry } from '../core/TextureRegistry';\nimport type { WeatherLook } from '../ambient/WeatherLayer';\n\n/** A pixel of weather art: x, y and a CSS colour. */\nexport type WeatherPixel = readonly [x: number, y: number, color: string];\n\n/** The colours the weather is painted in; every one may be replaced to suit a game's palette. */\nexport interface WeatherColors {\n rainHead: string;\n rainBody: string;\n rainTail: string;\n snow: string;\n snowShade: string;\n ashLight: string;\n ash: string;\n ashDark: string;\n ember: string;\n emberDeep: string;\n mist: string;\n}\n\nexport const WEATHER_COLORS: WeatherColors = {\n rainHead: 'rgba(214,230,248,0.85)',\n rainBody: 'rgba(168,190,216,0.7)',\n rainTail: 'rgba(128,150,180,0.5)',\n snow: '#f6f9ff',\n snowShade: '#b8c8e0',\n ashLight: '#8a827c',\n ash: '#5c5652',\n ashDark: '#3e3a38',\n ember: '#ffa040',\n emberDeep: '#c0501c',\n mist: 'rgba(226,232,222,0.62)',\n};\n\n/** A bank of mist: pixels on a checkerboard, denser toward its middle, ragged at every edge. Pure and seeded. */\nexport function mistPixels(w: number, h: number, seed: number, color: string): WeatherPixel[] {\n const px: WeatherPixel[] = [];\n let r = seed;\n const rand = () => {\n r = (Math.imul(r, 1103515245) + 12345) & 0x7fffffff;\n return r / 0x7fffffff;\n };\n for (let y = 0; y < h; y++)\n for (let x = 0; x < w; x++) {\n if ((x + y) % 2) continue;\n const nx = (x - w / 2) / (w / 2);\n const ny = (y - h / 2) / (h / 2);\n const d = 1 - (nx * nx + ny * ny);\n if (d > 0 && rand() < d * 0.9) px.push([x, y, color]);\n }\n return px;\n}\n\nfunction paint(textures: TextureRegistry, key: string, w: number, h: number, pixels: readonly WeatherPixel[]): void {\n if (textures.exists(key)) return;\n const c = document.createElement('canvas');\n c.width = w;\n c.height = h;\n const g = c.getContext('2d');\n if (!g) return;\n for (const [x, y, color] of pixels) {\n g.fillStyle = color;\n g.fillRect(x, y, 1, 1);\n }\n textures.addCanvas(key, c);\n}\n\n/**\n * Paints a set of weather in whole world pixels, flat colours and never a soft glow (a rain streak is the size of a\n * pixel of the roof it falls past; light from the up-left, so a flake's lit pixel is its top-left one), and returns\n * looks ready for `WeatherLayer`: `rain`, `snow`, `ash` (with an ember now and then) and `fog`. Painted once; a key\n * already in the registry is kept.\n */\nexport function paintWeatherArt(\n textures: TextureRegistry,\n colors: Partial<WeatherColors> = {},\n prefix = 'wx_',\n): Record<'rain' | 'snow' | 'ash' | 'fog', WeatherLook> {\n const c = { ...WEATHER_COLORS, ...colors };\n const k = (name: string) => prefix + name;\n paint(textures, k('rain_0'), 2, 5, [[1, 0, c.rainHead], [1, 1, c.rainBody], [1, 2, c.rainBody], [0, 3, c.rainTail], [0, 4, c.rainTail]]);\n paint(textures, k('rain_1'), 2, 4, [[1, 0, c.rainHead], [1, 1, c.rainBody], [0, 2, c.rainBody], [0, 3, c.rainTail]]);\n // the splash: a drop's crown, then two beads thrown wide\n paint(textures, k('splash_0'), 5, 2, [[2, 0, c.rainHead], [1, 1, c.rainBody], [3, 1, c.rainBody]]);\n paint(textures, k('splash_1'), 5, 2, [[0, 0, c.rainTail], [4, 0, c.rainTail], [2, 1, c.rainTail]]);\n paint(textures, k('snow_0'), 1, 1, [[0, 0, c.snow]]);\n paint(textures, k('snow_1'), 2, 2, [[0, 0, c.snow], [1, 0, c.snow], [0, 1, c.snow], [1, 1, c.snowShade]]);\n paint(textures, k('snow_2'), 3, 3, [[1, 0, c.snow], [0, 1, c.snow], [1, 1, c.snow], [2, 1, c.snowShade], [1, 2, c.snowShade]]);\n paint(textures, k('ash_0'), 2, 1, [[0, 0, c.ashLight], [1, 0, c.ash]]);\n paint(textures, k('ash_1'), 2, 2, [[0, 0, c.ash], [1, 1, c.ashDark]]);\n paint(textures, k('ash_2'), 1, 2, [[0, 0, c.ember], [0, 1, c.emberDeep]]);\n paint(textures, k('fog_0'), 72, 14, mistPixels(72, 14, 7, c.mist));\n paint(textures, k('fog_1'), 56, 12, mistPixels(56, 12, 31, c.mist));\n return {\n rain: { motion: 'fall', max: 170, keys: [k('rain_0'), k('rain_1')], splash: [k('splash_0'), k('splash_1')], tint: 0x40506a, tintAlpha: 0.1 },\n // the big flake one in five, the big ash an ember one in seven\n snow: { motion: 'flake', max: 120, keys: [k('snow_2'), k('snow_1'), k('snow_0'), k('snow_1'), k('snow_0')], sway: 5, tint: 0xd8e4f0, tintAlpha: 0.08 },\n ash: {\n motion: 'flake',\n max: 90,\n keys: [k('ash_2'), k('ash_1'), k('ash_0'), k('ash_1'), k('ash_0'), k('ash_1'), k('ash_0')],\n vx: [12, 24],\n vy: [10, 22],\n sway: 3,\n tint: 0x5a4a40,\n tintAlpha: 0.08,\n },\n fog: { motion: 'bank', max: 12, keys: [k('fog_0'), k('fog_1')], tint: 0xc8d0c4, tintAlpha: 0.24 },\n };\n}\n"],"names":["WEATHER_COLORS","mistPixels","w","h","seed","color","px","r","rand","y","x","nx","ny","d","paint","textures","key","pixels","c","g","paintWeatherArt","colors","prefix","k","name"],"mappings":"AAqBO,MAAMA,IAAgC;AAAA,EAC3C,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,MAAM;AAAA,EACN,WAAW;AAAA,EACX,UAAU;AAAA,EACV,KAAK;AAAA,EACL,SAAS;AAAA,EACT,OAAO;AAAA,EACP,WAAW;AAAA,EACX,MAAM;AACR;AAGO,SAASC,EAAWC,GAAWC,GAAWC,GAAcC,GAA+B;AAC5F,QAAMC,IAAqB,CAAA;AAC3B,MAAIC,IAAIH;AACR,QAAMI,IAAO,OACXD,IAAK,KAAK,KAAKA,GAAG,UAAU,IAAI,QAAS,YAClCA,IAAI;AAEb,WAASE,IAAI,GAAGA,IAAIN,GAAGM;AACrB,aAASC,IAAI,GAAGA,IAA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,QAAQ,KAAK,IAAI,MAAM,CAACA,EAAE,OAAO,GAAGA,EAAE,OAAO,CAAC,GAAG,MAAM,UAAU,WAAW,KAAA;AAAA,EAAK;AAEpG;"}
|
package/dist/pixel.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { PixelLayer as i, addPixelLayer as a } from "./pixel/PixelLayer.js";
|
|
2
|
+
import { CLEAR as m, PixelGrid as x, PixelWindow as s, channels as l, hash2 as f, hex as h, makeSheet as n, mix as d, mulberry32 as P, rgba as R, shade as g, toCss as A, upscale as L, valueNoise as E, withAlpha as S } from "./pixel/pixel.js";
|
|
3
|
+
import { P as T } from "./pixel/palette.js";
|
|
4
|
+
import { art as O, groundShadow as _, litOutline as c, shadeBox as v } from "./pixel/propKit.js";
|
|
5
|
+
import { MATERIALS as w, RAMP_FACTOR_SET as y, hueShade as C, outlineOf as W, ramp as k, rampTones as H, registerMaterial as N } from "./pixel/ramp.js";
|
|
6
|
+
import { selectiveOutline as D } from "./pixel/selout.js";
|
|
7
|
+
import * as e from "./pixel/pixelPaint.js";
|
|
8
|
+
import * as r from "./pixel/pixelTone.js";
|
|
9
|
+
import { registerHandRamps as G } from "./pixel/pixelTone.js";
|
|
10
|
+
import { paintLayer as q } from "./pixel/paintLayer.js";
|
|
11
|
+
import { Evaporation as X } from "./pixel/Evaporation.js";
|
|
12
|
+
import { NO_PIXELS as z, PackedPixels as J, spritePixels as K } from "./pixel/spritePixels.js";
|
|
13
|
+
import { CARRIED_LIGHT as U, Darkness as Y, LAMP_DIM as Z, WARM_LIGHT as $ } from "./pixel/Darkness.js";
|
|
14
|
+
import { carriedLight as re, clearLights as te, flashLight as oe, liveLights as ie } from "./pixel/lights.js";
|
|
15
|
+
import { NightShade as pe } from "./pixel/NightShade.js";
|
|
16
|
+
import { WEATHER_COLORS as xe, mistPixels as se, paintWeatherArt as le } from "./pixel/weatherArt.js";
|
|
17
|
+
import { buildRig as he, complement as ne, gustAt as de, swayOffset as Pe, tileHash as Re, trunkPivot as ge } from "./pixel/swayRig.js";
|
|
18
|
+
import { SwayProp as Le, opaqueRowWidths as Ee } from "./pixel/SwayProp.js";
|
|
19
|
+
import { heartbeat as ue, vignetteMask as Te } from "./pixel/vignetteMask.js";
|
|
20
|
+
import { DitherVignette as Oe, ditherVignette as _e } from "./pixel/DitherVignette.js";
|
|
21
|
+
import { FRAME_CORNERS as ve, FRAME_TWINS as Ie, frameSvg as we, nineSlice as ye } from "./pixel/nineSlice.js";
|
|
22
|
+
export {
|
|
23
|
+
U as CARRIED_LIGHT,
|
|
24
|
+
m as CLEAR,
|
|
25
|
+
Y as Darkness,
|
|
26
|
+
Oe as DitherVignette,
|
|
27
|
+
X as Evaporation,
|
|
28
|
+
ve as FRAME_CORNERS,
|
|
29
|
+
Ie as FRAME_TWINS,
|
|
30
|
+
Z as LAMP_DIM,
|
|
31
|
+
w as MATERIALS,
|
|
32
|
+
z as NO_PIXELS,
|
|
33
|
+
pe as NightShade,
|
|
34
|
+
T as PALETTE,
|
|
35
|
+
J as PackedPixels,
|
|
36
|
+
x as PixelGrid,
|
|
37
|
+
i as PixelLayer,
|
|
38
|
+
s as PixelWindow,
|
|
39
|
+
y as RAMP_FACTOR_SET,
|
|
40
|
+
Le as SwayProp,
|
|
41
|
+
$ as WARM_LIGHT,
|
|
42
|
+
xe as WEATHER_COLORS,
|
|
43
|
+
a as addPixelLayer,
|
|
44
|
+
O as art,
|
|
45
|
+
he as buildRig,
|
|
46
|
+
re as carriedLight,
|
|
47
|
+
l as channels,
|
|
48
|
+
te as clearLights,
|
|
49
|
+
ne as complement,
|
|
50
|
+
_e as ditherVignette,
|
|
51
|
+
oe as flashLight,
|
|
52
|
+
we as frameSvg,
|
|
53
|
+
_ as groundShadow,
|
|
54
|
+
de as gustAt,
|
|
55
|
+
f as hash2,
|
|
56
|
+
ue as heartbeat,
|
|
57
|
+
h as hex,
|
|
58
|
+
C as hueShade,
|
|
59
|
+
c as litOutline,
|
|
60
|
+
ie as liveLights,
|
|
61
|
+
n as makeSheet,
|
|
62
|
+
se as mistPixels,
|
|
63
|
+
d as mix,
|
|
64
|
+
P as mulberry32,
|
|
65
|
+
ye as nineSlice,
|
|
66
|
+
Ee as opaqueRowWidths,
|
|
67
|
+
W as outlineOf,
|
|
68
|
+
q as paintLayer,
|
|
69
|
+
le as paintWeatherArt,
|
|
70
|
+
e as pixelPaint,
|
|
71
|
+
r as pixelTone,
|
|
72
|
+
k as ramp,
|
|
73
|
+
H as rampTones,
|
|
74
|
+
G as registerHandRamps,
|
|
75
|
+
N as registerMaterial,
|
|
76
|
+
R as rgba,
|
|
77
|
+
D as selectiveOutline,
|
|
78
|
+
g as shade,
|
|
79
|
+
v as shadeBox,
|
|
80
|
+
K as spritePixels,
|
|
81
|
+
Pe as swayOffset,
|
|
82
|
+
Re as tileHash,
|
|
83
|
+
A as toCss,
|
|
84
|
+
ge as trunkPivot,
|
|
85
|
+
L as upscale,
|
|
86
|
+
E as valueNoise,
|
|
87
|
+
Te as vignetteMask,
|
|
88
|
+
S as withAlpha
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=pixel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pixel.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { detectTouch as r } from "../input/touchDetect.js";
|
|
2
|
+
let t = null, n = !1, o = "engine.touch";
|
|
3
|
+
function u(e) {
|
|
4
|
+
n = e, t = null;
|
|
5
|
+
}
|
|
6
|
+
function l(e) {
|
|
7
|
+
o = e, t = null;
|
|
8
|
+
}
|
|
9
|
+
function i() {
|
|
10
|
+
try {
|
|
11
|
+
const e = new URLSearchParams(window.location.search).get("touch");
|
|
12
|
+
return e !== null ? e : localStorage.getItem(o);
|
|
13
|
+
} catch {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function c() {
|
|
18
|
+
return {
|
|
19
|
+
native: n,
|
|
20
|
+
coarse: typeof matchMedia == "function" && matchMedia("(pointer: coarse)").matches,
|
|
21
|
+
touchPoints: typeof navigator < "u" ? navigator.maxTouchPoints ?? 0 : 0,
|
|
22
|
+
override: i()
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function d() {
|
|
26
|
+
return t === null && (t = typeof window < "u" && r(c())), t;
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
d as isTouchUi,
|
|
30
|
+
u as setNativeShell,
|
|
31
|
+
l as setTouchOverrideKey
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=touch.js.map
|