skia2/resources/particles/mandrill.json
Brian Osman db2e7641be Particles: SkImageBinding to allow sampling an image from script
Provides functionality similar to AE property maps

Change-Id: I1705706a6b7e25fbab55465f2e20d0b145330b0b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255977
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-12-03 15:22:20 +00:00

38 lines
829 B
JSON

{
"MaxCount": 4000,
"Drawable": {
"Type": "SkCircleDrawable",
"Radius": 3
},
"EffectCode": [
"void effectSpawn(inout Effect effect) {",
" effect.rate = 4000;",
"}",
"",
"void effectUpdate(inout Effect effect) {",
"}",
""
],
"Code": [
"void spawn(inout Particle p) {",
" p.lifetime = 1;",
" p.pos = float2(rand, rand) * 200;",
" p.vel = float2(rand, rand) * 2 - 1;",
" p.vel *= 20;",
" p.scale = mix(0.25, 1, rand);",
"}",
"",
"void update(inout Particle p) {",
" p.color = img(p.pos / 200);",
"}",
""
],
"Bindings": [
{
"Type": "SkImageBinding",
"Name": "img",
"ImagePath": "images",
"ImageName": "mandrill_128.png"
}
]
}