{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "format",
    "version",
    "frames",
    "fps",
    "emitter"
  ],
  "properties": {
    "format": {
      "const": "flipline-particles"
    },
    "version": {
      "const": 1
    },
    "frames": {
      "type": "integer",
      "minimum": 1,
      "maximum": 240
    },
    "fps": {
      "type": "integer",
      "minimum": 1,
      "maximum": 60
    },
    "emitter": {
      "type": "object",
      "additionalProperties": false,
      "description": "Seeded particle emitter. Positions x/y are normalized to the canvas; width/height/size in pixels; speed in px/s; gravity (down) and wind (right) in px/s²; drag per second; easings are CSS timing functions applied over each particle’s life. Optional forces (attractors, turbulence) switch to a fixed-step simulation; shape path emits along stroke points.",
      "required": [
        "shape",
        "x",
        "y",
        "width",
        "height",
        "angle",
        "rate",
        "burst",
        "life",
        "lifeVar",
        "direction",
        "spread",
        "outward",
        "speed",
        "speedVar",
        "gravity",
        "wind",
        "drag",
        "sizeStart",
        "sizeEnd",
        "sizeVar",
        "sizeEase",
        "colorStart",
        "colorEnd",
        "colorEase",
        "opacityStart",
        "opacityEnd",
        "opacityEase",
        "style",
        "seed",
        "loop",
        "prewarm"
      ],
      "properties": {
        "attractors": {
          "type": "array",
          "maxItems": 8,
          "description": "Optional point forces. Positive strength attracts, negative repels (px/s² at the centre, falling smoothly to 0 at the radius).",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "x",
              "y",
              "strength",
              "radius"
            ],
            "properties": {
              "x": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "y": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "strength": {
                "type": "number",
                "minimum": -5000,
                "maximum": 5000
              },
              "radius": {
                "type": "number",
                "minimum": 1,
                "maximum": 3200,
                "description": "Pixels."
              }
            }
          }
        },
        "turbulence": {
          "type": "number",
          "minimum": 0,
          "maximum": 5000,
          "description": "Optional seeded curl-noise turbulence (px/s²); 0 = off."
        },
        "turbulenceScale": {
          "type": "number",
          "minimum": 8,
          "maximum": 1600,
          "description": "Turbulence feature size in pixels (default 160)."
        },
        "turbulenceSpeed": {
          "type": "number",
          "minimum": 0,
          "maximum": 10,
          "description": "How fast the turbulence field changes (per second, default 0.5; loops repeat it seamlessly)."
        },
        "path": {
          "type": "array",
          "minItems": 2,
          "maxItems": 512,
          "description": "Shape 'path' only: normalized stroke points to emit along.",
          "items": {
            "type": "array",
            "minItems": 2,
            "maxItems": 2,
            "items": {
              "type": "number",
              "minimum": -1,
              "maximum": 2
            }
          }
        },
        "shape": {
          "enum": [
            "point",
            "line",
            "rect",
            "ellipse",
            "ring",
            "path"
          ]
        },
        "x": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "y": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "width": {
          "type": "number",
          "minimum": 0,
          "maximum": 1600
        },
        "height": {
          "type": "number",
          "minimum": 0,
          "maximum": 1600
        },
        "angle": {
          "type": "number",
          "minimum": -180,
          "maximum": 180,
          "description": "Emitter rotation in degrees (line and rectangle)."
        },
        "rate": {
          "type": "number",
          "minimum": 0,
          "maximum": 2000,
          "description": "Particles per second."
        },
        "burst": {
          "type": "integer",
          "minimum": 0,
          "maximum": 2000,
          "description": "Particles emitted at time 0 (ignored when looping)."
        },
        "life": {
          "type": "number",
          "minimum": 0.05,
          "maximum": 20,
          "description": "Seconds."
        },
        "lifeVar": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "direction": {
          "type": "number",
          "minimum": -360,
          "maximum": 360,
          "description": "Degrees; 0 = right, 90 = up."
        },
        "spread": {
          "type": "number",
          "minimum": 0,
          "maximum": 360
        },
        "outward": {
          "type": "boolean",
          "description": "Shapes with an area or outline throw particles away from their centre."
        },
        "speed": {
          "type": "number",
          "minimum": 0,
          "maximum": 5000
        },
        "speedVar": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "gravity": {
          "type": "number",
          "minimum": -5000,
          "maximum": 5000
        },
        "wind": {
          "type": "number",
          "minimum": -5000,
          "maximum": 5000
        },
        "drag": {
          "type": "number",
          "minimum": 0,
          "maximum": 20
        },
        "sizeStart": {
          "type": "number",
          "minimum": 1,
          "maximum": 100
        },
        "sizeEnd": {
          "type": "number",
          "minimum": 1,
          "maximum": 100
        },
        "sizeVar": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "sizeEase": {
          "type": "string",
          "maxLength": 200
        },
        "colorStart": {
          "type": "string",
          "pattern": "^#[0-9a-fA-F]{6}$"
        },
        "colorEnd": {
          "type": "string",
          "pattern": "^#[0-9a-fA-F]{6}$"
        },
        "colorEase": {
          "type": "string",
          "maxLength": 200
        },
        "opacityStart": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "opacityEnd": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "opacityEase": {
          "type": "string",
          "maxLength": 200
        },
        "style": {
          "enum": [
            "dot",
            "glow"
          ]
        },
        "seed": {
          "type": "integer",
          "minimum": 0,
          "maximum": 4294967295
        },
        "loop": {
          "type": "boolean"
        },
        "prewarm": {
          "type": "number",
          "minimum": 0,
          "maximum": 20,
          "description": "Seconds simulated before the first frame (non-looping emitters)."
        }
      }
    }
  }
}
