e59acb79b8
Change-Id: If57fb79db8f8c5fd185fefaa202167c8082dd846 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/229921 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
50 lines
1.2 KiB
JSON
50 lines
1.2 KiB
JSON
{
|
|
"MaxCount": 4096,
|
|
"Duration": 1,
|
|
"Rate": 1000,
|
|
"Drawable": {
|
|
"Type": "SkCircleDrawable",
|
|
"Radius": 1
|
|
},
|
|
"Code": [
|
|
"// 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 spawn(inout Particle p) {",
|
|
" p.lifetime = mix(1, 3, rand);",
|
|
" float a = radians(mix(250, 290, rand));",
|
|
" float s = mix(10, 30, rand);",
|
|
" p.vel.x = cos(a) * s;",
|
|
" p.vel.y = sin(a) * s;",
|
|
" p.pos = text(rand).xy;",
|
|
"}",
|
|
"",
|
|
"void update(inout Particle p) {",
|
|
" float4 startColor = float4(1, 0.196, 0.078, 1);",
|
|
" float4 endColor = float4(1, 0.784, 0.078, 1);",
|
|
" p.color = mix(startColor, endColor, p.age);",
|
|
"}",
|
|
""
|
|
],
|
|
"Bindings": [
|
|
{
|
|
"Type": "SkTextBinding",
|
|
"Name": "text",
|
|
"Text": "SKIA",
|
|
"FontSize": 96
|
|
}
|
|
]
|
|
} |