1{ 2 "MaxCount": 200, 3 "Drawable": { 4 "Type": "SkCircleDrawable", 5 "Radius": 8 6 }, 7 "Code": [ 8 "void effectSpawn(inout Effect effect) {", 9 " effect.lifetime = 2;", 10 "}", 11 "", 12 "void effectUpdate(inout Effect effect) {", 13 " if (effect.age < 0.25 || effect.age > 0.75) { effect.rate = 0; }", 14 " else { effect.rate = 200; }", 15 "}", 16 "", 17 "void spawn(inout Particle p) {", 18 " int idx = int(rand(p.seed) * 4);", 19 " p.color.rgb = (idx == 0) ? float3(0.87, 0.24, 0.11)", 20 " : (idx == 1) ? float3(1.00, 0.90, 0.20)", 21 " : (idx == 2) ? float3(0.44, 0.73, 0.24)", 22 " : float3(0.38, 0.54, 0.95);", 23 "", 24 " p.lifetime = (1 - effect.age) * effect.lifetime;", 25 " p.scale = mix(0.6, 1, rand(p.seed));", 26 "}", 27 "", 28 "void update(inout Particle p) {", 29 " p.color.a = 1 - p.age;", 30 "", 31 " float a = radians(rand(p.seed) * 360);", 32 " float invAge = 1 - p.age;", 33 " p.vel = float2(cos(a), sin(a)) * mix(250, 550, rand(p.seed)) * invAge * invAge;", 34 "}", 35 "" 36 ], 37 "Bindings": [] 38}