skia2/resources/particles/writing.json
Brian Osman c81378624f Update all example particle data to new single-code-chunk format
Change-Id: Ic53dc7ecab1b44761fe06e6b528864d24cc5fa58
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/363940
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-02-02 18:07:53 +00:00

41 lines
975 B
JSON

{
"MaxCount": 4000,
"Drawable": {
"Type": "SkCircleDrawable",
"Radius": 2
},
"Code": [
"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;",
"}",
"",
"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(p.seed));",
"}",
"",
"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
}
]
}