skia2/resources/particles/path_spawn.json
Brian Osman e7f68f3644 Tweak ParticlesSlide's resource provider to show how to use PathBinding
Adds an example effect that spawns particles along an SkPath.

Change-Id: I53f3c02fefec814bd9e16f3ac593eac4cf6a297c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/341418
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-12-07 17:26:39 +00:00

35 lines
724 B
JSON

{
"MaxCount": 800,
"Drawable": {
"Type": "SkCircleDrawable",
"Radius": 2
},
"EffectCode": [
"void effectSpawn(inout Effect effect) {",
" effect.lifetime = 1;",
" effect.rate = 100;",
"}",
""
],
"Code": [
"void spawn(inout Particle p) {",
" float4 pos_and_normal = my_path(rand(p.seed));",
" p.pos = pos_and_normal.xy;",
" p.vel = pos_and_normal.zw * -5;",
"",
" p.lifetime = 2;",
"}",
"",
"void update(inout Particle p) {",
"}",
""
],
"Bindings": [
{
"Type": "SkPathBinding",
"Name": "my_path",
"PathPath": "",
"PathName": "star"
}
]
}