{
  "$schema": "../../schema.json",
  "id": "flip-in",
  "type": "text",
  "title": "Flip in",
  "summary": "Letters flip up into place in 3D, one after another.",
  "tags": [
    "text",
    "3d",
    "playful"
  ],
  "version": "1.0.0",
  "license": "MIT",
  "export": "flipIn",
  "signature": "flipIn(el, t, { start, each, duration, angle, curve })",
  "params": [
    {
      "name": "start",
      "type": "number",
      "default": 0,
      "description": "start time in seconds",
      "hidden": true
    },
    {
      "name": "each",
      "type": "number",
      "default": 0.045,
      "description": "delay between items (s)",
      "min": 0,
      "max": 0.3,
      "step": 0.005,
      "group": "main"
    },
    {
      "name": "duration",
      "type": "number",
      "default": 0.8,
      "description": "length of the transition in seconds; springs use it to keep their feel",
      "min": 0.2,
      "max": 3,
      "step": 0.05,
      "group": "main"
    },
    {
      "name": "angle",
      "type": "number",
      "default": -100,
      "description": "angle in degrees",
      "min": -180,
      "max": 0,
      "step": 1,
      "group": "main"
    },
    {
      "name": "curve",
      "type": "function",
      "default": "ease.outBack",
      "description": "easing function (from `ease`)",
      "control": "ease",
      "group": "main"
    }
  ],
  "install": {
    "kind": "code"
  },
  "files": [
    {
      "path": "moves/flip-in.js",
      "content": "import { ease, clamp, progress } from 'paper-motion';\nimport { chars } from 'paper-motion/kit';\n\n/** Letters flip up into place around their baseline, in 3D. */\nexport function flipIn(el, t, { start = 0, each = 0.045, duration = 0.8, angle = -100, curve = ease.outBack } = {}) {\n  chars(el).forEach((c, i) => {\n    const p = progress(t, start + i * each, start + i * each + duration), q = curve(p);\n    c.style.transformOrigin = '50% 100% -0.2em';\n    c.style.transform = `perspective(700px) rotateX(${angle * (1 - q)}deg)`;\n    c.style.opacity = clamp(p * 3);\n  });\n}\n"
    }
  ],
  "requires": {
    "engine": ">=0.2.0"
  },
  "usage": "import { flipIn } from './moves/flip-in.js';\n\ns.update((t) => flipIn(el, t, { start: 0.5 }));",
  "notes": [
    "Letters flip up into place around their baseline, in 3D."
  ],
  "preview": {
    "video": "previews/flip-in.webm",
    "poster": "previews/flip-in.jpg"
  },
  "mood": [
    "playful",
    "technical"
  ],
  "energy": 3,
  "role": "text",
  "when": [
    "letters as physical tiles",
    "a departures-board feel"
  ]
}