d6108add51
Change-Id: Ic81b3433b485ca9ce0e60bd10ec12706e673ee89 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/229917 Commit-Queue: Brian Osman <brianosman@google.com> Commit-Queue: Mike Klein <mtklein@google.com> Auto-Submit: Brian Osman <brianosman@google.com> Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
61 lines
1.5 KiB
JSON
61 lines
1.5 KiB
JSON
{
|
|
"MaxCount": 6000,
|
|
"Duration": 5,
|
|
"Rate": 2000,
|
|
"Drawable": {
|
|
"Type": "SkCircleDrawable",
|
|
"Radius": 2
|
|
},
|
|
"Spawn": [
|
|
"// float rand; Every read returns a random float [0 .. 1)",
|
|
"layout(ctype=float) in uniform float dt;",
|
|
"layout(ctype=float) in uniform float effectAge;",
|
|
"",
|
|
"struct Particle {",
|
|
" float age;",
|
|
" float lifetime;",
|
|
" float2 pos;",
|
|
" float2 dir;",
|
|
" float scale;",
|
|
" float2 vel;",
|
|
" float spin;",
|
|
" float4 color;",
|
|
" float frame;",
|
|
"};",
|
|
"",
|
|
"void main(inout Particle p) {",
|
|
" p.lifetime = 2 + (rand * 2);",
|
|
" p.vel.x = (30 * rand) + 50;",
|
|
" p.vel.y = (20 * rand) - 10;",
|
|
"}",
|
|
""
|
|
],
|
|
"Update": [
|
|
"// float rand; Every read returns a random float [0 .. 1)",
|
|
"layout(ctype=float) in uniform float dt;",
|
|
"layout(ctype=float) in uniform float effectAge;",
|
|
"",
|
|
"struct Particle {",
|
|
" float age;",
|
|
" float lifetime;",
|
|
" float2 pos;",
|
|
" float2 dir;",
|
|
" float scale;",
|
|
" float2 vel;",
|
|
" float spin;",
|
|
" float4 color;",
|
|
" float frame;",
|
|
"};",
|
|
"",
|
|
"void main(inout Particle p) {",
|
|
" p.color.r = p.age;",
|
|
" p.color.g = 1 - p.age;",
|
|
" float s1 = 0.5 + (1.5 * p.age);",
|
|
" float s2 = 1.0 + (-0.75 * p.age);",
|
|
" p.scale = s1 + (s2 - s1) * rand;",
|
|
" p.vel.y += 20.0 * dt;",
|
|
"}",
|
|
""
|
|
],
|
|
"Bindings": []
|
|
} |