skia2/resources/particles/warp.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

30 lines
722 B
JSON

{
"MaxCount": 4096,
"Drawable": {
"Type": "SkCircleDrawable",
"Radius": 2
},
"Code": [
"void effectSpawn(inout Effect effect) {",
" effect.rate = 90;",
"}",
"",
"float2 circle(inout float seed) {",
" float r = sqrt(rand(seed));",
" float a = rand(seed) * 6.283185;",
" return r * float2(sin(a), cos(a));",
"}",
"",
"void spawn(inout Particle p) {",
" p.lifetime = 30;",
" p.pos += circle(p.seed) * 40;",
"}",
"",
"void update(inout Particle p) {",
" p.vel += normalize(p.pos - effect.pos) * dt * 10;",
" p.scale = mix(0.25, 3, p.age);",
"}",
""
],
"Bindings": []
}