skia2/resources/particles/fireworks.json
Brian Osman fb79f9faa4 Remove all particle examples that use SkEffectBinding
I'm going to remove this feature to simplify migration to skvm.
fireworks was updated to work without it. raincloud is fairly complex,
and not that attractive, so it's just being deleted.

Change-Id: Id2d5cd490baa7bae627002f41edf7522c8bdfcd8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353076
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-01-12 19:09:18 +00:00

54 lines
1.6 KiB
JSON

{
"MaxCount": 300,
"Drawable": {
"Type": "SkCircleDrawable",
"Radius": 3
},
"EffectCode": [
"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;",
" }",
"}",
""
],
"Code": [
"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": []
}