blob: 1b712e9f4b0cd82d060b9047a98a897c0ad3fbd1 [file] [log] [blame]
{
"MaxCount": 300,
"Drawable": {
"Type": "SkCircleDrawable",
"Radius": 3
},
"Code": [
"void effectSpawn(inout Effect effect) {",
" // Phase one: Launch",
" effect.lifetime = 4;",
" effect.rate = 120;",
" float a = radians(mix(-20, 20, rand(effect.seed)) - 90);",
" float s = mix(200, 220, rand(effect.seed));",
" effect.vel.x = cos(a) * s;",
" effect.vel.y = sin(a) * s;",
" effect.color.rgb = float3(rand(effect.seed), rand(effect.seed), rand(effect.seed));",
" effect.pos.x = 0;",
" effect.pos.y = 0;",
" effect.scale = 0.25; // Also used as particle behavior flag",
"}",
"",
"void effectUpdate(inout Effect effect) {",
" if (effect.age > 0.5 && effect.rate > 0) {",
" // Phase two: Explode",
" effect.rate = 0;",
" effect.burst = 50;",
" effect.scale = 1;",
" } else {",
" effect.vel.y += dt * 90;",
" }",
"}",
"",
"void spawn(inout Particle p) {",
" bool explode = p.scale == 1;",
"",
" p.lifetime = explode ? (2 + rand(p.seed) * 0.5) : 0.5;",
" float a = radians(rand(p.seed) * 360);",
" float s = explode ? mix(90, 100, rand(p.seed)) : mix(5, 10, rand(p.seed));",
" p.vel.x = cos(a) * s;",
" p.vel.y = sin(a) * s;",
"}",
"",
"void update(inout Particle p) {",
" p.color.a = 1 - p.age;",
" if (p.scale == 1) {",
" p.vel.y += dt * 50;",
" }",
"}",
""
],
"Bindings": []
}