Skip to content

Commit

Permalink
Support separated xy position coordinates (#33)
Browse files Browse the repository at this point in the history
* WIP Seperate XY position properties

* Support separated xy position coordinates

* Update separatable position to only apply to transform.position field

* Update separated position name to split position

* Remove Z property from split position

3D is not in scope for 1.0 spec
  • Loading branch information
b-wils authored Jul 12, 2024
1 parent 36082d0 commit 1b06071
Show file tree
Hide file tree
Showing 6 changed files with 190 additions and 2 deletions.
6 changes: 6 additions & 0 deletions docs/specs/properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ Animatable 2D {link:values/vector} with optional spatial tangents.

{schema_object:properties/position-keyframe}

<div id="split-position"></div>
<h4 id="splitable-position-property">Split Position</h4>

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

{schema_object:properties/split-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/splitable-position-property"
},
"r": {
"title": "Rotation",
Expand Down
2 changes: 1 addition & 1 deletion schema/properties/position-property.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"title": "Keyframes",
"description": "Array of keyframes",
"items": {
"$ref": "#/$defs/properties/position-keyframe"
"$ref": "#/$defs/properties/position-keyframe"
}
}
}
Expand Down
25 changes: 25 additions & 0 deletions schema/properties/split-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": "Split Position",
"description": "An animatable position where x and y are definied and animated separately.",
"properties": {
"s": {
"title": "Split",
"description": "Whether the position has split 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"]
}
16 changes: 16 additions & 0 deletions schema/properties/splitable-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": "Splitable Position Property",
"description": "An animatable position where position values may be defined and animated separately.",
"oneOf": [
{
"$comment": "Grouped XY position coordinates",
"$ref": "#/$defs/properties/position-property"
},
{
"$comment": "Split XY position coordinates",
"$ref": "#/$defs/properties/split-position"
}
]
}
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 1b06071

Please sign in to comment.