{
  "openapi": "3.1.1",
  "info": {
    "title": "Animation Motion Study Generator API",
    "version": "1.0.0",
    "summary": "Generate an editable flipbook to compare animation easing curves.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://fliplinemotionstudy.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Generate an editable flipbook to compare animation easing curves.",
        "description": "Create a ball moving between two canvas positions with linear, ease-in, ease-out or smoothstep spacing. Download the project and open it in Flipline to draw over it.\n\nMethodology:\n- Progress samples include both endpoints: t = index / (drawing count − 1).\n- Easing: linear t, ease-in t², ease-out 1 − (1 − t)², smoothstep t²(3 − 2t). Canvas positions are percentages.\n- This generates a deterministic circle-motion project, not automatic inbetweening of arbitrary artwork. Each drawing is editable.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "flipline_motion_study",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FliplineMotionStudyInput"
              },
              "examples": {
                "example1": {
                  "summary": "Twelve drawings with slow-in, slow-out spacing",
                  "value": {
                    "count": 12,
                    "fps": 12,
                    "ease": "ease-in-out",
                    "fromX": 15,
                    "fromY": 50,
                    "toX": 85,
                    "toY": 50
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FliplineMotionStudyResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "FliplineMotionStudyInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "count": {
            "title": "Drawing count",
            "type": "integer",
            "minimum": 2,
            "maximum": 24,
            "default": 12
          },
          "fps": {
            "title": "Frame rate (FPS)",
            "type": "integer",
            "minimum": 1,
            "maximum": 30,
            "default": 12
          },
          "ease": {
            "title": "Spacing curve",
            "type": "string",
            "enum": [
              "linear",
              "ease-in",
              "ease-out",
              "ease-in-out"
            ],
            "default": "ease-in-out"
          },
          "fromX": {
            "title": "Start X (%)",
            "type": "number",
            "minimum": 8,
            "maximum": 92,
            "default": 15
          },
          "fromY": {
            "title": "Start Y (%)",
            "type": "number",
            "minimum": 8,
            "maximum": 92,
            "default": 50
          },
          "toX": {
            "title": "End X (%)",
            "type": "number",
            "minimum": 8,
            "maximum": 92,
            "default": 85
          },
          "toY": {
            "title": "End Y (%)",
            "type": "number",
            "minimum": 8,
            "maximum": 92,
            "default": 50
          }
        },
        "required": []
      },
      "FliplineMotionStudyResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "project"
            ],
            "properties": {
              "project": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "format",
                  "version",
                  "name",
                  "width",
                  "height",
                  "fps",
                  "background",
                  "transparent",
                  "frames",
                  "layers"
                ],
                "properties": {
                  "format": {
                    "const": "flipline"
                  },
                  "version": {
                    "const": 1
                  },
                  "name": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "width": {
                    "type": "integer",
                    "minimum": 32,
                    "maximum": 1600
                  },
                  "height": {
                    "type": "integer",
                    "minimum": 32,
                    "maximum": 1600
                  },
                  "fps": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 30
                  },
                  "background": {
                    "type": "string",
                    "pattern": "^#[a-fA-F0-9]{6}$"
                  },
                  "transparent": {
                    "type": "boolean"
                  },
                  "frames": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 24,
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id",
                        "hold",
                        "label"
                      ],
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80
                        },
                        "hold": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10
                        },
                        "label": {
                          "type": "string",
                          "maxLength": 80
                        }
                      }
                    }
                  },
                  "layers": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 4,
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id",
                        "name",
                        "visible",
                        "locked",
                        "opacity",
                        "cels"
                      ],
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80
                        },
                        "name": {
                          "type": "string",
                          "maxLength": 80
                        },
                        "visible": {
                          "type": "boolean"
                        },
                        "locked": {
                          "type": "boolean"
                        },
                        "opacity": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1
                        },
                        "cels": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 24,
                          "items": {
                            "type": "array",
                            "maxItems": 500,
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "id",
                                "kind",
                                "points",
                                "color",
                                "size",
                                "fill"
                              ],
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 80
                                },
                                "kind": {
                                  "enum": [
                                    "pen",
                                    "eraser",
                                    "line",
                                    "rect",
                                    "ellipse",
                                    "image"
                                  ]
                                },
                                "points": {
                                  "type": "array",
                                  "minItems": 1,
                                  "maxItems": 4096,
                                  "items": {
                                    "type": "array",
                                    "minItems": 2,
                                    "maxItems": 2,
                                    "items": {
                                      "type": "number",
                                      "minimum": 0,
                                      "maximum": 1
                                    }
                                  }
                                },
                                "color": {
                                  "type": "string",
                                  "pattern": "^#[a-fA-F0-9]{6}$"
                                },
                                "size": {
                                  "type": "number",
                                  "minimum": 1,
                                  "maximum": 100
                                },
                                "fill": {
                                  "type": "boolean"
                                },
                                "source": {
                                  "type": "string",
                                  "pattern": "^data:image/(png|jpeg|webp);base64,[A-Za-z0-9+/=]+$"
                                },
                                "angle": {
                                  "type": "number",
                                  "minimum": -360,
                                  "maximum": 360,
                                  "description": "Clockwise rotation in degrees around the center of the mark bounds (normalized to -180…180)."
                                },
                                "flipX": {
                                  "type": "boolean",
                                  "description": "Mirror horizontally around the mark center."
                                },
                                "flipY": {
                                  "type": "boolean",
                                  "description": "Mirror vertically around the mark center."
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "description": "Normalized drawing coordinates. Each layer has one cel per frame. At most 2 MP canvas, 50000 points, 2000 marks and 8 million embedded source characters in total. Image/shape marks require two points; IDs are unique within their collection. Optional angle/flipX/flipY transform a mark around the center of its point bounds."
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}