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

40 lines
895 B
JSON

{
"MaxCount": 32,
"Drawable": {
"Type": "SkImageDrawable",
"Path": "images",
"Name": "explosion_sprites.png",
"Columns": 4,
"Rows": 4
},
"EffectCode": [
"void effectSpawn(inout Effect effect) {",
" effect.rate = 8;",
"}",
""
],
"Code": [
"float2 circle(inout uint seed) {",
" float x;",
" float y;",
" do {",
" x = rand(seed) * 2 - 1;",
" y = rand(seed) * 2 - 1;",
" } while (x*x + y*y > 1);",
" return float2(x, y);",
"}",
"",
"void spawn(inout Particle p) {",
" p.lifetime = 1.0 + rand(p.seed) * 2.0;",
" float2 ofs = circle(p.seed) * 60;",
" p.pos += ofs;",
" p.vel = ofs / 3;",
"}",
"",
"void update(inout Particle p) {",
" p.frame = p.age;",
"}",
""
],
"Bindings": []
}