skia2/resources/particles/sinusoidal_emitter.json
Brian Osman c81378624f Update all example particle data to new single-code-chunk format
Change-Id: Ic53dc7ecab1b44761fe06e6b528864d24cc5fa58
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/363940
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-02-02 18:07:53 +00:00

33 lines
860 B
JSON

{
"MaxCount": 6000,
"Drawable": {
"Type": "SkCircleDrawable",
"Radius": 2
},
"Code": [
"void effectSpawn(inout Effect effect) {",
" effect.rate = 2000;",
"}",
"",
"void effectUpdate(inout Effect effect) {",
"}",
"",
"void spawn(inout Particle p) {",
" p.pos.y += sin(effect.age * 6.28) * 40;",
" p.lifetime = 2 + (rand(p.seed) * 2);",
" p.vel.x = (30 * rand(p.seed)) + 50;",
" p.vel.y = (20 * rand(p.seed)) - 10;",
"}",
"",
"void update(inout Particle p) {",
" p.color.r = p.age;",
" p.color.g = 1 - p.age;",
" float s1 = 0.5 + (1.5 * p.age);",
" float s2 = 1.0 + (-0.75 * p.age);",
" p.scale = s1 + (s2 - s1) * rand(p.seed);",
" p.vel.y += 20.0 * dt;",
"}",
""
],
"Bindings": []
}