e8bcc56951
- Copy effect state to particle uniforms before each script, so changes from spawn or update are visible. - Guard path binding against out of range access - New effect that actually stresses both of these conditions Change-Id: Ice6112793099e515438af8bb863e9e1bf03d08b1 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249125 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
43 lines
991 B
JSON
43 lines
991 B
JSON
{
|
|
"MaxCount": 4000,
|
|
"Drawable": {
|
|
"Type": "SkCircleDrawable",
|
|
"Radius": 2
|
|
},
|
|
"EffectCode": [
|
|
"void effectSpawn(inout Effect effect) {",
|
|
" effect.lifetime = 4;",
|
|
"}",
|
|
"",
|
|
"void effectUpdate(inout Effect effect) {",
|
|
" effect.color.r = 0;",
|
|
" effect.color.g = 1 - effect.age;",
|
|
" effect.color.b = effect.age;",
|
|
"",
|
|
" effect.rate = effect.age < 0.75 ? 800 : 0;",
|
|
"}",
|
|
""
|
|
],
|
|
"Code": [
|
|
"uniform float2 mouse_pos;",
|
|
"",
|
|
"void spawn(inout Particle p) {",
|
|
" p.lifetime = 4;",
|
|
" p.pos = mouse_pos;",
|
|
" p.frame = effect.age / 0.75 + mix(-0.05, 0.05, rand);",
|
|
"}",
|
|
"",
|
|
"void update(inout Particle p) {",
|
|
" p.pos = mix(p.pos, text(p.frame).xy, 0.05);",
|
|
"}",
|
|
""
|
|
],
|
|
"Bindings": [
|
|
{
|
|
"Type": "SkTextBinding",
|
|
"Name": "text",
|
|
"Text": "HELLO WORLD",
|
|
"FontSize": 96
|
|
}
|
|
]
|
|
} |