Skip to content

Commit

Permalink
Update separatable position to only apply to transform.position field
Browse files Browse the repository at this point in the history
  • Loading branch information
b-wils committed Jun 11, 2024
1 parent 45dec11 commit a4a86a6
Show file tree
Hide file tree
Showing 6 changed files with 216 additions and 51 deletions.
6 changes: 6 additions & 0 deletions docs/specs/properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ Animatable 2D {link:values/vector} with optional spatial tangents.

{schema_object:properties/position-keyframe}

<div id="separated-position"></div>
<h4 id="separatable-position-property">Separatable Position</h4>

{schema_string:properties/separatable-position-property/description}

{schema_object:properties/separated-position}

<h3 id="bezier-property">Bezier Shape</h3>

Expand Down
2 changes: 1 addition & 1 deletion schema/helpers/transform.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"p": {
"title": "Position",
"description": "Position / Translation",
"$ref": "#/$defs/properties/position-property"
"$ref": "#/$defs/properties/separatable-position-property"
},
"r": {
"title": "Rotation",
Expand Down
77 changes: 27 additions & 50 deletions schema/properties/position-property.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,62 +5,39 @@
"description": "An animatable property to represent a position in space",
"oneOf": [
{
"$comment": "Grouped XY position coordinates",
"oneOf": [
{
"$comment": "Not animated",
"properties": {
"a": {
"title": "Animated",
"description": "Whether the property is animated",
"$ref": "#/$defs/values/int-boolean",
"const": 0
},
"k": {
"title": "Static value",
"$ref": "#/$defs/values/vector"
}
}
"$comment": "Not animated",
"properties": {
"a": {
"title": "Animated",
"description": "Whether the property is animated",
"$ref": "#/$defs/values/int-boolean",
"const": 0
},
{
"$comment": "Animated",
"properties": {
"a": {
"title": "Animated",
"description": "Whether the property is animated",
"$ref": "#/$defs/values/int-boolean",
"const": 1
},
"k": {
"type": "array",
"title": "Keyframes",
"description": "Array of keyframes",
"items": {
"$ref": "#/$defs/properties/position-keyframe"
}
}
}
"k": {
"title": "Static value",
"$ref": "#/$defs/values/vector"
}
],
"required": ["a", "k"]
}
},
{
"$comment": "Separate XY position coordinates",
"$comment": "Animated",
"properties": {
"s": {
"title": "Separate",
"description": "Whether the position has seperate xy values",
"type": "boolean",
"const": true
"a": {
"title": "Animated",
"description": "Whether the property is animated",
"$ref": "#/$defs/values/int-boolean",
"const": 1
},
"x": {
"$ref": "#/$defs/properties/scalar-property"
},
"y": {
"$ref": "#/$defs/properties/scalar-property"
"k": {
"type": "array",
"title": "Keyframes",
"description": "Array of keyframes",
"items": {
"$ref": "#/$defs/properties/position-keyframe"
}
}
},
"required": ["s", "x", "y"]
}
}
]
],
"required": ["a", "k"]
}
16 changes: 16 additions & 0 deletions schema/properties/separatable-position-property.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"title": "Separatable Position Property",
"description": "An animatable position where x and y can be definied and animated separately.",
"oneOf": [
{
"$comment": "Grouped XY position coordinates",
"$ref": "#/$defs/properties/position-property"
},
{
"$comment": "Separate XY position coordinates",
"$ref": "#/$defs/properties/separated-position"
}
]
}
25 changes: 25 additions & 0 deletions schema/properties/separated-position.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"title": "Separed Position",
"description": "An animatable position where x and y are definied and animated separately.",
"properties": {
"s": {
"title": "Separate",
"description": "Whether the position has seperate xy values",
"type": "boolean",
"const": true
},
"x": {
"title": "X Position",
"description": "X Position",
"$ref": "#/$defs/properties/scalar-property"
},
"y": {
"title": "Y Position",
"description": "Y Position",
"$ref": "#/$defs/properties/scalar-property"
}
},
"required": ["s", "x", "y"]
}
141 changes: 141 additions & 0 deletions tests/animations/valid/ellipse-xy-pos.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
{
"v": "5.5.7",
"ip": 0,
"op": 180,
"nm": "Animation",
"mn": "{8f1618e3-6f83-4531-8f65-07dd4b68ee2e}",
"fr": 60,
"w": 512,
"h": 512,
"assets": [
],
"layers": [
{
"ddd": 0,
"ty": 4,
"ind": 0,
"st": 0,
"ip": 0,
"op": 180,
"nm": "Layer",
"mn": "{85f37d8b-1792-4a4f-82d2-1b3b6d829c07}",
"ks": {
"a": {
"a": 0,
"k": [
256,
256
]
},
"p": {
"s": true,
"x": {
"a": 0,
"k": 256
},
"y": {
"a": 0,
"k": 256
}
},
"s": {
"a": 0,
"k": [
100,
100
]
},
"r": {
"a": 0,
"k": 0
},
"o": {
"a": 0,
"k": 100
}
},
"shapes": [
{
"ty": "gr",
"nm": "Group",
"it": [
{
"ty": "el",
"nm": "Ellipse",
"p": {
"a": 0,
"k": [
256,
256
]
},
"s": {
"a": 0,
"k": [
256,
256
]
}
},
{
"ty": "st",
"nm": "Stroke",
"mn": "{0930ce27-c8f9-4371-b0cf-111a859abfaf}",
"o": {
"a": 0,
"k": 100
},
"c": {
"a": 0,
"k": [
1,
0.9803921568627451,
0.2823529411764706
]
},
"lc": 2,
"lj": 2,
"ml": 0,
"w": {
"a": 0,
"k": 30
}
},
{
"ty": "tr",
"a": {
"a": 0,
"k": [
249.3134328358209,
254.47164179104476
]
},
"p": {
"a": 0,
"k": [
249.3134328358209,
254.47164179104476
]
},
"s": {
"a": 0,
"k": [
100,
100
]
},
"r": {
"a": 0,
"k": 0
},
"o": {
"a": 0,
"k": 100
}
}
]
}
]
}
]
}

0 comments on commit a4a86a6

Please sign in to comment.