skia2/resources/particles/mouse_trail.json
Brian Osman df18296f98 Add accessors to get/set SkParticleEffect fields
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>
2019-10-15 14:54:50 +00:00

28 lines
628 B
JSON

{
"MaxCount": 2000,
"Drawable": {
"Type": "SkCircleDrawable",
"Radius": 4
},
"EffectCode": [
"void effectSpawn(inout Effect effect) {",
" effect.rate = 800;",
"}",
""
],
"Code": [
"void spawn(inout Particle p) {",
" p.lifetime = 2 + rand;",
" float a = radians(rand * 360);",
" p.vel = float2(cos(a), sin(a)) * mix(5, 15, rand);",
" p.scale = mix(0.25, 0.75, rand);",
"}",
"",
"void update(inout Particle p) {",
" p.color.r = p.age;",
" p.color.g = 1 - p.age;",
"}",
""
],
"Bindings": []
}