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

32 lines
869 B
JSON

{
"MaxCount": 800,
"Drawable": {
"Type": "SkCircleDrawable",
"Radius": 2
},
"EffectCode": [
"void effectSpawn(inout Effect effect) {",
" effect.lifetime = 4;",
" effect.rate = 120;",
" effect.spin = 6;",
"}",
""
],
"Code": [
"void spawn(inout Particle p) {",
" p.lifetime = 2 + rand(p.seed);",
" p.vel = p.dir * mix(50, 60, rand(p.seed));",
"}",
"",
"void update(inout Particle p) {",
" p.scale = 0.5 + 1.5 * p.age;",
" float3 a0 = float3(0.098, 0.141, 0.784);",
" float3 a1 = float3(0.525, 0.886, 0.980);",
" float3 b0 = float3(0.376, 0.121, 0.705);",
" float3 b1 = float3(0.933, 0.227, 0.953);",
" p.color.rgb = mix(mix(a0, a1, p.age), mix(b0, b1, p.age), rand(p.seed));",
"}",
""
],
"Bindings": []
}