• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1{
2   "MaxCount": 4096,
3   "Duration": 1,
4   "Rate": 30,
5   "Drawable": {
6      "Type": "SkCircleDrawable",
7      "Radius": 1
8   },
9   "Code": [
10      "// float rand; Every read returns a random float [0 .. 1)",
11      "layout(ctype=float) in uniform float dt;",
12      "layout(ctype=float) in uniform float effectAge;",
13      "",
14      "struct Particle {",
15      "  float  age;",
16      "  float  lifetime;",
17      "  float2 pos;",
18      "  float2 dir;",
19      "  float  scale;",
20      "  float2 vel;",
21      "  float  spin;",
22      "  float4 color;",
23      "  float  frame;",
24      "};",
25      "",
26      "void spawn(inout Particle p) {",
27      "  p.lifetime = 10;",
28      "  p.vel.y = 10 + rand * 20;",
29      "  p.vel.x = -5 + 10 * rand;",
30      "  p.pos.x = rand * 500;",
31      "}",
32      "",
33      "void update(inout Particle p) {",
34      "  p.scale = size(p.age);",
35      "}",
36      ""
37   ],
38   "Bindings": [
39      {
40         "Type": "SkCurveBinding",
41         "Name": "size",
42         "Curve": {
43            "XValues": [],
44            "Segments": [
45               {
46                  "Type": "Cubic",
47                  "Ranged": true,
48                  "Bidirectional": false,
49                  "A0": 10,
50                  "B0": 10,
51                  "C0": 10,
52                  "D0": 0,
53                  "A1": 10,
54                  "B1": 0,
55                  "C1": 0,
56                  "D1": 0
57               }
58            ]
59         }
60      }
61   ]
62}