skia2/resources/particles/snowfall.json
Brian Osman 8a97782956 Move common particle code to an automatically-injected header
Change-Id: If99e1802c8187ebd98b67717d744c6695bb25900
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/238118
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-08-29 18:49:33 +00:00

48 lines
1.1 KiB
JSON

{
"MaxCount": 4096,
"Duration": 1,
"Rate": 30,
"Drawable": {
"Type": "SkCircleDrawable",
"Radius": 1
},
"Code": [
"// float rand; Every read returns a random float [0 .. 1)",
"",
"void spawn(inout Particle p) {",
" p.lifetime = 10;",
" p.vel.y = 10 + rand * 20;",
" p.vel.x = -5 + 10 * rand;",
" p.pos.x = rand * 500;",
"}",
"",
"void update(inout Particle p) {",
" p.scale = size(p.age);",
"}",
""
],
"Bindings": [
{
"Type": "SkCurveBinding",
"Name": "size",
"Curve": {
"XValues": [],
"Segments": [
{
"Type": "Cubic",
"Ranged": true,
"Bidirectional": false,
"A0": 10,
"B0": 10,
"C0": 10,
"D0": 0,
"A1": 10,
"B1": 0,
"C1": 0,
"D1": 0
}
]
}
}
]
}