2ae02492a7
This was unnecessary (closed-form unit-disc picking is simpler), and these loops don't meet the strict ES2 standards that we'll be applying to the interpreter soon. Bug: skia:11095 Change-Id: Ic2617c2807fe49d57ff8e4d57d70b9ed1f015916 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348895 Reviewed-by: Kevin Lubick <kjlubick@google.com> Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
101 lines
2.6 KiB
JSON
101 lines
2.6 KiB
JSON
{
|
|
"MaxCount": 128,
|
|
"Drawable": {
|
|
"Type": "SkCircleDrawable",
|
|
"Radius": 2
|
|
},
|
|
"EffectCode": [
|
|
"void effectSpawn(inout Effect effect) {",
|
|
" if (effect.loop == 0) {",
|
|
" cloud(true);",
|
|
" }",
|
|
" effect.color = float4(0.1, 0.1, 1.0, 1.0);",
|
|
" effect.rate = 10;",
|
|
"}",
|
|
""
|
|
],
|
|
"Code": [
|
|
"void spawn(inout Particle p) {",
|
|
" p.lifetime = 4;",
|
|
" p.pos.x = mix(-50, 50, rand(p.seed));",
|
|
" p.vel.y = 50;",
|
|
"}",
|
|
"",
|
|
"void update(inout Particle p) {",
|
|
" p.vel.y += 20 * dt;",
|
|
" if (p.pos.y > 150 && p.scale > 0) {",
|
|
" p.scale = 0;",
|
|
" splash(false);",
|
|
" }",
|
|
"}",
|
|
""
|
|
],
|
|
"Bindings": [
|
|
{
|
|
"Type": "SkEffectBinding",
|
|
"Name": "cloud",
|
|
"MaxCount": 60,
|
|
"Drawable": {
|
|
"Type": "SkCircleDrawable",
|
|
"Radius": 16
|
|
},
|
|
"EffectCode": [
|
|
"void effectSpawn(inout Effect effect) {",
|
|
" effect.color = float4(1, 1, 1, 1);",
|
|
" effect.rate = 30;",
|
|
"}",
|
|
""
|
|
],
|
|
"Code": [
|
|
"float2 circle(inout float seed) {",
|
|
" float r = sqrt(rand(seed));",
|
|
" float a = rand(seed) * 6.283185;",
|
|
" return r * float2(sin(a), cos(a));",
|
|
"}",
|
|
"",
|
|
"void spawn(inout Particle p) {",
|
|
" p.lifetime = 2.5;",
|
|
" p.pos = circle(p.seed) * float2(50, 10);",
|
|
" p.vel.x = mix(-10, 10, rand(p.seed));",
|
|
" p.vel.y = mix(-10, 10, rand(p.seed));",
|
|
"}",
|
|
"",
|
|
"void update(inout Particle p) {",
|
|
" p.color.a = 1 - (length(p.pos) / 150);",
|
|
"}",
|
|
""
|
|
],
|
|
"Bindings": []
|
|
},
|
|
{
|
|
"Type": "SkEffectBinding",
|
|
"Name": "splash",
|
|
"MaxCount": 8,
|
|
"Drawable": {
|
|
"Type": "SkCircleDrawable",
|
|
"Radius": 1
|
|
},
|
|
"EffectCode": [
|
|
"void effectSpawn(inout Effect effect) {",
|
|
" effect.burst = 8;",
|
|
" effect.scale = 1;",
|
|
"}",
|
|
""
|
|
],
|
|
"Code": [
|
|
"void spawn(inout Particle p) {",
|
|
" p.lifetime = rand(p.seed);",
|
|
" float a = radians(mix(-80, 80, rand(p.seed)) - 90);",
|
|
" p.vel.x = cos(a) * 20;",
|
|
" p.vel.y = sin(a) * 20;",
|
|
"}",
|
|
"",
|
|
"void update(inout Particle p) {",
|
|
" p.vel.y += dt * 20;",
|
|
"}",
|
|
""
|
|
],
|
|
"Bindings": []
|
|
}
|
|
]
|
|
} |