1{ 2 "MaxCount": 6000, 3 "Duration": 5, 4 "Rate": 2000, 5 "Drawable": { 6 "Type": "SkCircleDrawable", 7 "Radius": 2 8 }, 9 "Code": [ 10 "// float rand; Every read returns a random float [0 .. 1)", 11 "layout(ctype=float) in uniform float dt;", 12 "layout(ctype=float) in uniform float effectAge;", 13 "", 14 "struct Particle {", 15 " float age;", 16 " float lifetime;", 17 " float2 pos;", 18 " float2 dir;", 19 " float scale;", 20 " float2 vel;", 21 " float spin;", 22 " float4 color;", 23 " float frame;", 24 "};", 25 "", 26 "void spawn(inout Particle p) {", 27 " p.lifetime = 2 + (rand * 2);", 28 " p.vel.x = (30 * rand) + 50;", 29 " p.vel.y = (20 * rand) - 10;", 30 "}", 31 "", 32 "void update(inout Particle p) {", 33 " p.color.r = p.age;", 34 " p.color.g = 1 - p.age;", 35 " float s1 = 0.5 + (1.5 * p.age);", 36 " float s2 = 1.0 + (-0.75 * p.age);", 37 " p.scale = s1 + (s2 - s1) * rand;", 38 " p.vel.y += 20.0 * dt;", 39 "}", 40 "" 41 ], 42 "Bindings": [] 43}