skia2/resources/particles/text.json
Brian Osman 95c26efc90 Pure SkSL RNG for particles
Change-Id: I2cb6255a553852a292427d6dc9ef8c5ed7f8286d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252926
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-04-10 17:20:07 +00:00

38 lines
949 B
JSON

{
"MaxCount": 2000,
"Drawable": {
"Type": "SkCircleDrawable",
"Radius": 1
},
"EffectCode": [
"void effectSpawn(inout Effect effect) {",
" effect.rate = 1000;",
"}",
""
],
"Code": [
"void spawn(inout Particle p) {",
" p.lifetime = mix(1, 3, rand(p.seed));",
" float a = radians(mix(250, 290, rand(p.seed)));",
" float s = mix(10, 30, rand(p.seed));",
" p.vel.x = cos(a) * s;",
" p.vel.y = sin(a) * s;",
" p.pos += text(rand(p.seed)).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
}
]
}