Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

feat(examples): neon-ascension rain streaks and vent steam

yhh6c8d178b78c3
diff --git a/examples/neon-ascension/assets/scenes/main.esscene b/examples/neon-ascension/assets/scenes/main.esscene
index 10d3993db..6dcb96189 100644
--- a/examples/neon-ascension/assets/scenes/main.esscene
+++ b/examples/neon-ascension/assets/scenes/main.esscene
@@ -2972,6 +2972,335 @@
}
}
]
+ },
+ {
+ "id": 73,
+ "name": "RainNear",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 150,
+ "y": 1500,
+ "z": -650
+ }
+ }
+ },
+ {
+ "type": "ParticleEmitter",
+ "data": {
+ "looping": true,
+ "playOnStart": true,
+ "enabled": true,
+ "simulationSpace": 0,
+ "texture": "@uuid:6d3f8a52-1b7e-4c0a-9e41-5a2c7b90d4e1",
+ "shape": 2,
+ "shapeSize": {
+ "x": 2600,
+ "y": 1,
+ "z": 1000
+ },
+ "speedMin": 0,
+ "speedMax": 0,
+ "gravity": {
+ "x": 120,
+ "y": -2600,
+ "z": 0
+ },
+ "startColor": {
+ "r": 0.72,
+ "g": 0.84,
+ "b": 1,
+ "a": 0.38
+ },
+ "endColor": {
+ "r": 0.72,
+ "g": 0.84,
+ "b": 1,
+ "a": 0.11399999999999999
+ },
+ "startSizeMin": 3,
+ "startSizeMax": 3,
+ "endSizeMin": 3,
+ "endSizeMax": 3,
+ "trailEnabled": true,
+ "trailWidth": 2.4000000000000004,
+ "trailPoints": 6,
+ "trailMinDistance": 14,
+ "blendMode": 1,
+ "rate": 1500,
+ "maxParticles": 2000,
+ "lifetimeMin": 1.15,
+ "lifetimeMax": 1.15
+ }
+ }
+ ]
+ },
+ {
+ "id": 74,
+ "name": "RainFar",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 700,
+ "y": 2600,
+ "z": -3200
+ }
+ }
+ },
+ {
+ "type": "ParticleEmitter",
+ "data": {
+ "looping": true,
+ "playOnStart": true,
+ "enabled": true,
+ "simulationSpace": 0,
+ "texture": "@uuid:6d3f8a52-1b7e-4c0a-9e41-5a2c7b90d4e1",
+ "shape": 2,
+ "shapeSize": {
+ "x": 7000,
+ "y": 1,
+ "z": 5200
+ },
+ "speedMin": 0,
+ "speedMax": 0,
+ "gravity": {
+ "x": 120,
+ "y": -2600,
+ "z": 0
+ },
+ "startColor": {
+ "r": 0.72,
+ "g": 0.84,
+ "b": 1,
+ "a": 0.2
+ },
+ "endColor": {
+ "r": 0.72,
+ "g": 0.84,
+ "b": 1,
+ "a": 0.06
+ },
+ "startSizeMin": 6,
+ "startSizeMax": 6,
+ "endSizeMin": 6,
+ "endSizeMax": 6,
+ "trailEnabled": true,
+ "trailWidth": 4.800000000000001,
+ "trailPoints": 6,
+ "trailMinDistance": 14,
+ "blendMode": 1,
+ "rate": 1500,
+ "maxParticles": 2800,
+ "lifetimeMin": 1.7,
+ "lifetimeMax": 1.7
+ }
+ }
+ ]
+ },
+ {
+ "id": 75,
+ "name": "SteamDeck",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -560,
+ "y": 215,
+ "z": 150
+ }
+ }
+ },
+ {
+ "type": "ParticleEmitter",
+ "data": {
+ "looping": true,
+ "playOnStart": true,
+ "enabled": true,
+ "simulationSpace": 0,
+ "texture": "@uuid:6d3f8a52-1b7e-4c0a-9e41-5a2c7b90d4e1",
+ "shape": 3,
+ "shapeRadius": 22,
+ "shapeAngle": 16,
+ "speedMin": 70,
+ "speedMax": 150,
+ "gravity": {
+ "x": 25,
+ "y": 35,
+ "z": 0
+ },
+ "damping": 0.4,
+ "noiseStrength": 70,
+ "noiseFrequency": 0.0025,
+ "noiseScrollSpeed": 0.2,
+ "noiseOctaves": 2,
+ "startColor": {
+ "r": 0.78,
+ "g": 0.82,
+ "b": 0.92,
+ "a": 0.13
+ },
+ "endColor": {
+ "r": 0.55,
+ "g": 0.62,
+ "b": 0.8,
+ "a": 0
+ },
+ "startSizeMin": 90,
+ "startSizeMax": 130,
+ "endSizeMin": 320,
+ "endSizeMax": 460,
+ "blendMode": 0,
+ "rate": 45,
+ "maxParticles": 320,
+ "lifetimeMin": 3.5,
+ "lifetimeMax": 5
+ }
+ }
+ ]
+ },
+ {
+ "id": 76,
+ "name": "SteamStreet",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 1450,
+ "y": -235,
+ "z": -700
+ }
+ }
+ },
+ {
+ "type": "ParticleEmitter",
+ "data": {
+ "looping": true,
+ "playOnStart": true,
+ "enabled": true,
+ "simulationSpace": 0,
+ "texture": "@uuid:6d3f8a52-1b7e-4c0a-9e41-5a2c7b90d4e1",
+ "shape": 3,
+ "shapeRadius": 22,
+ "shapeAngle": 16,
+ "speedMin": 70,
+ "speedMax": 150,
+ "gravity": {
+ "x": 25,
+ "y": 35,
+ "z": 0
+ },
+ "damping": 0.4,
+ "noiseStrength": 70,
+ "noiseFrequency": 0.0025,
+ "noiseScrollSpeed": 0.2,
+ "noiseOctaves": 2,
+ "startColor": {
+ "r": 0.78,
+ "g": 0.82,
+ "b": 0.92,
+ "a": 0.13
+ },
+ "endColor": {
+ "r": 0.55,
+ "g": 0.62,
+ "b": 0.8,
+ "a": 0
+ },
+ "startSizeMin": 90,
+ "startSizeMax": 130,
+ "endSizeMin": 320,
+ "endSizeMax": 460,
+ "blendMode": 0,
+ "rate": 45,
+ "maxParticles": 320,
+ "lifetimeMin": 3.5,
+ "lifetimeMax": 5
+ }
+ }
+ ]
+ },
+ {
+ "id": 77,
+ "name": "SteamRight",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 1950,
+ "y": -225,
+ "z": -1000
+ }
+ }
+ },
+ {
+ "type": "ParticleEmitter",
+ "data": {
+ "looping": true,
+ "playOnStart": true,
+ "enabled": true,
+ "simulationSpace": 0,
+ "texture": "@uuid:6d3f8a52-1b7e-4c0a-9e41-5a2c7b90d4e1",
+ "shape": 3,
+ "shapeRadius": 22,
+ "shapeAngle": 16,
+ "speedMin": 70,
+ "speedMax": 150,
+ "gravity": {
+ "x": 25,
+ "y": 35,
+ "z": 0
+ },
+ "damping": 0.4,
+ "noiseStrength": 70,
+ "noiseFrequency": 0.0025,
+ "noiseScrollSpeed": 0.2,
+ "noiseOctaves": 2,
+ "startColor": {
+ "r": 0.78,
+ "g": 0.82,
+ "b": 0.92,
+ "a": 0.13
+ },
+ "endColor": {
+ "r": 0.55,
+ "g": 0.62,
+ "b": 0.8,
+ "a": 0
+ },
+ "startSizeMin": 90,
+ "startSizeMax": 130,
+ "endSizeMin": 320,
+ "endSizeMax": 460,
+ "blendMode": 0,
+ "rate": 45,
+ "maxParticles": 320,
+ "lifetimeMin": 3.5,
+ "lifetimeMax": 5
+ }
+ }
+ ]
}
]
}
\ No newline at end of file
diff --git a/examples/neon-ascension/assets/textures/soft.png b/examples/neon-ascension/assets/textures/soft.png
new file mode 100644
index 000000000..8de3f69a7
Binary files /dev/null and b/examples/neon-ascension/assets/textures/soft.png differ
diff --git a/examples/neon-ascension/assets/textures/soft.png.meta b/examples/neon-ascension/assets/textures/soft.png.meta
new file mode 100644
index 000000000..b5ab7a243
--- /dev/null
+++ b/examples/neon-ascension/assets/textures/soft.png.meta
@@ -0,0 +1,12 @@
+{
+ "uuid": "6d3f8a52-1b7e-4c0a-9e41-5a2c7b90d4e1",
+ "version": "2.0",
+ "type": "texture",
+ "importer": {
+ "maxSize": 2048,
+ "filterMode": "linear",
+ "wrapMode": "clamp",
+ "premultiplyAlpha": false,
+ "sliceBorder": { "left": 0, "right": 0, "top": 0, "bottom": 0 }
+ }
+}
diff --git a/examples/neon-ascension/tools/make-greybox.mjs b/examples/neon-ascension/tools/make-greybox.mjs
index 6b9f1c734..ef6a20cea 100644
--- a/examples/neon-ascension/tools/make-greybox.mjs
+++ b/examples/neon-ascension/tools/make-greybox.mjs
@@ -176,6 +176,39 @@ pointLight('TowerCyan', [TX, 1200, TZ + 600], rgba(0.1, 0.8, 1.0), 1.0, 2600);
pointLight('TowerBase', [TX, 100, TZ + 900], sodium, 0.6, 1800);
pointLight('BridgeGlow', [200, 0, -2300], sodium, 0.4, 1400);
+// ---- weather: rain streaks and vent steam, all particles on the one soft sprite ----
+const SOFT = '@uuid:6d3f8a52-1b7e-4c0a-9e41-5a2c7b90d4e1';
+const emitter = (name, p, data) => add(name, [
+ transform(p),
+ { type: 'ParticleEmitter', data: {
+ looping: true, playOnStart: true, enabled: true, simulationSpace: 0,
+ texture: SOFT, ...data,
+ } },
+]);
+const rain = (name, p, extent, o) => emitter(name, p, {
+ shape: 2, shapeSize: { x: extent[0], y: 1, z: extent[1] },
+ speedMin: 0, speedMax: 0, gravity: { x: 120, y: -2600, z: 0 },
+ startColor: rgba(0.72, 0.84, 1, o.alpha), endColor: rgba(0.72, 0.84, 1, o.alpha * 0.3),
+ startSizeMin: o.size, startSizeMax: o.size, endSizeMin: o.size, endSizeMax: o.size,
+ trailEnabled: true, trailWidth: o.size * 0.8, trailPoints: 6, trailMinDistance: 14,
+ blendMode: 1, rate: o.rate, maxParticles: o.max, lifetimeMin: o.life, lifetimeMax: o.life,
+});
+// Kept clear of the camera (z 900): a drop that passes close is a bar across the frame.
+rain('RainNear', [150, 1500, -650], [2600, 1000], { alpha: 0.38, size: 3, rate: 1500, max: 2000, life: 1.15 });
+rain('RainFar', [700, 2600, -3200], [7000, 5200], { alpha: 0.2, size: 6, rate: 1500, max: 2800, life: 1.7 });
+
+const vent = (name, p) => emitter(name, p, {
+ shape: 3, shapeRadius: 22, shapeAngle: 16,
+ speedMin: 70, speedMax: 150, gravity: { x: 25, y: 35, z: 0 }, damping: 0.4,
+ noiseStrength: 70, noiseFrequency: 0.0025, noiseScrollSpeed: 0.2, noiseOctaves: 2,
+ startColor: rgba(0.78, 0.82, 0.92, 0.13), endColor: rgba(0.55, 0.62, 0.8, 0),
+ startSizeMin: 90, startSizeMax: 130, endSizeMin: 320, endSizeMax: 460,
+ blendMode: 0, rate: 45, maxParticles: 320, lifetimeMin: 3.5, lifetimeMax: 5,
+});
+vent('SteamDeck', [-560, 215, 150]);
+vent('SteamStreet', [1450, -235, -700]);
+vent('SteamRight', [1950, -225, -1000]);
+
const scene = { version: 4, name: 'Main', entities };
writeFileSync(path.join(SCENES, 'main.esscene'), JSON.stringify(scene, null, 2));
writeFileSync(path.join(ROOT, 'project.esproject'), JSON.stringify({