skia2/resources/particles/orientation.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

33 lines
750 B
JSON

{
"MaxCount": 32,
"Drawable": {
"Type": "SkImageDrawable",
"Path": "images",
"Name": "index8.png",
"Columns": 1,
"Rows": 1
},
"EffectCode": [
"void effectSpawn(inout Effect effect) {",
" effect.rate = 0.5;",
" effect.scale = 0.1;",
"}",
""
],
"Code": [
"void spawn(inout Particle p) {",
" p.lifetime = 5;",
" float a = radians(mix(-30, -80, rand(p.seed)));",
" float s = mix(150, 200, rand(p.seed));",
" p.vel.x = cos(a) * s;",
" p.vel.y = sin(a) * s;",
"}",
"",
"void update(inout Particle p) {",
" p.vel.y += 50 * dt;",
" p.dir = normalize(p.vel);",
"}",
""
],
"Bindings": []
}