2019-10-17 19:40:18 +00:00
|
|
|
{
|
|
|
|
"MaxCount": 2000,
|
|
|
|
"Drawable": {
|
|
|
|
"Type": "SkCircleDrawable",
|
|
|
|
"Radius": 4
|
|
|
|
},
|
2021-02-01 19:47:30 +00:00
|
|
|
"Code": [
|
2019-10-17 19:40:18 +00:00
|
|
|
"void effectSpawn(inout Effect effect) {",
|
|
|
|
" effect.lifetime = 2;",
|
|
|
|
" effect.rate = 200;",
|
|
|
|
"}",
|
2021-02-01 19:47:30 +00:00
|
|
|
"",
|
2019-10-17 19:40:18 +00:00
|
|
|
"void spawn(inout Particle p) {",
|
|
|
|
" p.lifetime = 10;",
|
|
|
|
"}",
|
|
|
|
"",
|
|
|
|
"float4x4 rx(float rad) {",
|
|
|
|
" float c = cos(rad);",
|
|
|
|
" float s = sin(rad);",
|
|
|
|
" return float4x4(1, 0, 0, 0,",
|
|
|
|
" 0, c, -s, 0,",
|
|
|
|
" 0, s, c, 0,",
|
|
|
|
" 0, 0, 0, 1);",
|
|
|
|
"}",
|
|
|
|
"",
|
|
|
|
"float4x4 ry(float rad) {",
|
|
|
|
" float c = cos(rad);",
|
|
|
|
" float s = sin(rad);",
|
|
|
|
" return float4x4(c, 0, -s, 0,",
|
|
|
|
" 0, 1, 0, 0,",
|
|
|
|
" s, 0, c, 0,",
|
|
|
|
" 0, 0, 0, 1);",
|
|
|
|
"}",
|
|
|
|
"",
|
|
|
|
"float4x4 rz(float rad) {",
|
|
|
|
" float c = cos(rad);",
|
|
|
|
" float s = sin(rad);",
|
|
|
|
" return float4x4( c, s, 0, 0,",
|
|
|
|
" -s, c, 0, 0,",
|
|
|
|
" 0, 0, 1, 0,",
|
|
|
|
" 0, 0, 0, 1);",
|
|
|
|
"}",
|
|
|
|
"",
|
|
|
|
"void update(inout Particle p) {",
|
2020-02-10 18:45:22 +00:00
|
|
|
" float3 pos = float3(rand(p.seed), rand(p.seed), rand(p.seed));",
|
|
|
|
" if (rand(p.seed) < 0.33) {",
|
2019-10-17 19:40:18 +00:00
|
|
|
" if (pos.x > 0.5) {",
|
|
|
|
" pos.x = 1;",
|
|
|
|
" p.color.rgb = float3(1, 0.2, 0.2);",
|
|
|
|
" } else {",
|
|
|
|
" pos.x = 0;",
|
|
|
|
" p.color.rgb = float3(0.2, 1, 1);",
|
|
|
|
" }",
|
2020-02-10 18:45:22 +00:00
|
|
|
" } else if (rand(p.seed) < 0.5) {",
|
2019-10-17 19:40:18 +00:00
|
|
|
" if (pos.y > 0.5) {",
|
|
|
|
" pos.y = 1;",
|
|
|
|
" p.color.rgb = float3(0.2, 0.2, 1);",
|
|
|
|
" } else {",
|
|
|
|
" pos.y = 0;",
|
|
|
|
" p.color.rgb = float3(1, 1, 0.2);",
|
|
|
|
" }",
|
|
|
|
" } else {",
|
|
|
|
" if (pos.z > 0.5) {",
|
|
|
|
" pos.z = 1;",
|
|
|
|
" p.color.rgb = float3(0.2, 1, 0.2);",
|
|
|
|
" } else {",
|
|
|
|
" pos.z = 0;",
|
|
|
|
" p.color.rgb = float3(1, 0.2, 1);",
|
|
|
|
" }",
|
|
|
|
" }",
|
|
|
|
"",
|
|
|
|
" float s = effect.age * 2 - 1;",
|
|
|
|
" s = s < 0 ? -s : s;",
|
|
|
|
"",
|
|
|
|
" pos = pos * 2 - 1;",
|
|
|
|
" pos = mix(pos, normalize(pos), s);",
|
|
|
|
" pos = pos * 100;",
|
|
|
|
"",
|
2021-01-15 18:32:42 +00:00
|
|
|
" float age = float(effect.loop) + effect.age;",
|
2019-10-17 19:40:18 +00:00
|
|
|
" float4x4 mat = rx(age * radians(60))",
|
|
|
|
" * ry(age * radians(70))",
|
|
|
|
" * rz(age * radians(80));",
|
|
|
|
" pos = (mat * float4(pos, 1)).xyz;",
|
|
|
|
"",
|
|
|
|
" p.pos.x = pos.x;",
|
|
|
|
" p.pos.y = pos.y;",
|
|
|
|
" p.scale = ((pos.z + 50) / 100 + 0.5) / 2;",
|
|
|
|
"}",
|
|
|
|
""
|
|
|
|
],
|
|
|
|
"Bindings": []
|
|
|
|
}
|