Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port schema from lottie-docs #15

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Build Schema
on:
push:
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Setup
run: |
sudo apt update -q
sudo apt install -yy python
-
name: Schema
run: |
python schema/schema-merge.py
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
schema/docs/json/lottie.schema.json
46 changes: 46 additions & 0 deletions schema/docs/json/animated-properties/animated-property.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"title": "Multi Dimensional",
"description": "An animatable property that holds an array of numbers",
"allOf": [
{
"properties": {
"ix": {
"title": "Property Index",
"type": "integer"
},
"a": {
"title": "Animated",
"description": "Whether the property is animated",
"$ref": "#/$defs/helpers/int-boolean",
"default": 0
},
"x": {
"title": "Expression",
"type": "string"
}
}
},
{
"if": {
"properties": {
"a": { "const": 1 }
}
},
"then": {
"properties": {
"k": {
"type": "array",
"title": "Animated Value",
"description": "Array of keyframes",
"items": {
"$ref": "#/$defs/animated-properties/keyframe"
}
}
}
}
}
],
"required": ["k"]
}
26 changes: 26 additions & 0 deletions schema/docs/json/animated-properties/color-value.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"title": "Color Value",
"description": "An animatable property that holds a Color",
"allOf": [
{
"$ref": "#/$defs/animated-properties/animated-property"
},
{
"if": {
"properties": {
"a": { "const": 0 }
}
},
"then": {
"properties": {
"k": {
"title": "Static value",
"$ref": "#/$defs/helpers/color"
}
}
}
}
]
}
20 changes: 20 additions & 0 deletions schema/docs/json/animated-properties/gradient-colors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"title": "Gradient Colors",
"description": "Represents colors and offsets in a gradient\n\nColors are represented as a flat list interleaving offsets and color components in weird ways\nThere are two possible layouts:\n\nWithout alpha, the colors are a sequence of offset, r, g, b\n\nWith alpha, same as above but at the end of the list there is a sequence of offset, alpha",

"properties": {
"k": {
"title": "Colors",
"$ref": "#/$defs/animated-properties/multi-dimensional"
},
"p": {
"title": "Count",
"description": "Number of colors in `k`",
"type": "integer",
"default": 0
}
},
"required": ["p", "k"]
}
52 changes: 52 additions & 0 deletions schema/docs/json/animated-properties/keyframe-base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"title": "Keyframe",
"description": "A Keyframes specifies the value at a specific time and the interpolation function to reach the next keyframe.",
"allOf": [
{
"properties": {
"t": {
"title": "Time",
"type": "number",
"default": 0
},
"h": {
"title": "Hold",
"$ref": "#/$defs/helpers/int-boolean",
"default": 0
}
}
},
{
"if": {
"oneOf": [
{
"properties": {
"h": { "const": 0 }
}
},
{
"not": {"required": ["h"]}
}
]
},
"then": {
"properties": {
"i": {
"title": "In Tangent",
"description": "Easing tangent going into the next keyframe",
"$ref": "#/$defs/animated-properties/keyframe-bezier-handle"
},
"o": {
"title": "Out Tangent",
"description": "Easing tangent leaving the current keyframe",
"$ref": "#/$defs/animated-properties/keyframe-bezier-handle"
}
}
}
}
],
"required": ["t", "s"]
}

53 changes: 53 additions & 0 deletions schema/docs/json/animated-properties/keyframe-bezier-handle.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"title": "Keyframe Bezier Handle",
"description": "Bezier handle for keyframe interpolation",
"properties": {
"x": {
"title": "X",
"description": "Time component:\n0 means start time of the keyframe,\n1 means time of the next keyframe.",
"oneOf":[
{
"type": "array",
"items": {
"type": "number",
"default": 0,
"minimum": 0,
"maximum": 1
},
"minItems": 1
},
{
"type": "number",
"default": 0,
"minimum": 0,
"maximum": 1
}
]
},
"y": {
"title": "Y",
"description": "Value interpolation component:\n0 means start value of the keyframe,\n1 means value at the next keyframe.",
"oneOf": [
{
"type": "array",
"items": {
"type": "number",
"default": 0,
"minimum": 0,
"maximum": 1
},
"minItems": 1
},
{
"type": "number",
"default": 0,
"minimum": 0,
"maximum": 1
}
]
}
},
"required": ["x", "y"]
}
61 changes: 61 additions & 0 deletions schema/docs/json/animated-properties/keyframe.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"title": "Keyframe",
"description": "A Keyframes specifies the value at a specific time and the interpolation function to reach the next keyframe.",
"allOf": [
{
"$ref": "#/$defs/animated-properties/keyframe-base"
},
{
"properties": {
"s": {
"title": "Value",
"description": "Value at this keyframe. Note the if the property is a scalar, keyframe values are still represented as arrays",
"type": "array",
"items": {
"type": "number"
}
},
"e": {
"title": "End value",
"description": "Value at the end of the keyframe, note that this is deprecated and you should use `s` from the next keyframe to get this value",
"deprecated": true,
"type": "array",
"items": {
"type": "number"
}
}
}
},
{
"if": {
"oneOf": [
{
"properties": {
"h": { "const": 0 }
}
},
{
"not": {"required": ["h"]}
}
]
},
"then": {
"properties": {
"i": {
"title": "In Tangent",
"description": "Easing tangent going into the next keyframe",
"$ref": "#/$defs/animated-properties/keyframe-bezier-handle"
},
"o": {
"title": "Out Tangent",
"description": "Easing tangent leaving the current keyframe",
"$ref": "#/$defs/animated-properties/keyframe-bezier-handle"
}
}
}
}
],
"required": ["t", "s"]
}
36 changes: 36 additions & 0 deletions schema/docs/json/animated-properties/multi-dimensional.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"title": "Multi Dimensional",
"description": "An animatable property that holds an array of numbers",
"allOf": [
{
"$ref": "#/$defs/animated-properties/animated-property"
},
{
"if": {
"properties": {
"a": { "const": 0 }
}
},
"then": {
"properties": {
"k": {
"title": "Static value",
"type": "array",
"items": {
"type": "number"
}
}
}
},
"properties": {
"l": {
"title": "Length",
"description": "Number of components in the value arrays.\nIf present values will be truncated or expanded to match this length when accessed from expressions.",
"type": "integer"
}
}
}
]
}
30 changes: 30 additions & 0 deletions schema/docs/json/animated-properties/position-keyframe.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"title": "Position Keyframe",
"allOf": [
{
"$ref": "#/$defs/animated-properties/keyframe"
},
{
"properties": {
"ti": {
"title": "Value In Tangent",
"description": "Tangent for values (eg: moving position around a curved path)",
"type": "array",
"items": {
"type": "number"
}
},
"to": {
"title": "Value Out Tangent",
"description": "Tangent for values (eg: moving position around a curved path)",
"type": "array",
"items": {
"type": "number"
}
}
}
}
]
}
Loading