@fleox/agent3d 0.0.0-stage → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +143 -0
- package/README.md +396 -2
- package/changelog.json +68 -0
- package/dist/agent/agent3d.mjs +11242 -0
- package/dist/agent/chunks/assets-BUUM9TUB.mjs +2448 -0
- package/dist/agent/chunks/browser-t_JL_B82.mjs +226 -0
- package/dist/agent/chunks/cdp-Bdtm4fBN.mjs +178 -0
- package/dist/agent/chunks/check-CBO3Ekx1.mjs +971 -0
- package/dist/agent/chunks/export-BCI8vKw8.mjs +1130 -0
- package/dist/agent/chunks/gif-DQznzHTL.mjs +319 -0
- package/dist/agent/chunks/gltf-f_f0-OiV.mjs +207 -0
- package/dist/agent/chunks/imageCodec-Dz9PFxi9.mjs +101 -0
- package/dist/agent/chunks/jsonPath-DUCe1JpS.mjs +155 -0
- package/dist/agent/chunks/meshoptimizer-C-tN9jn5.mjs +1165 -0
- package/dist/agent/chunks/mp4-aOALfp3s.mjs +130 -0
- package/dist/agent/chunks/objects-DBAws7uf.mjs +53 -0
- package/dist/agent/chunks/optimizeSizing-CkZ3fZRp.mjs +540 -0
- package/dist/agent/chunks/package-BOIyp_2B.mjs +75 -0
- package/dist/agent/chunks/png-DXfSGJZt.mjs +91 -0
- package/dist/agent/chunks/render-CN4mgGLQ.mjs +1511 -0
- package/dist/agent/chunks/rolldown-runtime-ebOQtxsr.mjs +18 -0
- package/dist/agent/chunks/scene-BgajNvBf.mjs +444 -0
- package/dist/agent/chunks/server-CACCerkZ.mjs +237 -0
- package/dist/agent/chunks/suggest-Cpcgv1RP.mjs +46 -0
- package/dist/agent/chunks/tools-DT2tetIK.mjs +1412 -0
- package/dist/agent/chunks/tree-BrNYGui2.mjs +75 -0
- package/dist/agent/chunks/webpAnim-qaq9YgKl.mjs +132 -0
- package/dist/runtime/agent3d-runtime.js +373 -0
- package/dist/runtime/agent3d-runtime.single.js +7360 -0
- package/dist/runtime/chunks/BufferGeometryUtils-XmME4f7Z.js +1 -0
- package/dist/runtime/chunks/EXRLoader-CBdIpBMT.js +1 -0
- package/dist/runtime/chunks/FontLoader-dVu9WH2X.js +2 -0
- package/dist/runtime/chunks/GLTFLoader-Z9Inv-Xm.js +1 -0
- package/dist/runtime/chunks/GroundedSkybox-g1ASZWNu.js +1 -0
- package/dist/runtime/chunks/HDRLoader-DBOMWa7O.js +5 -0
- package/dist/runtime/chunks/OrbitControls-BIpWXK4x.js +1 -0
- package/dist/runtime/chunks/RectAreaLightUniformsLib-4ZzgX9vp.js +1 -0
- package/dist/runtime/chunks/RoomEnvironment-CXgfLJdO.js +1 -0
- package/dist/runtime/chunks/RoundedBoxGeometry-BViRogcJ.js +1 -0
- package/dist/runtime/chunks/SVGLoader-CV0U1EIF.js +1 -0
- package/dist/runtime/chunks/SkeletonUtils-DHlReJx3.js +1 -0
- package/dist/runtime/chunks/Sky-DGJXlPb_.js +243 -0
- package/dist/runtime/chunks/audio-DbVNbf-r.js +1 -0
- package/dist/runtime/chunks/catalog-DL6sgPay.js +1 -0
- package/dist/runtime/chunks/easing-CXSz2e6P.js +1 -0
- package/dist/runtime/chunks/extrude-D6WnITQq.js +1 -0
- package/dist/runtime/chunks/game-BoEiyZrL.js +20 -0
- package/dist/runtime/chunks/generators-D5JUo0jp.js +331 -0
- package/dist/runtime/chunks/materials-Dn-bYrZd.js +107 -0
- package/dist/runtime/chunks/meshGradient.glsl-BMatplLA.js +88 -0
- package/dist/runtime/chunks/meshopt_decoder.module-DXTYc6wn.js +1 -0
- package/dist/runtime/chunks/model-BCVF3QzB.js +1 -0
- package/dist/runtime/chunks/params-C2uoUDJ0.js +1 -0
- package/dist/runtime/chunks/physicsHost-ChPgysMQ.js +1 -0
- package/dist/runtime/chunks/postfx-UgKCbmZs.js +1527 -0
- package/dist/runtime/chunks/postfx-i_J5Vf-l.js +1 -0
- package/dist/runtime/chunks/random-eeej60NW.js +1 -0
- package/dist/runtime/chunks/shaders-Dw6zHdu_.js +443 -0
- package/dist/runtime/chunks/svg-CmlFY_8O.js +1 -0
- package/dist/runtime/chunks/text-D1EQpdSU.js +2 -0
- package/dist/runtime/chunks/three.module-DnaBiDAJ.js +4225 -0
- package/dist/runtime/chunks/toon-BsvVk_nK.js +6 -0
- package/dist/runtime/chunks/util-CyaW1fcW.js +1 -0
- package/dist/studio/assets/BufferGeometryUtils-CAlXAboW.js +1 -0
- package/dist/studio/assets/EXRLoader-BKkzlNd8.js +1 -0
- package/dist/studio/assets/FontLoader-Bzjx8mXt.js +2 -0
- package/dist/studio/assets/GLTFLoader-1Zd9N406.js +1 -0
- package/dist/studio/assets/GroundedSkybox-BEMqNCBD.js +1 -0
- package/dist/studio/assets/HDRLoader-DxB0kxPH.js +5 -0
- package/dist/studio/assets/OrbitControls-MlE9XiCg.js +1 -0
- package/dist/studio/assets/RectAreaLightUniformsLib-ClHrtYY6.js +1 -0
- package/dist/studio/assets/RoomEnvironment-MJ-jIEC8.js +1 -0
- package/dist/studio/assets/SVGLoader-CIYl0nEy.js +1 -0
- package/dist/studio/assets/SkeletonUtils-CG5akqME.js +1 -0
- package/dist/studio/assets/Sky-DNMfpp92.js +243 -0
- package/dist/studio/assets/audio-JD1kyX0A.js +1 -0
- package/dist/studio/assets/camera-7sEn13L-.js +2 -0
- package/dist/studio/assets/editor-CnbvVkhU.js +53 -0
- package/dist/studio/assets/extrude-9bG8hr2C.js +1 -0
- package/dist/studio/assets/game-B04KGAK0.js +19 -0
- package/dist/studio/assets/generators-LSni1Yfc.js +331 -0
- package/dist/studio/assets/index-3LL5NEIH.js +479 -0
- package/dist/studio/assets/index-BQT0otii.css +1 -0
- package/dist/studio/assets/meshopt_decoder.module-DXTYc6wn.js +1 -0
- package/dist/studio/assets/meshoptimizer-BCSwHBL3.js +1 -0
- package/dist/studio/assets/model-CNddhwmA.js +2 -0
- package/dist/studio/assets/physicsHost-hMU_SDiX.js +1 -0
- package/dist/studio/assets/postfx-BcCZS0Bq.js +1527 -0
- package/dist/studio/assets/runtime-DY_KqD1x.js +572 -0
- package/dist/studio/assets/shaders-BhMCstyv.js +443 -0
- package/dist/studio/assets/svg-CNKK-h7H.js +2 -0
- package/dist/studio/assets/text-BSPI7dk1.js +3 -0
- package/dist/studio/assets/three.module-CnI50X0U.js +4225 -0
- package/dist/studio/index.html +16 -0
- package/library/LICENSES.md +77 -0
- package/library/fonts/LICENSES.md +42 -0
- package/library/fonts/anton.typeface.json +1 -0
- package/library/fonts/bebas-neue.typeface.json +1 -0
- package/library/fonts/display.typeface.json +1 -0
- package/library/fonts/inter-black.typeface.json +1 -0
- package/library/fonts/lobster.typeface.json +1 -0
- package/library/fonts/mono.typeface.json +1 -0
- package/library/fonts/montserrat-extrabold.typeface.json +1 -0
- package/library/fonts/pacifico.typeface.json +1 -0
- package/library/fonts/sans-bold.typeface.json +1 -0
- package/library/fonts/sans.typeface.json +1 -0
- package/library/fonts/serif-bold.typeface.json +1 -0
- package/library/fonts/serif.typeface.json +1 -0
- package/library/fonts/space-grotesk-bold.typeface.json +1 -0
- package/library/hdri/beach.hdr +0 -0
- package/library/hdri/beach.jpg +0 -0
- package/library/hdri/city.hdr +0 -0
- package/library/hdri/city.jpg +0 -0
- package/library/hdri/forest.hdr +0 -0
- package/library/hdri/forest.jpg +0 -0
- package/library/hdri/night-city.hdr +0 -0
- package/library/hdri/night-city.jpg +0 -0
- package/library/hdri/night.hdr +0 -0
- package/library/hdri/night.jpg +0 -0
- package/library/hdri/sky.hdr +0 -0
- package/library/hdri/sky.jpg +0 -0
- package/library/hdri/softbox.hdr +0 -0
- package/library/hdri/softbox.jpg +0 -0
- package/library/hdri/studio.hdr +0 -0
- package/library/hdri/studio.jpg +0 -0
- package/library/hdri/sunset.hdr +0 -0
- package/library/hdri/sunset.jpg +0 -0
- package/library/hdri/warehouse.hdr +0 -0
- package/library/hdri/warehouse.jpg +0 -0
- package/library/index.json +5510 -0
- package/library/models/animals/fish.glb +0 -0
- package/library/models/animals/fox.glb +0 -0
- package/library/models/buildings/castle.glb +0 -0
- package/library/models/buildings/house.glb +0 -0
- package/library/models/buildings/market.glb +0 -0
- package/library/models/buildings/tavern.glb +0 -0
- package/library/models/buildings/tower.glb +0 -0
- package/library/models/buildings/windmill.glb +0 -0
- package/library/models/characters/barbarian.glb +0 -0
- package/library/models/characters/knight.glb +0 -0
- package/library/models/characters/mage.glb +0 -0
- package/library/models/characters/mini-soldier.glb +0 -0
- package/library/models/characters/platformer-hero.glb +0 -0
- package/library/models/characters/robot.glb +0 -0
- package/library/models/characters/rogue.glb +0 -0
- package/library/models/characters/skeleton.glb +0 -0
- package/library/models/city/building-a.glb +0 -0
- package/library/models/city/building-b.glb +0 -0
- package/library/models/city/building-tall.glb +0 -0
- package/library/models/city/fire-hydrant.glb +0 -0
- package/library/models/city/road-corner.glb +0 -0
- package/library/models/city/road-crossing.glb +0 -0
- package/library/models/city/road-junction.glb +0 -0
- package/library/models/city/road-straight.glb +0 -0
- package/library/models/city/streetlight.glb +0 -0
- package/library/models/city/suburban-house.glb +0 -0
- package/library/models/city/traffic-light.glb +0 -0
- package/library/models/city/water-tower.glb +0 -0
- package/library/models/food/apple.glb +0 -0
- package/library/models/food/avocado.glb +0 -0
- package/library/models/food/baguette.glb +0 -0
- package/library/models/food/bread-loaf.glb +0 -0
- package/library/models/food/burger.glb +0 -0
- package/library/models/food/carrot.glb +0 -0
- package/library/models/food/cheese.glb +0 -0
- package/library/models/food/cookie.glb +0 -0
- package/library/models/food/croissant.glb +0 -0
- package/library/models/food/cupcake.glb +0 -0
- package/library/models/food/dinner-plate.glb +0 -0
- package/library/models/food/donut.glb +0 -0
- package/library/models/food/ketchup.glb +0 -0
- package/library/models/food/mug.glb +0 -0
- package/library/models/food/pain-au-chocolat.glb +0 -0
- package/library/models/food/stew.glb +0 -0
- package/library/models/food/tomato.glb +0 -0
- package/library/models/food/veggie-burger.glb +0 -0
- package/library/models/nature/bush.glb +0 -0
- package/library/models/nature/cactus.glb +0 -0
- package/library/models/nature/cloud.glb +0 -0
- package/library/models/nature/fir-tree.glb +0 -0
- package/library/models/nature/forest-patch.glb +0 -0
- package/library/models/nature/grass-small.glb +0 -0
- package/library/models/nature/grass.glb +0 -0
- package/library/models/nature/hex-grass.glb +0 -0
- package/library/models/nature/hex-water.glb +0 -0
- package/library/models/nature/hills.glb +0 -0
- package/library/models/nature/mountain.glb +0 -0
- package/library/models/nature/pine-autumn.glb +0 -0
- package/library/models/nature/pine-tree.glb +0 -0
- package/library/models/nature/pumpkin.glb +0 -0
- package/library/models/nature/rock-flat.glb +0 -0
- package/library/models/nature/rock.glb +0 -0
- package/library/models/nature/tree-dead.glb +0 -0
- package/library/models/nature/tree-slim.glb +0 -0
- package/library/models/nature/trees-cluster.glb +0 -0
- package/library/models/nature/waterlily.glb +0 -0
- package/library/models/platformer/blaster.glb +0 -0
- package/library/models/platformer/block-coin.glb +0 -0
- package/library/models/platformer/brick.glb +0 -0
- package/library/models/platformer/coin.glb +0 -0
- package/library/models/platformer/enemy-flying.glb +0 -0
- package/library/models/platformer/flag.glb +0 -0
- package/library/models/platformer/platform-falling.glb +0 -0
- package/library/models/platformer/platform-grass-round.glb +0 -0
- package/library/models/platformer/platform-large.glb +0 -0
- package/library/models/platformer/platform-medium.glb +0 -0
- package/library/models/platformer/platform.glb +0 -0
- package/library/models/platformer/target.glb +0 -0
- package/library/models/platformer/track-corner.glb +0 -0
- package/library/models/platformer/track-straight.glb +0 -0
- package/library/models/platformer/wall-low.glb +0 -0
- package/library/models/products/boombox.glb +0 -0
- package/library/models/products/iridescent-lamp.glb +0 -0
- package/library/models/products/lantern.glb +0 -0
- package/library/models/products/lounge-chair.glb +0 -0
- package/library/models/products/sneaker.glb +0 -0
- package/library/models/products/velvet-sofa.glb +0 -0
- package/library/models/products/water-bottle.glb +0 -0
- package/library/models/props/alarm-clock.glb +0 -0
- package/library/models/props/armchair.glb +0 -0
- package/library/models/props/barrel.glb +0 -0
- package/library/models/props/bench.glb +0 -0
- package/library/models/props/brass-vase.glb +0 -0
- package/library/models/props/chest.glb +0 -0
- package/library/models/props/coffee-table.glb +0 -0
- package/library/models/props/coin-stack.glb +0 -0
- package/library/models/props/coin.glb +0 -0
- package/library/models/props/couch.glb +0 -0
- package/library/models/props/crate.glb +0 -0
- package/library/models/props/flag.glb +0 -0
- package/library/models/props/gravestone.glb +0 -0
- package/library/models/props/key.glb +0 -0
- package/library/models/props/lamp.glb +0 -0
- package/library/models/props/lantern.glb +0 -0
- package/library/models/props/marble-bust.glb +0 -0
- package/library/models/props/modern-armchair.glb +0 -0
- package/library/models/props/potted-succulent.glb +0 -0
- package/library/models/props/rubber-duck.glb +0 -0
- package/library/models/props/shield.glb +0 -0
- package/library/models/props/sword-shield.glb +0 -0
- package/library/models/props/sword.glb +0 -0
- package/library/models/props/table.glb +0 -0
- package/library/models/props/tent.glb +0 -0
- package/library/models/props/torch.glb +0 -0
- package/library/models/props/trophy.glb +0 -0
- package/library/models/space/base-module.glb +0 -0
- package/library/models/space/lander.glb +0 -0
- package/library/models/space/landing-pad.glb +0 -0
- package/library/models/space/rocks.glb +0 -0
- package/library/models/space/solar-panel.glb +0 -0
- package/library/models/space/space-truck.glb +0 -0
- package/library/models/space/wind-turbine.glb +0 -0
- package/library/models/vehicles/car.glb +0 -0
- package/library/models/vehicles/hatchback.glb +0 -0
- package/library/models/vehicles/motorcycle.glb +0 -0
- package/library/models/vehicles/police-car.glb +0 -0
- package/library/models/vehicles/taxi.glb +0 -0
- package/library/models/vehicles/truck.glb +0 -0
- package/library/sources.json +2856 -0
- package/library/textures/brick-color.jpg +0 -0
- package/library/textures/brick-normal.jpg +0 -0
- package/library/textures/brick-roughness.jpg +0 -0
- package/library/textures/concrete-color.jpg +0 -0
- package/library/textures/concrete-normal.jpg +0 -0
- package/library/textures/concrete-roughness.jpg +0 -0
- package/library/textures/fabric-color.jpg +0 -0
- package/library/textures/fabric-normal.jpg +0 -0
- package/library/textures/fabric-roughness.jpg +0 -0
- package/library/textures/grass-ground-color.jpg +0 -0
- package/library/textures/grass-ground-normal.jpg +0 -0
- package/library/textures/grass-ground-roughness.jpg +0 -0
- package/library/textures/rusty-metal-color.jpg +0 -0
- package/library/textures/rusty-metal-normal.jpg +0 -0
- package/library/textures/rusty-metal-roughness.jpg +0 -0
- package/library/textures/wood-planks-color.jpg +0 -0
- package/library/textures/wood-planks-normal.jpg +0 -0
- package/library/textures/wood-planks-roughness.jpg +0 -0
- package/package.json +67 -4
- package/plugin/.claude-plugin/plugin.json +19 -0
- package/plugin/skills/agent3d-assets/SKILL.md +140 -0
- package/plugin/skills/agent3d-assets/references/sources.md +33 -0
- package/plugin/skills/agent3d-create/SKILL.md +141 -0
- package/plugin/skills/agent3d-create/references/art-direction.md +144 -0
- package/plugin/skills/agent3d-create/references/recipes.md +1357 -0
- package/plugin/skills/agent3d-edit/SKILL.md +121 -0
- package/plugin/skills/agent3d-edit/references/patch-ops.md +278 -0
- package/plugin/skills/agent3d-game/SKILL.md +111 -0
- package/plugin/skills/agent3d-game/references/game-patterns.md +262 -0
- package/plugin/skills/agent3d-game/references/script-api.md +211 -0
- package/plugin/skills/agent3d-publish/SKILL.md +161 -0
- package/plugin/skills/agent3d-publish/references/integrations.md +221 -0
- package/templates/banner-aurora-night/README.md +15 -0
- package/templates/banner-aurora-night/agent3d.json +8 -0
- package/templates/banner-aurora-night/preview.png +0 -0
- package/templates/banner-aurora-night/scene.json +327 -0
- package/templates/banner-aurora-night/template.json +24 -0
- package/templates/banner-data-bars/README.md +15 -0
- package/templates/banner-data-bars/agent3d.json +8 -0
- package/templates/banner-data-bars/preview.png +0 -0
- package/templates/banner-data-bars/scene.json +222 -0
- package/templates/banner-data-bars/template.json +25 -0
- package/templates/banner-floating-shapes/README.md +15 -0
- package/templates/banner-floating-shapes/agent3d.json +8 -0
- package/templates/banner-floating-shapes/preview.png +0 -0
- package/templates/banner-floating-shapes/scene.json +703 -0
- package/templates/banner-floating-shapes/template.json +24 -0
- package/templates/banner-gradient-blob/README.md +16 -0
- package/templates/banner-gradient-blob/agent3d.json +8 -0
- package/templates/banner-gradient-blob/preview.png +0 -0
- package/templates/banner-gradient-blob/scene.json +330 -0
- package/templates/banner-gradient-blob/template.json +21 -0
- package/templates/banner-liquid-chrome/README.md +16 -0
- package/templates/banner-liquid-chrome/agent3d.json +8 -0
- package/templates/banner-liquid-chrome/preview.png +0 -0
- package/templates/banner-liquid-chrome/scene.json +290 -0
- package/templates/banner-liquid-chrome/template.json +24 -0
- package/templates/banner-logo-extrude/README.md +24 -0
- package/templates/banner-logo-extrude/agent3d.json +8 -0
- package/templates/banner-logo-extrude/assets/logo.svg +6 -0
- package/templates/banner-logo-extrude/assets/manifest.json +13 -0
- package/templates/banner-logo-extrude/preview.png +0 -0
- package/templates/banner-logo-extrude/scene.json +332 -0
- package/templates/banner-logo-extrude/template.json +22 -0
- package/templates/banner-neon-title/README.md +18 -0
- package/templates/banner-neon-title/agent3d.json +8 -0
- package/templates/banner-neon-title/preview.png +0 -0
- package/templates/banner-neon-title/scene.json +494 -0
- package/templates/banner-neon-title/template.json +25 -0
- package/templates/banner-wave-grid/README.md +18 -0
- package/templates/banner-wave-grid/agent3d.json +8 -0
- package/templates/banner-wave-grid/preview.png +0 -0
- package/templates/banner-wave-grid/scene.json +217 -0
- package/templates/banner-wave-grid/template.json +23 -0
- package/templates/card-hover-3d/README.md +16 -0
- package/templates/card-hover-3d/agent3d.json +8 -0
- package/templates/card-hover-3d/preview.png +0 -0
- package/templates/card-hover-3d/scene.json +359 -0
- package/templates/card-hover-3d/template.json +21 -0
- package/templates/card-product-tilt/README.md +14 -0
- package/templates/card-product-tilt/agent3d.json +8 -0
- package/templates/card-product-tilt/preview.png +0 -0
- package/templates/card-product-tilt/scene.json +296 -0
- package/templates/card-product-tilt/template.json +23 -0
- package/templates/character-mascot-hero/README.md +19 -0
- package/templates/character-mascot-hero/agent3d.json +8 -0
- package/templates/character-mascot-hero/preview.png +0 -0
- package/templates/character-mascot-hero/scene.json +512 -0
- package/templates/character-mascot-hero/template.json +8 -0
- package/templates/character-showcase/README.md +27 -0
- package/templates/character-showcase/agent3d.json +8 -0
- package/templates/character-showcase/preview.png +0 -0
- package/templates/character-showcase/scene.json +440 -0
- package/templates/character-showcase/template.json +24 -0
- package/templates/diorama-city/README.md +21 -0
- package/templates/diorama-city/agent3d.json +8 -0
- package/templates/diorama-city/preview.png +0 -0
- package/templates/diorama-city/scene.json +432 -0
- package/templates/diorama-city/template.json +21 -0
- package/templates/game-basket/README.md +25 -0
- package/templates/game-basket/agent3d.json +8 -0
- package/templates/game-basket/preview.png +0 -0
- package/templates/game-basket/scene.json +640 -0
- package/templates/game-basket/scripts/basket.js +176 -0
- package/templates/game-basket/template.json +8 -0
- package/templates/game-coin-collector/README.md +28 -0
- package/templates/game-coin-collector/agent3d.json +8 -0
- package/templates/game-coin-collector/preview.png +0 -0
- package/templates/game-coin-collector/scene.json +900 -0
- package/templates/game-coin-collector/scripts/collector.js +210 -0
- package/templates/game-coin-collector/template.json +19 -0
- package/templates/game-maze/README.md +24 -0
- package/templates/game-maze/agent3d.json +8 -0
- package/templates/game-maze/preview.png +0 -0
- package/templates/game-maze/scene.json +315 -0
- package/templates/game-maze/scripts/maze.js +168 -0
- package/templates/game-maze/template.json +18 -0
- package/templates/game-physics-playground/README.md +30 -0
- package/templates/game-physics-playground/agent3d.json +8 -0
- package/templates/game-physics-playground/preview.png +0 -0
- package/templates/game-physics-playground/scene.json +1712 -0
- package/templates/game-physics-playground/scripts/playground.js +151 -0
- package/templates/game-physics-playground/template.json +19 -0
- package/templates/game-platformer/README.md +26 -0
- package/templates/game-platformer/agent3d.json +8 -0
- package/templates/game-platformer/preview.png +0 -0
- package/templates/game-platformer/scene.json +1063 -0
- package/templates/game-platformer/scripts/platformer.js +222 -0
- package/templates/game-platformer/template.json +8 -0
- package/templates/game-runner/README.md +30 -0
- package/templates/game-runner/agent3d.json +8 -0
- package/templates/game-runner/preview.png +0 -0
- package/templates/game-runner/scene.json +1317 -0
- package/templates/game-runner/scripts/runner.js +263 -0
- package/templates/game-runner/template.json +18 -0
- package/templates/game-tap-targets/README.md +21 -0
- package/templates/game-tap-targets/agent3d.json +8 -0
- package/templates/game-tap-targets/preview.png +0 -0
- package/templates/game-tap-targets/scene.json +924 -0
- package/templates/game-tap-targets/scripts/targets.js +159 -0
- package/templates/game-tap-targets/template.json +19 -0
- package/templates/hero-floating-island/README.md +18 -0
- package/templates/hero-floating-island/agent3d.json +8 -0
- package/templates/hero-floating-island/preview.png +0 -0
- package/templates/hero-floating-island/scene.json +658 -0
- package/templates/hero-floating-island/template.json +8 -0
- package/templates/hero-perfume-luxury/README.md +18 -0
- package/templates/hero-perfume-luxury/agent3d.json +8 -0
- package/templates/hero-perfume-luxury/preview.png +0 -0
- package/templates/hero-perfume-luxury/scene.json +529 -0
- package/templates/hero-perfume-luxury/template.json +27 -0
- package/templates/hero-product-turntable/README.md +16 -0
- package/templates/hero-product-turntable/agent3d.json +8 -0
- package/templates/hero-product-turntable/preview.png +0 -0
- package/templates/hero-product-turntable/scene.json +225 -0
- package/templates/hero-product-turntable/template.json +21 -0
- package/templates/hero-saas-globe/README.md +16 -0
- package/templates/hero-saas-globe/agent3d.json +8 -0
- package/templates/hero-saas-globe/preview.png +0 -0
- package/templates/hero-saas-globe/scene.json +318 -0
- package/templates/hero-saas-globe/template.json +24 -0
- package/templates/hero-scroll-story/README.md +26 -0
- package/templates/hero-scroll-story/agent3d.json +8 -0
- package/templates/hero-scroll-story/preview.png +0 -0
- package/templates/hero-scroll-story/scene.json +642 -0
- package/templates/hero-scroll-story/template.json +22 -0
- package/templates/hero-sneaker-showcase/README.md +19 -0
- package/templates/hero-sneaker-showcase/agent3d.json +8 -0
- package/templates/hero-sneaker-showcase/preview.png +0 -0
- package/templates/hero-sneaker-showcase/scene.json +523 -0
- package/templates/hero-sneaker-showcase/template.json +23 -0
- package/templates/hero-space-planet/README.md +17 -0
- package/templates/hero-space-planet/agent3d.json +8 -0
- package/templates/hero-space-planet/preview.png +0 -0
- package/templates/hero-space-planet/scene.json +330 -0
- package/templates/hero-space-planet/template.json +21 -0
- package/templates/landscape-island/README.md +21 -0
- package/templates/landscape-island/agent3d.json +8 -0
- package/templates/landscape-island/preview.png +0 -0
- package/templates/landscape-island/scene.json +716 -0
- package/templates/landscape-island/template.json +24 -0
- package/templates/landscape-night-galaxy/README.md +25 -0
- package/templates/landscape-night-galaxy/agent3d.json +8 -0
- package/templates/landscape-night-galaxy/preview.png +0 -0
- package/templates/landscape-night-galaxy/scene.json +403 -0
- package/templates/landscape-night-galaxy/template.json +8 -0
- package/templates/landscape-valley-sunset/README.md +20 -0
- package/templates/landscape-valley-sunset/agent3d.json +8 -0
- package/templates/landscape-valley-sunset/preview.png +0 -0
- package/templates/landscape-valley-sunset/scene.json +265 -0
- package/templates/landscape-valley-sunset/template.json +22 -0
- package/templates/scene-cozy-room/README.md +21 -0
- package/templates/scene-cozy-room/agent3d.json +8 -0
- package/templates/scene-cozy-room/preview.png +0 -0
- package/templates/scene-cozy-room/scene.json +728 -0
- package/templates/scene-cozy-room/template.json +8 -0
|
@@ -0,0 +1,1357 @@
|
|
|
1
|
+
# Recipes: showcase scenes
|
|
2
|
+
|
|
3
|
+
Each scene below passed `scene validate` (no errors, no warnings) and `check --render`, and was rendered and looked at (the README images in `docs/images/recipe-*.jpg` come from them). Start from the closest one, then change the brand parts (text, colours, model, URLs) with `scene patch` and render again:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx -y @fleox/agent3d@0.2.1 new my-scene --target hero --json
|
|
7
|
+
npx -y @fleox/agent3d@0.2.1 scene validate --project my-scene --file recipe.json --json
|
|
8
|
+
npx -y @fleox/agent3d@0.2.1 scene apply --project my-scene --file recipe.json --yes --json
|
|
9
|
+
npx -y @fleox/agent3d@0.2.1 check --render --project my-scene --json
|
|
10
|
+
npx -y @fleox/agent3d@0.2.1 render --project my-scene --sheet --count 4 --json
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Exact parameters of every rig, look, material, shader, generator and behaviour: `npx -y @fleox/agent3d@0.2.1 catalog <section> [id] --json`. Premium starting points per target kind: [art-direction.md](art-direction.md#premium-defaults).
|
|
14
|
+
|
|
15
|
+
## Product shot (1:1): softbox packshot
|
|
16
|
+
|
|
17
|
+
A library bottle on a ceramic pedestal, soft studio light, blurred contact shadow, slow turntable that the visitor can drag.
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"version": 1,
|
|
22
|
+
"id": "bottle-packshot",
|
|
23
|
+
"title": "Water bottle packshot",
|
|
24
|
+
"ariaLabel": "A reusable water bottle turning slowly on a ceramic pedestal in a soft studio; drag to look around",
|
|
25
|
+
"target": {"kind": "square", "aspect": "1:1", "reducedMotion": "static", "posterTime": 1.5},
|
|
26
|
+
"camera": {
|
|
27
|
+
"type": "perspective",
|
|
28
|
+
"fov": 28,
|
|
29
|
+
"position": [0, 1.2, 6.3],
|
|
30
|
+
"target": [0, 0.95, 0],
|
|
31
|
+
"controls": "orbit",
|
|
32
|
+
"orbitZoom": false,
|
|
33
|
+
"autoRotate": 10,
|
|
34
|
+
"orbitLimits": {"minPolar": 60, "maxPolar": 92}
|
|
35
|
+
},
|
|
36
|
+
"environment": {
|
|
37
|
+
"background": {"radial": ["#f3e4d4", "#c9ad94"], "center": [0.5, 0.62], "radius": 0.95, "grain": 0.02},
|
|
38
|
+
"lighting": "studio",
|
|
39
|
+
"rig": {"preset": "softbox", "intensity": 0.85, "rotation": -25},
|
|
40
|
+
"contactShadows": {"opacity": 0.6, "blur": 2.5},
|
|
41
|
+
"lightingIntensity": 0.8
|
|
42
|
+
},
|
|
43
|
+
"lights": [],
|
|
44
|
+
"objects": [
|
|
45
|
+
{
|
|
46
|
+
"id": "pedestal",
|
|
47
|
+
"kind": "mesh",
|
|
48
|
+
"geometry": {"type": "cylinder", "radiusTop": 1.1, "radiusBottom": 1.1, "height": 0.3, "segments": 96},
|
|
49
|
+
"position": [0, 0.15, 0],
|
|
50
|
+
"material": {"preset": "ceramic", "color": "#b8876a", "roughness": 0.35}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"id": "bottle",
|
|
54
|
+
"kind": "model",
|
|
55
|
+
"src": "library:models/products/water-bottle.glb",
|
|
56
|
+
"fit": 1.75,
|
|
57
|
+
"position": [0, 0.3, 0],
|
|
58
|
+
"castShadow": true,
|
|
59
|
+
"behaviours": [{"type": "hoverLift", "height": 0.12, "tilt": 5}]
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
"postfx": [{"type": "look", "preset": "product"}]
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
- The `softbox` rig gives long soft highlights; `"lighting": "studio"` adds reflections for zero bytes (`{ "hdri": "library:hdri/softbox.hdr" }` looks a bit richer but adds ~1.5 MB: over the 600 KB square budget).
|
|
67
|
+
- `contactShadows` grounds the object without a shadow-casting light; `look: product` adds AO, a crisp grade and supersampled stills (AO is dropped on the `low` tier).
|
|
68
|
+
- Knobs: `fit` (size), the pedestal `color` (keep it a tone of the background, not white: white ceramic blows out under a softbox), `rig.rotation` to move the highlight.
|
|
69
|
+
- Your own model: `assets add ./bottle.glb --license proprietary`, then `"src": "assets/models/bottle.glb"`; keep `fit`.
|
|
70
|
+
|
|
71
|
+
## Golden-hour landscape (21:9): physical sky, valley terrain, lake, birds
|
|
72
|
+
|
|
73
|
+
A low-poly valley at golden hour: a mirror lake on the valley floor, pine forests below a snow line, warm side light from a low physical sun just out of frame, haze in the valley, a V of birds crossing the sky, a slow camera sway.
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"version": 1,
|
|
78
|
+
"id": "golden-valley",
|
|
79
|
+
"title": "Golden-hour valley",
|
|
80
|
+
"ariaLabel": "A low-poly mountain valley at golden hour: a lake on the valley floor, pine forests, snowy peaks, haze and a flock of birds",
|
|
81
|
+
"seed": 8,
|
|
82
|
+
"target": {"kind": "hero", "aspect": "21:9", "reducedMotion": "slow", "posterTime": 0},
|
|
83
|
+
"camera": {
|
|
84
|
+
"type": "perspective",
|
|
85
|
+
"fov": 40,
|
|
86
|
+
"position": [0, 16, 68],
|
|
87
|
+
"target": [0, 7, -30],
|
|
88
|
+
"controls": "parallax",
|
|
89
|
+
"parallax": {"strength": 1, "smoothing": 0.95}
|
|
90
|
+
},
|
|
91
|
+
"environment": {
|
|
92
|
+
"background": {
|
|
93
|
+
"sky": {"preset": "golden-hour", "sun": {"elevation": 6, "azimuth": 125}, "clouds": 0.2}
|
|
94
|
+
},
|
|
95
|
+
"fog": {"density": 0.007, "height": 5, "falloff": 0.35}
|
|
96
|
+
},
|
|
97
|
+
"lights": [],
|
|
98
|
+
"objects": [
|
|
99
|
+
{
|
|
100
|
+
"id": "valley",
|
|
101
|
+
"kind": "generator",
|
|
102
|
+
"generator": "terrain",
|
|
103
|
+
"seed": 14,
|
|
104
|
+
"receiveShadow": true,
|
|
105
|
+
"params": {
|
|
106
|
+
"size": 130,
|
|
107
|
+
"resolution": 88,
|
|
108
|
+
"height": 30,
|
|
109
|
+
"scale": 1.3,
|
|
110
|
+
"shape": "valley",
|
|
111
|
+
"lowpoly": true,
|
|
112
|
+
"palette": ["#c9b48a", "#6b8f45", "#3f6b37", "#7a6c70", "#fbf6f1"],
|
|
113
|
+
"waterLevel": 2.6,
|
|
114
|
+
"waterPlane": false,
|
|
115
|
+
"snowHeight": 17
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"id": "lake",
|
|
120
|
+
"kind": "generator",
|
|
121
|
+
"generator": "water",
|
|
122
|
+
"position": [0, 2.6, 0],
|
|
123
|
+
"params": {
|
|
124
|
+
"size": 130,
|
|
125
|
+
"color": "#2a4a6e",
|
|
126
|
+
"shallowColor": "#9fc0d4",
|
|
127
|
+
"foamColor": "#fff1e0",
|
|
128
|
+
"waveHeight": 0.03,
|
|
129
|
+
"waveSpeed": 0.6,
|
|
130
|
+
"ripples": 0.8,
|
|
131
|
+
"reflections": true
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"id": "pines",
|
|
136
|
+
"kind": "generator",
|
|
137
|
+
"generator": "trees",
|
|
138
|
+
"seed": 3,
|
|
139
|
+
"castShadow": true,
|
|
140
|
+
"params": {
|
|
141
|
+
"count": 180,
|
|
142
|
+
"area": [120, 0, 120],
|
|
143
|
+
"style": "pine",
|
|
144
|
+
"minScale": 0.7,
|
|
145
|
+
"maxScale": 1.35,
|
|
146
|
+
"leafColors": ["#26492c", "#2f5a33", "#3c6b3a"],
|
|
147
|
+
"onTerrain": true,
|
|
148
|
+
"sway": true
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"id": "flock",
|
|
153
|
+
"kind": "generator",
|
|
154
|
+
"generator": "birds",
|
|
155
|
+
"position": [0, 20, -10],
|
|
156
|
+
"params": {
|
|
157
|
+
"count": 9,
|
|
158
|
+
"mode": "drift",
|
|
159
|
+
"formation": "v",
|
|
160
|
+
"area": [90, 2, 0],
|
|
161
|
+
"heading": 10,
|
|
162
|
+
"speed": 5,
|
|
163
|
+
"size": 1.2
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
],
|
|
167
|
+
"timeline": {
|
|
168
|
+
"duration": 14,
|
|
169
|
+
"loop": true,
|
|
170
|
+
"tracks": [
|
|
171
|
+
{
|
|
172
|
+
"target": "camera.position",
|
|
173
|
+
"keys": [[0, [-3, 16, 68]], [7, [3, 17, 66]], [14, [-3, 16, 68]]],
|
|
174
|
+
"ease": "inOutSine"
|
|
175
|
+
}
|
|
176
|
+
]
|
|
177
|
+
},
|
|
178
|
+
"postfx": [
|
|
179
|
+
{"type": "bloom", "strength": 0.25, "threshold": 0.9, "radius": 0.5},
|
|
180
|
+
{"type": "grading", "look": "warm", "intensity": 0.2, "saturation": 1.12, "contrast": 1.06},
|
|
181
|
+
{"type": "vignette", "darkness": 0.35},
|
|
182
|
+
{"type": "fxaa"}
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
- The `golden-hour` sky preset adds its own sun light (no `lights` needed) and lights the scene through `lighting: "sky"`. `sun.azimuth` is measured around Y from +Z: 0 = behind a camera on +Z (front light), 90 = from +X (the right), 180 = straight ahead in the frame (back light), 270 = from the left. A 21:9 frame at fov 40 shows about 180 ± 45: keep a low sun just outside it (here 125, light from the right) or above it; a low sun in frame with fog or bloom washes the image out.
|
|
188
|
+
- `shape: "valley"` gives a flat floor along z between mountain walls, closed by a range at the far end (a camera on +z looks down it); `basin` rings a central lake with mountains. `edgeFalloff` (default per shape) sinks the borders so no cut wall shows at the edge.
|
|
189
|
+
- The lake: `waterPlane: false` drops the terrain's own plane while `waterLevel` still shapes the shore and keeps trees out of it; the `water` object sits at `y = waterLevel`. `"reflections": true` makes it a mirror (keep `waveHeight` / `ripples` low); it renders the scene a second time each frame (half resolution on the `medium` tier, off on `low`), so the forest is 180 pines and the terrain 88 cells to stay at ~140 k triangles per frame, under the hero aim.
|
|
190
|
+
- `snowHeight` caps everything above an absolute altitude with the last palette colour; trees stay below it. Terrain, water and scatter generators (`trees`, `rocks`, `grass`, `flowers` with `onTerrain`) share one `position`: keep them at the origin and move the camera instead.
|
|
191
|
+
- `birds` is one instanced draw call: `drift` with `formation: "v"` crosses the sky along `heading` (keep `area` x wider than the view); `orbit` circles, `path` follows `points`. Dark birds read against a bright sky. (Particle presets such as `fireflies` are glowing dots, not birds.)
|
|
192
|
+
- Height fog (`height`, `falloff`) fills the valley while peaks stay crisp; density 0.005–0.02 for a hero, more reads as smog. No `look` here: `cinematic` adds an AO pre-pass (one more geometry pass per frame plus a costly GPU pass) that a wide view from afar barely shows; bloom + grading + vignette cost no geometry pass.
|
|
193
|
+
- Knobs: `sun.elevation` (3–12 for golden hour), terrain `seed` / `height` / `palette`, tree `count`, the flock `heading` and `count`.
|
|
194
|
+
|
|
195
|
+
## Neon title (16:9): rect panel lights, volumetric spot, bloom
|
|
196
|
+
|
|
197
|
+
Two glowing light strips framing a neon headline on a glossy floor, a haze beam from above.
|
|
198
|
+
|
|
199
|
+
```json
|
|
200
|
+
{
|
|
201
|
+
"version": 1,
|
|
202
|
+
"id": "neon-club",
|
|
203
|
+
"title": "Night Shift neon",
|
|
204
|
+
"ariaLabel": "The words NIGHT SHIFT in glowing neon between two light strips on a wet reflective floor",
|
|
205
|
+
"target": {"kind": "hero", "aspect": "16:9", "reducedMotion": "static", "posterTime": 2},
|
|
206
|
+
"camera": {
|
|
207
|
+
"type": "perspective",
|
|
208
|
+
"fov": 35,
|
|
209
|
+
"position": [0, 1.2, 10],
|
|
210
|
+
"target": [0, 1, 0],
|
|
211
|
+
"controls": "parallax",
|
|
212
|
+
"parallax": {"strength": 0.35, "smoothing": 0.92}
|
|
213
|
+
},
|
|
214
|
+
"environment": {
|
|
215
|
+
"background": "#05040d",
|
|
216
|
+
"lighting": "night",
|
|
217
|
+
"lightingIntensity": 0.4,
|
|
218
|
+
"fog": {"color": "#0b0820", "density": 0.04},
|
|
219
|
+
"ground": {"y": 0, "size": 40, "color": "#0a0912", "roughness": 0.25}
|
|
220
|
+
},
|
|
221
|
+
"lights": [
|
|
222
|
+
{
|
|
223
|
+
"id": "stripL",
|
|
224
|
+
"type": "rect",
|
|
225
|
+
"position": [-4.6, 1.7, -0.5],
|
|
226
|
+
"width": 0.12,
|
|
227
|
+
"height": 3.2,
|
|
228
|
+
"color": "#ff2fd6",
|
|
229
|
+
"intensity": 18,
|
|
230
|
+
"panel": true,
|
|
231
|
+
"target": [0, 1.6, 4]
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"id": "stripR",
|
|
235
|
+
"type": "rect",
|
|
236
|
+
"position": [4.6, 1.7, -0.5],
|
|
237
|
+
"width": 0.12,
|
|
238
|
+
"height": 3.2,
|
|
239
|
+
"color": "#3ee8ff",
|
|
240
|
+
"intensity": 18,
|
|
241
|
+
"panel": true,
|
|
242
|
+
"target": [0, 1.6, 4]
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"id": "beam",
|
|
246
|
+
"type": "spot",
|
|
247
|
+
"position": [0, 6, -1.5],
|
|
248
|
+
"target": [0, 0, 0],
|
|
249
|
+
"angle": 22,
|
|
250
|
+
"penumbra": 0.7,
|
|
251
|
+
"color": "#b9a8ff",
|
|
252
|
+
"intensity": 60,
|
|
253
|
+
"volumetric": {"intensity": 0.8}
|
|
254
|
+
}
|
|
255
|
+
],
|
|
256
|
+
"objects": [
|
|
257
|
+
{
|
|
258
|
+
"id": "title",
|
|
259
|
+
"kind": "text",
|
|
260
|
+
"text": "NIGHT SHIFT",
|
|
261
|
+
"font": "bebas-neue",
|
|
262
|
+
"size": 1.1,
|
|
263
|
+
"depth": 0.12,
|
|
264
|
+
"letterSpacing": 0.08,
|
|
265
|
+
"position": [0, 1.35, 0],
|
|
266
|
+
"material": {"preset": "neon", "color": "#ff4fdc", "emissive": "#ff2fd6", "emissiveIntensity": 2.6},
|
|
267
|
+
"behaviours": [{"type": "flicker", "amount": 0.12, "speed": 0.6}]
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"id": "tagline",
|
|
271
|
+
"kind": "text",
|
|
272
|
+
"text": "OPEN TILL DAWN",
|
|
273
|
+
"font": "space-grotesk-bold",
|
|
274
|
+
"size": 0.26,
|
|
275
|
+
"depth": 0,
|
|
276
|
+
"letterSpacing": 0.25,
|
|
277
|
+
"position": [0, 0.35, 0.2],
|
|
278
|
+
"material": {"preset": "neon", "color": "#9ff3ff", "emissive": "#3ee8ff", "emissiveIntensity": 1.6}
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"id": "haze",
|
|
282
|
+
"kind": "particles",
|
|
283
|
+
"preset": "dust",
|
|
284
|
+
"count": 120,
|
|
285
|
+
"area": [10, 4, 4],
|
|
286
|
+
"position": [0, 2, 0],
|
|
287
|
+
"size": 0.03,
|
|
288
|
+
"color": "#c9b8ff",
|
|
289
|
+
"opacity": 0.4
|
|
290
|
+
}
|
|
291
|
+
],
|
|
292
|
+
"postfx": [{"type": "look", "preset": "neon", "intensity": 0.7}]
|
|
293
|
+
}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
- `rect` lights with `"panel": true` are both the light and the visible strip; aim them with `target` (they face their target, so a target at the origin tilts them).
|
|
297
|
+
- The `neon` look is strong: emissive text above ~3 blows out into a pink fog, below ~1.5 has no halo. 2–2.6 with `intensity` 0.7 is the sweet spot; re-render after every change.
|
|
298
|
+
- A dark glossy `ground` (roughness 0.2–0.3) doubles every light as a reflection; exponential fog makes the volumetric cone read.
|
|
299
|
+
- Knobs: strip colours, `flicker` amount (keep it subtle), `beam.volumetric.intensity`.
|
|
300
|
+
|
|
301
|
+
## Mesh gradient banner (4:1)
|
|
302
|
+
|
|
303
|
+
A soft drifting gradient with glossy shapes on the sides and an outlined headline.
|
|
304
|
+
|
|
305
|
+
```json
|
|
306
|
+
{
|
|
307
|
+
"version": 1,
|
|
308
|
+
"id": "gradient-banner",
|
|
309
|
+
"title": "Mesh gradient banner",
|
|
310
|
+
"ariaLabel": "Soft drifting colour gradient with glossy floating shapes around the words Spring drop",
|
|
311
|
+
"target": {"kind": "banner", "aspect": "4:1", "reducedMotion": "static"},
|
|
312
|
+
"camera": {
|
|
313
|
+
"type": "perspective",
|
|
314
|
+
"fov": 30,
|
|
315
|
+
"position": [0, 0, 12],
|
|
316
|
+
"target": [0, 0, 0],
|
|
317
|
+
"controls": "parallax",
|
|
318
|
+
"parallax": {"strength": 0.3, "smoothing": 0.92}
|
|
319
|
+
},
|
|
320
|
+
"environment": {
|
|
321
|
+
"background": {
|
|
322
|
+
"meshGradient": ["#ff9a8b", "#ff6a88", "#a18cd1", "#fbc2eb", "#8fd3f4"],
|
|
323
|
+
"speed": 0.12,
|
|
324
|
+
"scale": 1.1,
|
|
325
|
+
"seed": 4,
|
|
326
|
+
"grain": 0.04
|
|
327
|
+
},
|
|
328
|
+
"lighting": "studio",
|
|
329
|
+
"lightingIntensity": 0.6
|
|
330
|
+
},
|
|
331
|
+
"lights": [
|
|
332
|
+
{"id": "key", "type": "directional", "position": [3, 5, 6], "intensity": 1.2},
|
|
333
|
+
{"id": "rim", "type": "directional", "position": [-4, 2, -4], "color": "#ffd6f0", "intensity": 1.2}
|
|
334
|
+
],
|
|
335
|
+
"objects": [
|
|
336
|
+
{
|
|
337
|
+
"id": "title",
|
|
338
|
+
"kind": "text",
|
|
339
|
+
"text": "Spring drop",
|
|
340
|
+
"font": "montserrat-extrabold",
|
|
341
|
+
"size": 1.25,
|
|
342
|
+
"depth": 0.25,
|
|
343
|
+
"letterSpacing": -0.02,
|
|
344
|
+
"material": {"type": "physical", "color": "#fff4fa", "roughness": 0.35, "clearcoat": 0.6},
|
|
345
|
+
"behaviours": [{"type": "float", "amplitude": 0.05, "speed": 0.3}],
|
|
346
|
+
"outline": {"width": 0.07, "color": "#4a1a6e", "depth": 0.12}
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
"id": "ring",
|
|
350
|
+
"kind": "mesh",
|
|
351
|
+
"geometry": {"type": "torus", "radius": 1, "tube": 0.36, "tubularSegments": 96},
|
|
352
|
+
"material": {"preset": "chromeGradient", "gradient": ["#7f5cff", "#ff5ca8", "#ffd36e"]},
|
|
353
|
+
"position": [-8.8, 0.3, -0.5],
|
|
354
|
+
"rotation": [55, 25, 0],
|
|
355
|
+
"behaviours": [
|
|
356
|
+
{"type": "float", "amplitude": 0.18, "speed": 0.25},
|
|
357
|
+
{"type": "rotate", "axis": [0.3, 1, 0.2], "speed": 14}
|
|
358
|
+
]
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
"id": "pearl",
|
|
362
|
+
"kind": "mesh",
|
|
363
|
+
"geometry": {"type": "sphere", "radius": 1.05, "segments": 64, "heightSegments": 32},
|
|
364
|
+
"material": {"preset": "pearl", "color": "#ffd9ef"},
|
|
365
|
+
"position": [8.8, -0.2, -0.5],
|
|
366
|
+
"behaviours": [{"type": "float", "amplitude": 0.2, "speed": 0.25, "phase": 0.5}]
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
"id": "halo",
|
|
370
|
+
"kind": "mesh",
|
|
371
|
+
"geometry": {"type": "torus", "radius": 0.35, "tube": 0.1, "tubularSegments": 64},
|
|
372
|
+
"material": {"preset": "mattePastel", "color": "#fff3c4"},
|
|
373
|
+
"position": [6.6, 1.7, -1.5],
|
|
374
|
+
"rotation": [70, 0, 20],
|
|
375
|
+
"behaviours": [
|
|
376
|
+
{"type": "float", "amplitude": 0.15, "speed": 0.3, "phase": 0.2},
|
|
377
|
+
{"type": "rotate", "axis": [0, 1, 0], "speed": 10}
|
|
378
|
+
]
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
"id": "dot",
|
|
382
|
+
"kind": "mesh",
|
|
383
|
+
"geometry": {"type": "sphere", "radius": 0.32},
|
|
384
|
+
"material": {"preset": "chromeGradient", "gradient": ["#8fd3f4", "#a18cd1"]},
|
|
385
|
+
"position": [-6.4, -1.7, -1],
|
|
386
|
+
"behaviours": [{"type": "float", "amplitude": 0.15, "speed": 0.35, "phase": 0.7}]
|
|
387
|
+
}
|
|
388
|
+
],
|
|
389
|
+
"postfx": [{"type": "look", "preset": "clean"}]
|
|
390
|
+
}
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
- `meshGradient` gives the Stripe-like background for zero bytes; `grain` hides banding.
|
|
394
|
+
- Light text on a light gradient needs an `outline` (or a dark text colour) to read; avoid bloom here: white text glows into the background.
|
|
395
|
+
- Props at abs(x) 7.6–8.8 stay outside the title (visible width ≈ 25.8 at z 0 with this camera).
|
|
396
|
+
- Transmission presets (`soapBubble`, `glass`, `jelly`, `diamond`) render the scene a second time behind them: a soap bubble here doubled the triangles per frame for a sphere that reads the same, so it is `pearl`.
|
|
397
|
+
- Knobs: the 5 gradient colours, `speed` (0 = still), `chromeGradient` ramps, `pearl` / `mattePastel` presets.
|
|
398
|
+
|
|
399
|
+
## Letter-reveal headline (16:9)
|
|
400
|
+
|
|
401
|
+
The title rises in letter by letter, a wave runs through it, then the last word turns gold.
|
|
402
|
+
|
|
403
|
+
```json
|
|
404
|
+
{
|
|
405
|
+
"version": 1,
|
|
406
|
+
"id": "launch-reveal",
|
|
407
|
+
"title": "Launch day headline",
|
|
408
|
+
"ariaLabel": "The headline LAUNCH DAY rises in letter by letter, then a wave runs through it and DAY turns gold",
|
|
409
|
+
"target": {"kind": "hero", "aspect": "16:9", "reducedMotion": "static", "posterTime": 3.2},
|
|
410
|
+
"camera": {
|
|
411
|
+
"type": "perspective",
|
|
412
|
+
"fov": 35,
|
|
413
|
+
"position": [0, 0.3, 10],
|
|
414
|
+
"target": [0, 0.2, 0],
|
|
415
|
+
"controls": "parallax",
|
|
416
|
+
"parallax": {"strength": 0.3, "smoothing": 0.92}
|
|
417
|
+
},
|
|
418
|
+
"environment": {
|
|
419
|
+
"background": {"radial": ["#2a2470", "#0b0a24"], "center": [0.5, 0.55], "radius": 0.9, "grain": 0.03},
|
|
420
|
+
"rig": {"preset": "studio-3point", "intensity": 1},
|
|
421
|
+
"lighting": "studio",
|
|
422
|
+
"lightingIntensity": 0.5
|
|
423
|
+
},
|
|
424
|
+
"lights": [],
|
|
425
|
+
"objects": [
|
|
426
|
+
{
|
|
427
|
+
"id": "title",
|
|
428
|
+
"kind": "text",
|
|
429
|
+
"text": "LAUNCH DAY",
|
|
430
|
+
"font": "inter-black",
|
|
431
|
+
"size": 0.85,
|
|
432
|
+
"depth": 0.3,
|
|
433
|
+
"letterSpacing": 0.02,
|
|
434
|
+
"position": [0, 0.25, 0],
|
|
435
|
+
"outline": {"width": 0.05, "color": "#120d2b"},
|
|
436
|
+
"material": {"type": "physical", "color": "#f4f1ff", "roughness": 0.3, "clearcoat": 1},
|
|
437
|
+
"reveal": {"effect": "rise", "stagger": 0.06, "duration": 0.8, "delay": 0.2, "order": "forward"}
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
"id": "sub",
|
|
441
|
+
"kind": "text",
|
|
442
|
+
"text": "March 14 - live at 9:00",
|
|
443
|
+
"font": "sans",
|
|
444
|
+
"size": 0.22,
|
|
445
|
+
"depth": 0,
|
|
446
|
+
"position": [0, -0.75, 0],
|
|
447
|
+
"material": {"type": "basic", "color": "#b9b3ff"},
|
|
448
|
+
"behaviours": [{"type": "appear", "effect": "fade", "duration": 0.8, "delay": 1.3}]
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
"id": "sparks",
|
|
452
|
+
"kind": "particles",
|
|
453
|
+
"preset": "stars",
|
|
454
|
+
"count": 120,
|
|
455
|
+
"area": [16, 9, 4],
|
|
456
|
+
"position": [0, 0, -3],
|
|
457
|
+
"size": 0.04,
|
|
458
|
+
"color": "#cfd6ff"
|
|
459
|
+
}
|
|
460
|
+
],
|
|
461
|
+
"timeline": {
|
|
462
|
+
"duration": 4,
|
|
463
|
+
"loop": false,
|
|
464
|
+
"tracks": [
|
|
465
|
+
{
|
|
466
|
+
"target": "children:title.position.y",
|
|
467
|
+
"keys": [[1.8, "+=0"], [2.05, "+=0.3", "outCubic"], [2.5, "+=0", "outBounce"]],
|
|
468
|
+
"stagger": 0.05
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
"target": "title/6,title/7,title/8.material.color",
|
|
472
|
+
"keys": [[2.4, "#f4f1ff"], [2.9, "#ffb02e", "outCubic"]],
|
|
473
|
+
"stagger": 0.1
|
|
474
|
+
}
|
|
475
|
+
]
|
|
476
|
+
},
|
|
477
|
+
"postfx": [{"type": "look", "preset": "cinematic", "intensity": 0.6}]
|
|
478
|
+
}
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
- `reveal` (implies `splitLetters`) makes each glyph an object `title/<n>` (non-space characters, from 0); a timeline can then target `children:title` (all letters) or a list like `title/6,title/7,title/8` with `stagger`.
|
|
482
|
+
- Relative keys (`"+=0.3"`) move letters from where the reveal left them; `outBounce` on the settle key gives the wave its snap.
|
|
483
|
+
- Colour keys blend in OKLCh by default (track `colorSpace`: `oklch`, `oklab`, `rgb`, `hsl`): white → amber stays clean and saturated instead of passing through a muddy mix.
|
|
484
|
+
- Pick a `posterTime` after the last animation (here 3.2) so the poster and reduced-motion still show the final state.
|
|
485
|
+
- Knobs: `reveal.effect` (rise, fade, scale, spin, drop), `order` (`center`, `random`), the accent colour and which letters get it.
|
|
486
|
+
|
|
487
|
+
## Scroll story (16:9): camera shots driven by scroll
|
|
488
|
+
|
|
489
|
+
A marble bust on a plinth; scrolling the page orbits the camera, pushes in on the face and cranes up, with a caption that rides with the camera and a HUD pill per chapter.
|
|
490
|
+
|
|
491
|
+
```json
|
|
492
|
+
{
|
|
493
|
+
"version": 1,
|
|
494
|
+
"id": "museum-scroll",
|
|
495
|
+
"title": "Marble bust scroll story",
|
|
496
|
+
"ariaLabel": "A classical marble bust on a plinth; scrolling the page orbits the camera around it, pushes in on the face and cranes up",
|
|
497
|
+
"target": {"kind": "hero", "aspect": "16:9", "reducedMotion": "static", "posterTime": 0},
|
|
498
|
+
"camera": {
|
|
499
|
+
"type": "perspective",
|
|
500
|
+
"fov": 32,
|
|
501
|
+
"position": [1.8, 1.75, 4.6],
|
|
502
|
+
"target": [0, 1.45, 0],
|
|
503
|
+
"shots": [
|
|
504
|
+
{"type": "orbit", "at": 0, "duration": 3, "angle": -50, "elevation": 4},
|
|
505
|
+
{"type": "pushIn", "at": 3, "duration": 3, "distance": 1.5},
|
|
506
|
+
{"type": "crane", "at": 6.5, "duration": 3.5, "height": 0.9, "distance": -1.2}
|
|
507
|
+
]
|
|
508
|
+
},
|
|
509
|
+
"environment": {
|
|
510
|
+
"background": {
|
|
511
|
+
"radial": ["#3a3430", "#121012"],
|
|
512
|
+
"center": [0.5, 0.6],
|
|
513
|
+
"radius": 0.85,
|
|
514
|
+
"grain": 0.03
|
|
515
|
+
},
|
|
516
|
+
"lighting": "studio",
|
|
517
|
+
"lightingIntensity": 0.35,
|
|
518
|
+
"rig": {"preset": "dramatic", "intensity": 1.3},
|
|
519
|
+
"contactShadows": {"opacity": 0.75, "blur": 2.5, "y": 0}
|
|
520
|
+
},
|
|
521
|
+
"lights": [],
|
|
522
|
+
"objects": [
|
|
523
|
+
{
|
|
524
|
+
"id": "plinth",
|
|
525
|
+
"kind": "mesh",
|
|
526
|
+
"geometry": {"type": "box", "width": 1, "height": 1, "depth": 1},
|
|
527
|
+
"position": [0, 0.5, 0],
|
|
528
|
+
"material": {"preset": "marble", "color": "#3a3632"},
|
|
529
|
+
"receiveShadow": true
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
"id": "bust",
|
|
533
|
+
"kind": "model",
|
|
534
|
+
"src": "library:models/props/marble-bust.glb",
|
|
535
|
+
"fit": 1.25,
|
|
536
|
+
"position": [0, 1, 0],
|
|
537
|
+
"castShadow": true
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
"id": "dust",
|
|
541
|
+
"kind": "particles",
|
|
542
|
+
"preset": "dust",
|
|
543
|
+
"count": 60,
|
|
544
|
+
"area": [5, 3, 3],
|
|
545
|
+
"position": [0, 1.8, 0],
|
|
546
|
+
"size": 0.02,
|
|
547
|
+
"color": "#ffe8cc",
|
|
548
|
+
"opacity": 0.35
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
"id": "caption",
|
|
552
|
+
"kind": "text",
|
|
553
|
+
"attach": "camera",
|
|
554
|
+
"text": "THE COLLECTION",
|
|
555
|
+
"font": "sans",
|
|
556
|
+
"size": 0.05,
|
|
557
|
+
"depth": 0,
|
|
558
|
+
"align": "left",
|
|
559
|
+
"letterSpacing": 0.015,
|
|
560
|
+
"position": [-0.75, -0.39, -2],
|
|
561
|
+
"material": {"type": "basic", "color": "#e8dccb"}
|
|
562
|
+
}
|
|
563
|
+
],
|
|
564
|
+
"timeline": {
|
|
565
|
+
"duration": 10,
|
|
566
|
+
"trigger": "scroll",
|
|
567
|
+
"loop": false,
|
|
568
|
+
"scroll": {"start": "top top", "end": "bottom top", "smoothing": 0.85},
|
|
569
|
+
"tracks": [],
|
|
570
|
+
"segments": {"overview": [0, 3], "portrait": [3, 6.5], "details": [6.5, 10]}
|
|
571
|
+
},
|
|
572
|
+
"postfx": [{"type": "look", "preset": "cinematic", "intensity": 0.8}],
|
|
573
|
+
"ui": {
|
|
574
|
+
"color": "#f4ede4",
|
|
575
|
+
"accent": "#c9a46a",
|
|
576
|
+
"elements": [
|
|
577
|
+
{
|
|
578
|
+
"id": "ch1",
|
|
579
|
+
"type": "text",
|
|
580
|
+
"style": "pill",
|
|
581
|
+
"anchor": "top-left",
|
|
582
|
+
"text": "01 · The piece",
|
|
583
|
+
"visible": "timeline.segment == 'overview'"
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
"id": "ch2",
|
|
587
|
+
"type": "text",
|
|
588
|
+
"style": "pill",
|
|
589
|
+
"anchor": "top-left",
|
|
590
|
+
"text": "02 · The face",
|
|
591
|
+
"visible": "timeline.segment == 'portrait'"
|
|
592
|
+
},
|
|
593
|
+
{
|
|
594
|
+
"id": "ch3",
|
|
595
|
+
"type": "text",
|
|
596
|
+
"style": "pill",
|
|
597
|
+
"anchor": "top-left",
|
|
598
|
+
"text": "03 · The marble",
|
|
599
|
+
"visible": "timeline.segment == 'details'",
|
|
600
|
+
"background": "#c9a46a",
|
|
601
|
+
"color": "#1a1410"
|
|
602
|
+
}
|
|
603
|
+
]
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
```
|
|
607
|
+
|
|
608
|
+
- With `trigger: "scroll"`, the timeline time is the scroll progress, and `camera.shots` run on that clock (no tracks needed). Shots chain: each starts from the pose the previous one left.
|
|
609
|
+
- In renders, the progress is `t / duration`: `render --count 4` shows the story at 0, 33, 67 and 100 % of the scroll.
|
|
610
|
+
- `"attach": "camera"` keeps the caption on screen while the shots move the camera: its `position` is in camera space (x right, y up, -z forward; `[-0.75, -0.39, -2]` = 2 units in front of the lens, lower left). Keep it closer to the lens than the subject, or the subject hides it during a push-in. `letterSpacing` is in scene units: scale it with `size`.
|
|
611
|
+
- HUD expressions read the timeline: `timeline.segment` (the chapter being scrolled through), `timeline.progress` (0..1), `timeline.time`, `timeline.marker`, so the pills need no script. Per-element `background` / `color` highlight one pill.
|
|
612
|
+
- `contactShadows.y` pins the shadow plane: without it the plane fits all objects, particles included, and may float below the subject.
|
|
613
|
+
- Knobs: shot `angle` / `distance` / `height`, `scroll.start` / `end` (ScrollTrigger-like), `smoothing`.
|
|
614
|
+
|
|
615
|
+
## Click-to-shop shelf (16:9): hover + openUrl interactions
|
|
616
|
+
|
|
617
|
+
Three pastries on stands; hovering one grows it, clicking opens its product page.
|
|
618
|
+
|
|
619
|
+
```json
|
|
620
|
+
{
|
|
621
|
+
"version": 1,
|
|
622
|
+
"id": "bakery-shelf",
|
|
623
|
+
"title": "Bakery shelf",
|
|
624
|
+
"ariaLabel": "Three pastries on pastel stands: a cupcake, a donut and a croissant with their prices; click one to open its shop page",
|
|
625
|
+
"target": {"kind": "hero", "aspect": "16:9", "reducedMotion": "static", "posterTime": 1},
|
|
626
|
+
"camera": {
|
|
627
|
+
"type": "perspective",
|
|
628
|
+
"fov": 30,
|
|
629
|
+
"position": [0, 2.5, 9.2],
|
|
630
|
+
"target": [0, 0.85, 0],
|
|
631
|
+
"controls": "parallax",
|
|
632
|
+
"parallax": {"strength": 0.25, "smoothing": 0.92}
|
|
633
|
+
},
|
|
634
|
+
"environment": {
|
|
635
|
+
"background": {"gradient": ["#ffe9ef", "#fff6ea"], "angle": 0, "grain": 0.02},
|
|
636
|
+
"lighting": "soft",
|
|
637
|
+
"lightingIntensity": 0.8,
|
|
638
|
+
"rig": {"preset": "softbox", "intensity": 0.9, "rotation": -15},
|
|
639
|
+
"contactShadows": {"opacity": 0.45, "blur": 2.5, "color": "#7a3a4c", "y": 0}
|
|
640
|
+
},
|
|
641
|
+
"lights": [],
|
|
642
|
+
"objects": [
|
|
643
|
+
{
|
|
644
|
+
"id": "headline",
|
|
645
|
+
"kind": "text",
|
|
646
|
+
"text": "Fresh this morning",
|
|
647
|
+
"font": "serif-bold",
|
|
648
|
+
"size": 0.5,
|
|
649
|
+
"depth": 0.08,
|
|
650
|
+
"position": [0, 2.35, -0.6],
|
|
651
|
+
"material": {"type": "standard", "color": "#7a2944", "roughness": 0.5}
|
|
652
|
+
},
|
|
653
|
+
{
|
|
654
|
+
"id": "cupcakeStand",
|
|
655
|
+
"kind": "mesh",
|
|
656
|
+
"geometry": {"type": "cylinder", "radiusTop": 0.9, "radiusBottom": 0.9, "height": 0.25, "segments": 64},
|
|
657
|
+
"position": [-2.6, 0.125, 0],
|
|
658
|
+
"material": {"preset": "clay", "color": "#f59ab5"}
|
|
659
|
+
},
|
|
660
|
+
{
|
|
661
|
+
"id": "cupcake",
|
|
662
|
+
"kind": "model",
|
|
663
|
+
"src": "library:models/food/cupcake.glb",
|
|
664
|
+
"fit": 1.3,
|
|
665
|
+
"position": [-2.6, 0.25, 0],
|
|
666
|
+
"castShadow": true,
|
|
667
|
+
"behaviours": [{"type": "float", "amplitude": 0.04, "speed": 0.4, "phase": -2.6}]
|
|
668
|
+
},
|
|
669
|
+
{
|
|
670
|
+
"id": "cupcakeLabel",
|
|
671
|
+
"kind": "text",
|
|
672
|
+
"text": "Cupcake $4",
|
|
673
|
+
"font": "display",
|
|
674
|
+
"size": 0.18,
|
|
675
|
+
"depth": 0,
|
|
676
|
+
"position": [-2.6, -0.25, 0.9],
|
|
677
|
+
"material": {"type": "basic", "color": "#5a2a3c"}
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
"id": "donutStand",
|
|
681
|
+
"kind": "mesh",
|
|
682
|
+
"geometry": {"type": "cylinder", "radiusTop": 0.9, "radiusBottom": 0.9, "height": 0.25, "segments": 64},
|
|
683
|
+
"position": [0, 0.125, 0],
|
|
684
|
+
"material": {"preset": "clay", "color": "#ffc46b"}
|
|
685
|
+
},
|
|
686
|
+
{
|
|
687
|
+
"id": "donut",
|
|
688
|
+
"kind": "model",
|
|
689
|
+
"src": "library:models/food/donut.glb",
|
|
690
|
+
"fit": 1.3,
|
|
691
|
+
"position": [0, 0.25, 0],
|
|
692
|
+
"castShadow": true,
|
|
693
|
+
"behaviours": [{"type": "float", "amplitude": 0.04, "speed": 0.4, "phase": 0}]
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
"id": "donutLabel",
|
|
697
|
+
"kind": "text",
|
|
698
|
+
"text": "Donut $3",
|
|
699
|
+
"font": "display",
|
|
700
|
+
"size": 0.18,
|
|
701
|
+
"depth": 0,
|
|
702
|
+
"position": [0, -0.25, 0.9],
|
|
703
|
+
"material": {"type": "basic", "color": "#5a2a3c"}
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
"id": "croissantStand",
|
|
707
|
+
"kind": "mesh",
|
|
708
|
+
"geometry": {"type": "cylinder", "radiusTop": 0.9, "radiusBottom": 0.9, "height": 0.25, "segments": 64},
|
|
709
|
+
"position": [2.6, 0.125, 0],
|
|
710
|
+
"material": {"preset": "clay", "color": "#8cc8f5"}
|
|
711
|
+
},
|
|
712
|
+
{
|
|
713
|
+
"id": "croissant",
|
|
714
|
+
"kind": "model",
|
|
715
|
+
"src": "library:models/food/croissant.glb",
|
|
716
|
+
"fit": 1.3,
|
|
717
|
+
"position": [2.6, 0.25, 0],
|
|
718
|
+
"castShadow": true,
|
|
719
|
+
"behaviours": [{"type": "float", "amplitude": 0.04, "speed": 0.4, "phase": 2.6}],
|
|
720
|
+
"rotation": [0, -60, 0]
|
|
721
|
+
},
|
|
722
|
+
{
|
|
723
|
+
"id": "croissantLabel",
|
|
724
|
+
"kind": "text",
|
|
725
|
+
"text": "Croissant $3",
|
|
726
|
+
"font": "display",
|
|
727
|
+
"size": 0.18,
|
|
728
|
+
"depth": 0,
|
|
729
|
+
"position": [2.6, -0.25, 0.9],
|
|
730
|
+
"material": {"type": "basic", "color": "#5a2a3c"}
|
|
731
|
+
}
|
|
732
|
+
],
|
|
733
|
+
"interactions": [
|
|
734
|
+
{
|
|
735
|
+
"on": "hover",
|
|
736
|
+
"target": "cupcake",
|
|
737
|
+
"do": [{"set": {"path": "cupcake.scale", "value": 1.15}, "duration": 0.3, "ease": "outBack"}]
|
|
738
|
+
},
|
|
739
|
+
{
|
|
740
|
+
"on": "hoverEnd",
|
|
741
|
+
"target": "cupcake",
|
|
742
|
+
"do": [{"set": {"path": "cupcake.scale", "value": 1}, "duration": 0.3, "ease": "outCubic"}]
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
"on": "click",
|
|
746
|
+
"target": "cupcake",
|
|
747
|
+
"do": [
|
|
748
|
+
{"openUrl": "https://shop.example.com/shop/cupcake"},
|
|
749
|
+
{"emit": "product-click", "payload": {"id": "cupcake"}}
|
|
750
|
+
]
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
"on": "hover",
|
|
754
|
+
"target": "donut",
|
|
755
|
+
"do": [{"set": {"path": "donut.scale", "value": 1.15}, "duration": 0.3, "ease": "outBack"}]
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
"on": "hoverEnd",
|
|
759
|
+
"target": "donut",
|
|
760
|
+
"do": [{"set": {"path": "donut.scale", "value": 1}, "duration": 0.3, "ease": "outCubic"}]
|
|
761
|
+
},
|
|
762
|
+
{
|
|
763
|
+
"on": "click",
|
|
764
|
+
"target": "donut",
|
|
765
|
+
"do": [
|
|
766
|
+
{"openUrl": "https://shop.example.com/shop/donut"},
|
|
767
|
+
{"emit": "product-click", "payload": {"id": "donut"}}
|
|
768
|
+
]
|
|
769
|
+
},
|
|
770
|
+
{
|
|
771
|
+
"on": "hover",
|
|
772
|
+
"target": "croissant",
|
|
773
|
+
"do": [{"set": {"path": "croissant.scale", "value": 1.15}, "duration": 0.3, "ease": "outBack"}]
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
"on": "hoverEnd",
|
|
777
|
+
"target": "croissant",
|
|
778
|
+
"do": [{"set": {"path": "croissant.scale", "value": 1}, "duration": 0.3, "ease": "outCubic"}]
|
|
779
|
+
},
|
|
780
|
+
{
|
|
781
|
+
"on": "click",
|
|
782
|
+
"target": "croissant",
|
|
783
|
+
"do": [
|
|
784
|
+
{"openUrl": "https://shop.example.com/shop/croissant"},
|
|
785
|
+
{"emit": "product-click", "payload": {"id": "croissant"}}
|
|
786
|
+
]
|
|
787
|
+
}
|
|
788
|
+
],
|
|
789
|
+
"postfx": [{"type": "look", "preset": "clean"}]
|
|
790
|
+
}
|
|
791
|
+
```
|
|
792
|
+
|
|
793
|
+
- `interactions` need no script: `hover` / `hoverEnd` tween `scale` with `set`, `click` runs `openUrl` (http(s) or page-relative, user gesture only; renders emit an `openUrl` event instead of navigating) and `emit`s an event the page can track.
|
|
794
|
+
- Check hover in a render: `render --frames 1.2 --input '[{"t": 0.5, "pointer": [0, 0.05]}]'` (coordinates -1..1, y up) shows the hovered state.
|
|
795
|
+
- Labels are flat text (`depth: 0`) with `basic` material: always readable, cheap.
|
|
796
|
+
- Knobs: `value` of the hover scale (1.1–1.2), ease `outBack` for a playful pop, the URLs.
|
|
797
|
+
|
|
798
|
+
## Physics toss game (16:9)
|
|
799
|
+
|
|
800
|
+
Click or tap to throw a ball and knock the can pyramid off the table; an autopilot plays until the first click so the poster shows action. Save the script below as `scripts/game.js`.
|
|
801
|
+
|
|
802
|
+
```json
|
|
803
|
+
{
|
|
804
|
+
"version": 1,
|
|
805
|
+
"id": "can-toss",
|
|
806
|
+
"title": "Can Toss",
|
|
807
|
+
"ariaLabel": "Can Toss, a physics mini game: click or tap to throw a ball and knock the stacked cans off the table",
|
|
808
|
+
"target": {"kind": "game", "aspect": "16:9", "reducedMotion": "ignore", "posterTime": 1.5, "quality": "medium"},
|
|
809
|
+
"camera": {"type": "perspective", "fov": 42, "position": [0, 3, 8.5], "target": [0, 1.8, 0]},
|
|
810
|
+
"environment": {
|
|
811
|
+
"background": {"gradient": ["#2a2550", "#5a4fa8"], "angle": 0},
|
|
812
|
+
"lighting": "studio",
|
|
813
|
+
"lightingIntensity": 0.6,
|
|
814
|
+
"rig": {"preset": "studio-3point", "intensity": 1.1},
|
|
815
|
+
"shadows": {"type": "pcf", "softness": 3},
|
|
816
|
+
"fog": {"color": "#2a2550", "near": 12, "far": 26}
|
|
817
|
+
},
|
|
818
|
+
"lights": [],
|
|
819
|
+
"objects": [
|
|
820
|
+
{
|
|
821
|
+
"id": "table",
|
|
822
|
+
"kind": "mesh",
|
|
823
|
+
"geometry": {"type": "roundedBox", "width": 5, "height": 1, "depth": 2.4, "radius": 0.08},
|
|
824
|
+
"position": [0, 0.5, 0],
|
|
825
|
+
"material": {"preset": "plastic", "color": "#f6d7b0", "roughness": 0.5},
|
|
826
|
+
"receiveShadow": true,
|
|
827
|
+
"body": {"type": "static"}
|
|
828
|
+
},
|
|
829
|
+
{
|
|
830
|
+
"id": "floor",
|
|
831
|
+
"kind": "mesh",
|
|
832
|
+
"geometry": {"type": "box", "width": 40, "height": 0.2, "depth": 40},
|
|
833
|
+
"position": [0, -0.1, 0],
|
|
834
|
+
"material": {"preset": "matte", "color": "#3a3470"},
|
|
835
|
+
"receiveShadow": true,
|
|
836
|
+
"body": {"type": "static"}
|
|
837
|
+
},
|
|
838
|
+
{
|
|
839
|
+
"id": "can0",
|
|
840
|
+
"kind": "mesh",
|
|
841
|
+
"geometry": {"type": "cylinder", "radiusTop": 0.3, "radiusBottom": 0.3, "height": 0.8, "segments": 32},
|
|
842
|
+
"position": [-0.7, 1.4, 0],
|
|
843
|
+
"material": {"preset": "carPaint", "color": "#ef476f"},
|
|
844
|
+
"castShadow": true,
|
|
845
|
+
"tags": ["can"],
|
|
846
|
+
"body": {"type": "dynamic", "shape": "cylinder", "mass": 0.4, "friction": 0.4, "restitution": 0.1}
|
|
847
|
+
},
|
|
848
|
+
{
|
|
849
|
+
"id": "can1",
|
|
850
|
+
"kind": "mesh",
|
|
851
|
+
"geometry": {"type": "cylinder", "radiusTop": 0.3, "radiusBottom": 0.3, "height": 0.8, "segments": 32},
|
|
852
|
+
"position": [0, 1.4, 0],
|
|
853
|
+
"material": {"preset": "carPaint", "color": "#ef476f"},
|
|
854
|
+
"castShadow": true,
|
|
855
|
+
"tags": ["can"],
|
|
856
|
+
"body": {"type": "dynamic", "shape": "cylinder", "mass": 0.4, "friction": 0.4, "restitution": 0.1}
|
|
857
|
+
},
|
|
858
|
+
{
|
|
859
|
+
"id": "can2",
|
|
860
|
+
"kind": "mesh",
|
|
861
|
+
"geometry": {"type": "cylinder", "radiusTop": 0.3, "radiusBottom": 0.3, "height": 0.8, "segments": 32},
|
|
862
|
+
"position": [0.7, 1.4, 0],
|
|
863
|
+
"material": {"preset": "carPaint", "color": "#ef476f"},
|
|
864
|
+
"castShadow": true,
|
|
865
|
+
"tags": ["can"],
|
|
866
|
+
"body": {"type": "dynamic", "shape": "cylinder", "mass": 0.4, "friction": 0.4, "restitution": 0.1}
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
"id": "can3",
|
|
870
|
+
"kind": "mesh",
|
|
871
|
+
"geometry": {"type": "cylinder", "radiusTop": 0.3, "radiusBottom": 0.3, "height": 0.8, "segments": 32},
|
|
872
|
+
"position": [-0.35, 2.2, 0],
|
|
873
|
+
"material": {"preset": "carPaint", "color": "#ffd166"},
|
|
874
|
+
"castShadow": true,
|
|
875
|
+
"tags": ["can"],
|
|
876
|
+
"body": {"type": "dynamic", "shape": "cylinder", "mass": 0.4, "friction": 0.4, "restitution": 0.1}
|
|
877
|
+
},
|
|
878
|
+
{
|
|
879
|
+
"id": "can4",
|
|
880
|
+
"kind": "mesh",
|
|
881
|
+
"geometry": {"type": "cylinder", "radiusTop": 0.3, "radiusBottom": 0.3, "height": 0.8, "segments": 32},
|
|
882
|
+
"position": [0.35, 2.2, 0],
|
|
883
|
+
"material": {"preset": "carPaint", "color": "#ffd166"},
|
|
884
|
+
"castShadow": true,
|
|
885
|
+
"tags": ["can"],
|
|
886
|
+
"body": {"type": "dynamic", "shape": "cylinder", "mass": 0.4, "friction": 0.4, "restitution": 0.1}
|
|
887
|
+
},
|
|
888
|
+
{
|
|
889
|
+
"id": "can5",
|
|
890
|
+
"kind": "mesh",
|
|
891
|
+
"geometry": {"type": "cylinder", "radiusTop": 0.3, "radiusBottom": 0.3, "height": 0.8, "segments": 32},
|
|
892
|
+
"position": [0, 3, 0],
|
|
893
|
+
"material": {"preset": "carPaint", "color": "#06d6a0"},
|
|
894
|
+
"castShadow": true,
|
|
895
|
+
"tags": ["can"],
|
|
896
|
+
"body": {"type": "dynamic", "shape": "cylinder", "mass": 0.4, "friction": 0.4, "restitution": 0.1}
|
|
897
|
+
},
|
|
898
|
+
{
|
|
899
|
+
"id": "ballProto",
|
|
900
|
+
"kind": "mesh",
|
|
901
|
+
"geometry": {"type": "sphere", "radius": 0.26},
|
|
902
|
+
"position": [0, -5, 8],
|
|
903
|
+
"visible": false,
|
|
904
|
+
"material": {"preset": "rubber", "color": "#ff7b54"},
|
|
905
|
+
"castShadow": true,
|
|
906
|
+
"body": {"type": "dynamic", "shape": "sphere", "mass": 1.2, "restitution": 0.4, "ccd": true, "sleep": false}
|
|
907
|
+
}
|
|
908
|
+
],
|
|
909
|
+
"scripts": ["scripts/game.js"],
|
|
910
|
+
"physics": {"gravity": [0, -9.81, 0], "substeps": 2, "iterations": 12},
|
|
911
|
+
"ui": {
|
|
912
|
+
"elements": [
|
|
913
|
+
{"id": "score", "type": "text", "text": "Down {down}/{total}", "anchor": "top-left", "style": "pill"},
|
|
914
|
+
{"id": "throws", "type": "text", "text": "Throws {throws}", "anchor": "top-right", "style": "pill"},
|
|
915
|
+
{
|
|
916
|
+
"id": "hint",
|
|
917
|
+
"type": "text",
|
|
918
|
+
"text": "Click or tap to throw",
|
|
919
|
+
"anchor": "bottom",
|
|
920
|
+
"style": "subtitle",
|
|
921
|
+
"visible": "phase == 'attract'"
|
|
922
|
+
}
|
|
923
|
+
],
|
|
924
|
+
"color": "#ffffff",
|
|
925
|
+
"accent": "#ef476f"
|
|
926
|
+
},
|
|
927
|
+
"audio": {
|
|
928
|
+
"sounds": {
|
|
929
|
+
"throw": {"preset": "whoosh", "volume": 0.4},
|
|
930
|
+
"hit": {"preset": "hit", "volume": 0.5},
|
|
931
|
+
"win": {"preset": "win"}
|
|
932
|
+
}
|
|
933
|
+
},
|
|
934
|
+
"data": {"launch": [0, 1.6, 8], "flight": 0.6},
|
|
935
|
+
"seed": 11
|
|
936
|
+
}
|
|
937
|
+
```
|
|
938
|
+
|
|
939
|
+
```js
|
|
940
|
+
// Can Toss: click / tap to throw a ball at the point under the pointer and knock
|
|
941
|
+
// every can off the table. Attract mode (no input yet): an autopilot throws, so
|
|
942
|
+
// renders and the poster show action. phase: "attract" -> "play" -> "cleared".
|
|
943
|
+
export default function (api) {
|
|
944
|
+
const { launch, flight } = api.data;
|
|
945
|
+
const cans = api.findByTag("can").map((o) => ({ o, p: [o.position.x, o.position.y, o.position.z] }));
|
|
946
|
+
let balls = [];
|
|
947
|
+
let n = 0;
|
|
948
|
+
let phase = "attract";
|
|
949
|
+
let throws = 0;
|
|
950
|
+
let nextAuto = 0.6;
|
|
951
|
+
let lastHit = -1;
|
|
952
|
+
|
|
953
|
+
const isDown = (c) => c.o.position.y < 1.2; // fell off the table top
|
|
954
|
+
function publish() {
|
|
955
|
+
api.state.phase = phase;
|
|
956
|
+
api.state.down = cans.filter(isDown).length;
|
|
957
|
+
api.state.total = cans.length;
|
|
958
|
+
api.state.throws = throws;
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
function reset() {
|
|
962
|
+
for (const c of cans) {
|
|
963
|
+
c.o.position.set(c.p[0], c.p[1], c.p[2]);
|
|
964
|
+
c.o.rotation.set(0, 0, 0);
|
|
965
|
+
api.physics.setVelocity(c.o, [0, 0, 0]);
|
|
966
|
+
api.physics.setAngularVelocity(c.o, [0, 0, 0]);
|
|
967
|
+
}
|
|
968
|
+
for (const b of balls) b.remove();
|
|
969
|
+
balls = [];
|
|
970
|
+
throws = 0;
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
// Ballistic throw from `launch` that reaches `target` after `flight` seconds.
|
|
974
|
+
function throwAt(target) {
|
|
975
|
+
const ball = api.clone("ballProto", { id: "ball" + n++, position: launch });
|
|
976
|
+
ball.visible = true;
|
|
977
|
+
const T = flight;
|
|
978
|
+
api.physics.setVelocity(ball, [(target[0] - launch[0]) / T, (target[1] - launch[1]) / T + 4.905 * T, (target[2] - launch[2]) / T]);
|
|
979
|
+
balls.push(ball);
|
|
980
|
+
if (balls.length > 6) balls.shift().remove();
|
|
981
|
+
throws++;
|
|
982
|
+
if (phase !== "attract") api.audio.play("throw");
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
function aim() {
|
|
986
|
+
const hit = api.input.pointerWorld();
|
|
987
|
+
if (hit && hit.objectId && hit.objectId !== "floor") return [hit.x, hit.y, hit.z];
|
|
988
|
+
return [api.input.pointer.x * 4, 2.2 + api.input.pointer.y * 2, 0];
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
return {
|
|
992
|
+
start() {
|
|
993
|
+
api.physics.onCollision((a, b, info) => {
|
|
994
|
+
if (phase === "attract" || info.impulse < 1 || api.time() - lastHit < 0.08) return;
|
|
995
|
+
lastHit = api.time();
|
|
996
|
+
api.audio.play("hit");
|
|
997
|
+
});
|
|
998
|
+
publish();
|
|
999
|
+
},
|
|
1000
|
+
update() {
|
|
1001
|
+
const t = api.time();
|
|
1002
|
+
const pressed = api.input.pointer.justPressed || api.input.pressed("Space");
|
|
1003
|
+
if (phase === "attract") {
|
|
1004
|
+
if (pressed) {
|
|
1005
|
+
phase = "play";
|
|
1006
|
+
reset();
|
|
1007
|
+
throwAt(aim());
|
|
1008
|
+
} else if (t >= nextAuto) {
|
|
1009
|
+
const standing = cans.filter((c) => !isDown(c));
|
|
1010
|
+
if (!standing.length || throws >= 5) {
|
|
1011
|
+
reset();
|
|
1012
|
+
nextAuto = t + 1;
|
|
1013
|
+
} else {
|
|
1014
|
+
const c = standing[Math.floor(api.random() * standing.length)];
|
|
1015
|
+
throwAt([c.o.position.x, c.o.position.y, c.o.position.z]);
|
|
1016
|
+
nextAuto = t + 1.4;
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
} else if (phase === "play") {
|
|
1020
|
+
if (pressed) throwAt(aim());
|
|
1021
|
+
if (cans.every(isDown)) {
|
|
1022
|
+
phase = "cleared";
|
|
1023
|
+
api.audio.play("win");
|
|
1024
|
+
api.ui.toast("Cleared in " + throws + " throws!", 2.5);
|
|
1025
|
+
}
|
|
1026
|
+
} else if (pressed) {
|
|
1027
|
+
reset();
|
|
1028
|
+
phase = "play";
|
|
1029
|
+
}
|
|
1030
|
+
publish();
|
|
1031
|
+
},
|
|
1032
|
+
};
|
|
1033
|
+
}
|
|
1034
|
+
```
|
|
1035
|
+
|
|
1036
|
+
- Cans are `dynamic` rigid bodies (they topple and roll); the table and floor are `static`. The floor is a thin **box**, not a rotated plane: a `body` box is measured in the object's rotated frame, so a plane rotated -90° with a custom `size` becomes a wall.
|
|
1037
|
+
- Throws set a ballistic velocity once (`api.physics.setVelocity`); `ccd: true` on the ball prevents tunnelling. Clones of a hidden prototype are the cheap way to spawn.
|
|
1038
|
+
- `target.quality: "medium"` and no postfx keep it light (`check` warns about heavy effects in games).
|
|
1039
|
+
- Test a real throw: `render --frames 2 --input '[{"t": 0.5, "click": [0, 0.1]}]'` returns `state` (`phase: "play"`, `down`, `throws`).
|
|
1040
|
+
- Scoring pitfalls: a can counts as down by its height (`position.y` below the table top), not by its rotation: `rotation` is Euler XYZ in degrees, so a can lying on its side can read x = 90 or z = 90 and a toppled-then-turned one other combinations. Restacking (`reset`) zeroes velocities and removes the balls still in flight (they would knock the fresh stack over), and the autopilot waits before the next throw so the cans settle first.
|
|
1041
|
+
|
|
1042
|
+
## Lane runner game (16:9)
|
|
1043
|
+
|
|
1044
|
+
Three lanes, rows of blocks rushing at the runner, speed ramping up, score and best score, Play / Play again buttons, and an attract mode: until the visitor plays, an autopilot dodges behind the title, so renders and the poster show action. Save the script below as `scripts/game.js`.
|
|
1045
|
+
|
|
1046
|
+
```json
|
|
1047
|
+
{
|
|
1048
|
+
"version": 1,
|
|
1049
|
+
"id": "lane-runner",
|
|
1050
|
+
"title": "Lane Runner",
|
|
1051
|
+
"ariaLabel": "Lane Runner, a mini game: change lanes with the arrow keys, A / D, a swipe or a tap on either side to dodge the blocks",
|
|
1052
|
+
"seed": 4,
|
|
1053
|
+
"target": {
|
|
1054
|
+
"kind": "game",
|
|
1055
|
+
"aspect": "16:9",
|
|
1056
|
+
"reducedMotion": "ignore",
|
|
1057
|
+
"posterTime": 4,
|
|
1058
|
+
"quality": "medium"
|
|
1059
|
+
},
|
|
1060
|
+
"camera": {"type": "perspective", "fov": 50, "position": [0, 3.4, 7], "target": [0, 0.9, -8]},
|
|
1061
|
+
"environment": {
|
|
1062
|
+
"background": {"gradient": ["#ffd9b0", "#ffd9b0", "#ffd9b0", "#9cc8ff", "#4f86d9"], "angle": 0},
|
|
1063
|
+
"lighting": "soft",
|
|
1064
|
+
"lightingIntensity": 0.7,
|
|
1065
|
+
"rig": {"preset": "golden-hour", "intensity": 1.1, "castShadow": true},
|
|
1066
|
+
"fog": {"color": "#ffd9b0", "near": 18, "far": 44}
|
|
1067
|
+
},
|
|
1068
|
+
"lights": [],
|
|
1069
|
+
"objects": [
|
|
1070
|
+
{
|
|
1071
|
+
"id": "road",
|
|
1072
|
+
"kind": "generator",
|
|
1073
|
+
"generator": "road",
|
|
1074
|
+
"params": {
|
|
1075
|
+
"width": 6,
|
|
1076
|
+
"length": 80,
|
|
1077
|
+
"lanes": 3,
|
|
1078
|
+
"color": "#3d405b",
|
|
1079
|
+
"lineColor": "#f4f1de",
|
|
1080
|
+
"speed": 12,
|
|
1081
|
+
"vergeColor": ["#8fd16a", "#7cc45a"]
|
|
1082
|
+
},
|
|
1083
|
+
"receiveShadow": true
|
|
1084
|
+
},
|
|
1085
|
+
{
|
|
1086
|
+
"id": "player",
|
|
1087
|
+
"kind": "generator",
|
|
1088
|
+
"generator": "character",
|
|
1089
|
+
"params": {
|
|
1090
|
+
"style": "humanoid",
|
|
1091
|
+
"shirt": "#ffd166",
|
|
1092
|
+
"pants": "#26547c",
|
|
1093
|
+
"hair": "#3b2a20",
|
|
1094
|
+
"animation": "run",
|
|
1095
|
+
"animationSpeed": 1.4,
|
|
1096
|
+
"height": 1.4
|
|
1097
|
+
},
|
|
1098
|
+
"rotation": [0, 180, 0],
|
|
1099
|
+
"castShadow": true
|
|
1100
|
+
},
|
|
1101
|
+
{
|
|
1102
|
+
"id": "block",
|
|
1103
|
+
"kind": "mesh",
|
|
1104
|
+
"geometry": {"type": "roundedBox", "width": 1.6, "height": 1.2, "depth": 0.8, "radius": 0.12},
|
|
1105
|
+
"material": {"preset": "plastic", "color": "#ef476f"},
|
|
1106
|
+
"position": [0, 0.6, -44],
|
|
1107
|
+
"visible": false,
|
|
1108
|
+
"castShadow": true,
|
|
1109
|
+
"tags": ["template"]
|
|
1110
|
+
}
|
|
1111
|
+
],
|
|
1112
|
+
"scripts": ["scripts/game.js"],
|
|
1113
|
+
"data": {
|
|
1114
|
+
"lanes": [-2, 0, 2],
|
|
1115
|
+
"startSpeed": 12,
|
|
1116
|
+
"maxSpeed": 26,
|
|
1117
|
+
"accel": 0.4,
|
|
1118
|
+
"rowEvery": 14,
|
|
1119
|
+
"spawnZ": -44
|
|
1120
|
+
},
|
|
1121
|
+
"ui": {
|
|
1122
|
+
"color": "#ffffff",
|
|
1123
|
+
"accent": "#ffd166",
|
|
1124
|
+
"elements": [
|
|
1125
|
+
{
|
|
1126
|
+
"id": "score",
|
|
1127
|
+
"type": "text",
|
|
1128
|
+
"text": "Score {score}",
|
|
1129
|
+
"anchor": "top-left",
|
|
1130
|
+
"style": "pill"
|
|
1131
|
+
},
|
|
1132
|
+
{"id": "best", "type": "text", "text": "Best {best}", "anchor": "top-right", "style": "pill"},
|
|
1133
|
+
{
|
|
1134
|
+
"id": "title",
|
|
1135
|
+
"type": "text",
|
|
1136
|
+
"text": "Lane Runner",
|
|
1137
|
+
"anchor": "top",
|
|
1138
|
+
"style": "title",
|
|
1139
|
+
"visible": "phase == 'ready'"
|
|
1140
|
+
},
|
|
1141
|
+
{
|
|
1142
|
+
"id": "play",
|
|
1143
|
+
"type": "button",
|
|
1144
|
+
"text": "Play",
|
|
1145
|
+
"anchor": "bottom",
|
|
1146
|
+
"action": "start",
|
|
1147
|
+
"visible": "phase == 'ready'"
|
|
1148
|
+
},
|
|
1149
|
+
{
|
|
1150
|
+
"id": "over",
|
|
1151
|
+
"type": "text",
|
|
1152
|
+
"text": "Game over\nScore {score} · Best {best}",
|
|
1153
|
+
"anchor": "center",
|
|
1154
|
+
"style": "panel",
|
|
1155
|
+
"visible": "phase == 'over'"
|
|
1156
|
+
},
|
|
1157
|
+
{
|
|
1158
|
+
"id": "retry",
|
|
1159
|
+
"type": "button",
|
|
1160
|
+
"text": "Play again",
|
|
1161
|
+
"anchor": "bottom",
|
|
1162
|
+
"action": "retry",
|
|
1163
|
+
"visible": "phase == 'over'"
|
|
1164
|
+
}
|
|
1165
|
+
]
|
|
1166
|
+
},
|
|
1167
|
+
"audio": {
|
|
1168
|
+
"sounds": {
|
|
1169
|
+
"move": {"preset": "whoosh", "volume": 0.3},
|
|
1170
|
+
"point": {"preset": "coin", "volume": 0.4},
|
|
1171
|
+
"lose": {"preset": "lose", "volume": 0.5}
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
```
|
|
1176
|
+
|
|
1177
|
+
```js
|
|
1178
|
+
// Lane Runner: dodge the blocks by changing lanes (arrows / A D, swipes, or a tap
|
|
1179
|
+
// on the left / right half). phase: "ready" (an autopilot plays behind the title,
|
|
1180
|
+
// so renders and the poster show action) -> "play" -> "over".
|
|
1181
|
+
export default function (api) {
|
|
1182
|
+
const { lanes, startSpeed, maxSpeed, accel, rowEvery, spawnZ } = api.data;
|
|
1183
|
+
const player = api.get("player");
|
|
1184
|
+
const road = api.get("road");
|
|
1185
|
+
let blocks = [];
|
|
1186
|
+
let n = 0;
|
|
1187
|
+
let lane = 1;
|
|
1188
|
+
let speed = startSpeed;
|
|
1189
|
+
let nextRow = 0;
|
|
1190
|
+
let distance = 0;
|
|
1191
|
+
let overAt = 0;
|
|
1192
|
+
|
|
1193
|
+
function reset(phase) {
|
|
1194
|
+
for (const b of blocks) b.remove();
|
|
1195
|
+
blocks = [];
|
|
1196
|
+
lane = 1;
|
|
1197
|
+
speed = startSpeed;
|
|
1198
|
+
nextRow = 0; // the first row reaches the player after ~3.5 s
|
|
1199
|
+
distance = 0;
|
|
1200
|
+
player.position.x = lanes[1];
|
|
1201
|
+
api.state.phase = phase;
|
|
1202
|
+
api.state.score = 0;
|
|
1203
|
+
api.state.best = Number(api.storage.get("best") ?? 0);
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
// A row of 1-2 blocks at spawnZ (hidden in the fog); one lane always stays open.
|
|
1207
|
+
function spawnRow() {
|
|
1208
|
+
const open = Math.floor(api.random() * 3);
|
|
1209
|
+
for (let i = 0; i < 3; i++) {
|
|
1210
|
+
if (i === open || (i !== (open + 1) % 3 && api.random() < 0.5)) continue;
|
|
1211
|
+
const b = api.clone("block", { id: "block" + n++, position: [lanes[i], 0.6, spawnZ] });
|
|
1212
|
+
b.visible = true;
|
|
1213
|
+
blocks.push(b);
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
// Distance to the nearest block ahead in a lane (Infinity when clear).
|
|
1218
|
+
function clearance(i) {
|
|
1219
|
+
let d = Infinity;
|
|
1220
|
+
for (const b of blocks) if (Math.abs(b.position.x - lanes[i]) < 0.5 && b.position.z < 0.8) d = Math.min(d, -b.position.z);
|
|
1221
|
+
return d;
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
function autopilot() {
|
|
1225
|
+
if (clearance(lane) > 12) return 0;
|
|
1226
|
+
const left = lane > 0 ? clearance(lane - 1) : -1;
|
|
1227
|
+
const right = lane < 2 ? clearance(lane + 1) : -1;
|
|
1228
|
+
return left >= right ? -1 : 1;
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
function readInput() {
|
|
1232
|
+
const swipe = api.input.swipe();
|
|
1233
|
+
const tap = api.input.pointer.justPressed ? Math.sign(api.input.pointer.x) : 0;
|
|
1234
|
+
if (api.input.pressed("ArrowLeft") || api.input.pressed("KeyA") || swipe === "left" || tap < 0) return -1;
|
|
1235
|
+
if (api.input.pressed("ArrowRight") || api.input.pressed("KeyD") || swipe === "right" || tap > 0) return 1;
|
|
1236
|
+
return 0;
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
function gameOver() {
|
|
1240
|
+
api.state.phase = "over";
|
|
1241
|
+
overAt = api.time();
|
|
1242
|
+
api.audio.play("lose");
|
|
1243
|
+
api.camera.shake(0.3, 0.4);
|
|
1244
|
+
const best = Math.max(Number(api.state.best), Number(api.state.score));
|
|
1245
|
+
api.state.best = best;
|
|
1246
|
+
api.storage.set("best", best);
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
return {
|
|
1250
|
+
start() {
|
|
1251
|
+
reset("ready");
|
|
1252
|
+
},
|
|
1253
|
+
onEvent(name) {
|
|
1254
|
+
if (name === "start" || name === "retry") reset("play");
|
|
1255
|
+
},
|
|
1256
|
+
update(dt) {
|
|
1257
|
+
const phase = api.state.phase;
|
|
1258
|
+
if (phase === "over") {
|
|
1259
|
+
if (api.time() - overAt > 0.6 && (api.input.pressed("Space") || api.input.pressed("Enter"))) reset("play");
|
|
1260
|
+
return;
|
|
1261
|
+
}
|
|
1262
|
+
if (phase === "ready" && (api.input.pressed("Space") || api.input.pressed("Enter") || api.input.pointer.justPressed)) return reset("play");
|
|
1263
|
+
|
|
1264
|
+
// Difficulty ramp: faster over time, rows closer together in time.
|
|
1265
|
+
speed = Math.min(maxSpeed, speed + accel * dt);
|
|
1266
|
+
road.userData.speed = speed;
|
|
1267
|
+
distance += speed * dt;
|
|
1268
|
+
nextRow -= speed * dt;
|
|
1269
|
+
if (nextRow <= 0) {
|
|
1270
|
+
spawnRow();
|
|
1271
|
+
nextRow = rowEvery;
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
const move = phase === "play" ? readInput() : autopilot();
|
|
1275
|
+
if (move && lane + move >= 0 && lane + move <= 2) {
|
|
1276
|
+
lane += move;
|
|
1277
|
+
if (phase === "play") api.audio.play("move");
|
|
1278
|
+
}
|
|
1279
|
+
player.position.x += (lanes[lane] - player.position.x) * Math.min(1, dt * 14);
|
|
1280
|
+
|
|
1281
|
+
for (const b of blocks.slice()) {
|
|
1282
|
+
b.position.z += speed * dt;
|
|
1283
|
+
if (b.position.z > 8) {
|
|
1284
|
+
b.remove();
|
|
1285
|
+
blocks.splice(blocks.indexOf(b), 1);
|
|
1286
|
+
} else if (phase === "play" && Math.abs(b.position.z) < 0.6 && Math.abs(b.position.x - player.position.x) < 1.1) {
|
|
1287
|
+
return gameOver();
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
if (phase === "play") api.state.score = Math.floor(distance / 4);
|
|
1291
|
+
},
|
|
1292
|
+
};
|
|
1293
|
+
}
|
|
1294
|
+
```
|
|
1295
|
+
|
|
1296
|
+
- Spawning by cloning: `block` is a hidden template; `api.clone` copies it synchronously (deterministic), the script keeps its own array of live clones and `remove()`s them once they pass the camera. Rows spawn at `spawnZ`, inside the fog (`far` 44), so they fade in instead of popping.
|
|
1297
|
+
- Collisions are lane + z checks: no physics body, no physics chunk to download. One lane per row always stays open.
|
|
1298
|
+
- The `road` generator scrolls its own stripes; the script sets `road.userData.speed` so they match the ramping speed. Restyle it with `color`, `lineColor`, `curbColors` (one colour = a solid curb), `vergeColor`, or `verge: false` (road only).
|
|
1299
|
+
- The game-over screen is a `panel` (a backdrop card; `\n` breaks lines, the first line is the heading). Buttons get an auto-contrast label from `ui.accent` (`ui.buttonText` overrides it); `color` / `background` on an element restyle it alone. Patch one element by id: `ui.elements#retry.text`.
|
|
1300
|
+
- Tested: `render --sheet --frames 1,4,7,10` (attract mode dodging), then played headlessly: `render --frames 2,5,8 --input '[{"t": 0.5, "ui": "play"}, {"t": 2, "swipe": "left"}, {"t": 6, "ui": "retry"}]'` returns `state` (`phase`, `score`, `best`) — the swipe runs into a row (`phase: "over"`), `ui: "retry"` presses the HUD button and restarts. Posters and videos show the canvas only, without the HUD.
|
|
1301
|
+
- Phones: the embed keeps 16:9, so a 390 px wide phone shows it 390 × 219 (`render --size 390x219`): the corner pills and the button cover a lot. For a mobile-first game use a portrait aspect (`"9:16"` or `"3:4"`) and widen the camera (here fov 75 from `[0, 4.2, 7.5]` keeps the three lanes in a 9:16 frame).
|
|
1302
|
+
- Knobs: `data` (`startSpeed`, `maxSpeed`, `accel`, `rowEvery`), the runner's `params` (`catalog generators character`), block colour and shape, the sky gradient + fog colour (keep the fog the colour of the horizon).
|
|
1303
|
+
|
|
1304
|
+
## Character card (1:1): waving mascot
|
|
1305
|
+
|
|
1306
|
+
The built-in procedural character waving on a pedestal, eyes following the pointer, a small grow on hover.
|
|
1307
|
+
|
|
1308
|
+
```json
|
|
1309
|
+
{
|
|
1310
|
+
"version": 1,
|
|
1311
|
+
"id": "mascot-card",
|
|
1312
|
+
"title": "Waving mascot",
|
|
1313
|
+
"ariaLabel": "A friendly 3D mascot waving hello",
|
|
1314
|
+
"target": {"kind": "card", "aspect": "1:1", "posterTime": 1},
|
|
1315
|
+
"camera": {"type": "perspective", "fov": 30, "position": [0, 1.5, 5.4], "target": [0, 1.05, 0]},
|
|
1316
|
+
"environment": {
|
|
1317
|
+
"background": {"radial": ["#fff0f4", "#ffc2d1"], "center": [0.5, 0.6], "radius": 0.9},
|
|
1318
|
+
"lighting": "soft",
|
|
1319
|
+
"rig": {"preset": "studio-3point", "intensity": 1, "color": "#fff1f4"},
|
|
1320
|
+
"contactShadows": {"opacity": 0.5, "blur": 2.5, "color": "#8a3a5c"}
|
|
1321
|
+
},
|
|
1322
|
+
"lights": [],
|
|
1323
|
+
"objects": [
|
|
1324
|
+
{
|
|
1325
|
+
"id": "pedestal",
|
|
1326
|
+
"kind": "mesh",
|
|
1327
|
+
"geometry": {"type": "cylinder", "radiusTop": 0.75, "radiusBottom": 0.82, "height": 0.3, "segments": 64},
|
|
1328
|
+
"material": {"preset": "mattePastel", "color": "#9b8cff"},
|
|
1329
|
+
"position": [0, 0.15, 0]
|
|
1330
|
+
},
|
|
1331
|
+
{
|
|
1332
|
+
"id": "mascot",
|
|
1333
|
+
"kind": "generator",
|
|
1334
|
+
"generator": "character",
|
|
1335
|
+
"position": [0, 0.3, 0],
|
|
1336
|
+
"params": {
|
|
1337
|
+
"style": "humanoid",
|
|
1338
|
+
"shirt": "#5fc9b5",
|
|
1339
|
+
"pants": "#3d2c4e",
|
|
1340
|
+
"hair": "#2b1d14",
|
|
1341
|
+
"accent": "#ffd166",
|
|
1342
|
+
"animation": "wave",
|
|
1343
|
+
"height": 1.8,
|
|
1344
|
+
"eyesFollowPointer": true
|
|
1345
|
+
},
|
|
1346
|
+
"behaviours": [{"type": "hoverScale", "scale": 1.06}],
|
|
1347
|
+
"castShadow": true
|
|
1348
|
+
}
|
|
1349
|
+
],
|
|
1350
|
+
"postfx": [{"type": "look", "preset": "clean"}]
|
|
1351
|
+
}
|
|
1352
|
+
```
|
|
1353
|
+
|
|
1354
|
+
- `studio-3point` with a warm `color` tint + `contactShadows` replaces hand-placed lights and a shadow ground.
|
|
1355
|
+
- `mattePastel` lightens its colour a lot: pick a saturated `color` for it.
|
|
1356
|
+
- Animations: idle, walk, run, wave, jump, dance; styles: humanoid, robot, blob, cat, bird (`catalog generators character`).
|
|
1357
|
+
- A rigged library model instead: `{ "kind": "model", "src": "library:models/characters/robot.glb", "fit": 2, "animation": { "clip": "Wave", "loop": true } }` (the model's description lists its clips; an unknown clip makes `render` report an `asset-load` issue listing the real ones).
|