aosp12/external/skia/resources/particles/warp.json

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": []
}