skia2/resources/particles/mandrill.json
Brian Osman 95c26efc90 Pure SkSL RNG for particles
Change-Id: I2cb6255a553852a292427d6dc9ef8c5ed7f8286d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252926
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-04-10 17:20:07 +00:00

38 lines
869 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(p.seed), rand(p.seed)) * 200;",
" p.vel = float2(rand(p.seed), rand(p.seed)) * 2 - 1;",
" p.vel *= 20;",
" p.scale = mix(0.25, 1, rand(p.seed));",
"}",
"",
"void update(inout Particle p) {",
" p.color = img(p.pos / 200);",
"}",
""
],
"Bindings": [
{
"Type": "SkImageBinding",
"Name": "img",
"ImagePath": "images",
"ImageName": "mandrill_128.png"
}
]
}