df18296f98
Simplify burst handling. Scripts should just add to burst (if they want to handle programmatic bursting, as well). Update most effects to handle dynamic updates to position better, and add a sample effect meant to be used with mouse tracking. Change-Id: Ia302e1d04e62e2b07974807c44067786cc10a8ad Bug: skia:9513 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248798 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
36 lines
781 B
JSON
36 lines
781 B
JSON
{
|
|
"MaxCount": 4096,
|
|
"Drawable": {
|
|
"Type": "SkCircleDrawable",
|
|
"Radius": 2
|
|
},
|
|
"EffectCode": [
|
|
"void effectSpawn(inout Effect effect) {",
|
|
" effect.rate = 90;",
|
|
"}",
|
|
""
|
|
],
|
|
"Code": [
|
|
"float2 circle() {",
|
|
" float x;",
|
|
" float y;",
|
|
" do {",
|
|
" x = rand * 2 - 1;",
|
|
" y = rand * 2 - 1;",
|
|
" } while (x*x + y*y > 1);",
|
|
" return float2(x, y);",
|
|
"}",
|
|
"",
|
|
"void spawn(inout Particle p) {",
|
|
" p.lifetime = 30;",
|
|
" p.pos += circle() * 40;",
|
|
"}",
|
|
"",
|
|
"void update(inout Particle p) {",
|
|
" p.vel += normalize(p.pos - effect.pos) * dt * 10;",
|
|
" p.scale = mix(0.25, 3, p.age);",
|
|
"}",
|
|
""
|
|
],
|
|
"Bindings": []
|
|
} |