Shape Element

Shape elements are 2D vector graphics that can be rendered as rectangles, circles, stars, polygons, or custom paths.

Shape Extrusion to 3D

Shape elements can be converted to 3D elements in the editor through extrusion. When a shape is extruded:

  • A new element with type: "3D" is created
  • The original 2D shape parameters are preserved in the extrusionSource field
  • Additional 3D-specific properties control the extrusion depth, beveling, and corner styles

For details on extruded shapes, see the 3D Element documentation.

Shape Properties

PropTypeRequiredExampleValue RangeDescription
shapeTypestringtrue-SHAPE_RECT | SHAPE_ELLIPSE | SHAPE_STAR | SHAPE_POLYGON | SHAPE_PATHThe type of shape element, such as rectangle, circle, or polygon.
fillstring | objecttrue#FFFFFF-The fill of the shape. Can be a hex color string (e.g., "#FFFFFF") or a gradient object with type "linear" or "radial", colorStops array, and start/end coordinates.
strokestringfalse--The stroke color of the shape, in hex format.
strokeWidthnumberfalse->= 0The width of the stroke applied to the shape, in pixels.
keyframesarrayfalse--An array of keyframes defining animation states and transitions for the shape element.
viewobjecttrue--The view settings for the shape element, including position, scale, and rotation.
transformobjecttrue--The transformation settings for the shape element, including skew and alpha.
pathsarrayfalse--An array of path data for the shape element, used when shapeType is SHAPE_PATH.

Note: SHAPE_RECT, SHAPE_ELLIPSE, SHAPE_STAR, and SHAPE_POLYGON are basic shapes, while SHAPE_PATH refers to a path shape constructed using Bézier curves.

View

PropTypeRequiredExampleValue RangeDescription
xnumbertrue0>= 0The horizontal position of the shape element, in pixels.
ynumbertrue0>= 0The vertical position of the shape element, in pixels.
widthnumbertrue100>= 0The width of the shape element, in pixels.
heightnumbertrue100>= 0The height of the shape element, in pixels.
scaleXnumbertrue1> 0The horizontal scaling factor of the shape element. A value greater than 1 enlarges the element, while a value between 0 and 1 shrinks it.
scaleYnumbertrue1> 0The vertical scaling factor of the shape element. A value greater than 1 enlarges the element, while a value between 0 and 1 shrinks it.
rotationnumbertrue0>= 0The rotation angle of the shape element, in degrees.

Transform

PropTypeRequiredExampleValue RangeDescription
xnumbertrue0>= 0The horizontal position of the shape element, in pixels.
ynumbertrue0>= 0The vertical position of the shape element, in pixels.
anchorXnumbertrue--The x-coordinate of the anchor point relative to the shape element, in pixels.
anchorYnumbertrue--The y-coordinate of the anchor point relative to the shape element, in pixels.
rotationnumbertrue0>= 0The rotation angle of the shape element, in degrees.
scaleXnumbertrue1> 0The horizontal scaling factor of the shape element. A value greater than 1 enlarges the element, while a value between 0 and 1 shrinks it.
scaleYnumbertrue1> 0The vertical scaling factor of the shape element. A value greater than 1 enlarges the element, while a value between 0 and 1 shrinks it.
alphanumbertrue10 - 1The transparency level of the shape element. 1 represents full opacity, and 0 represents full transparency.

Basic Shape Example

shapeElement.json
1 2{ 3 "id": "ca6664b1-3ddf-4525-9137-1ad2440788bd", 4 "type": "Shape", 5 "start": 0, 6 "duration": 5, 7 "trackIndex": 1, 8 "x": 250.04168816332555, 9 "y": 5.833740234374999, 10 "blendMode": "normal", 11 "anchorX": 0, 12 "anchorY": 0, 13 "view": { 14 "width": 300, 15 "height": 300, 16 "x": 0, 17 "y": 0, 18 "scaleX": 1, 19 "scaleY": 1, 20 "rotation": 0, 21 "anchorX": 0, 22 "anchorY": 0 23 }, 24 "rotation": 0, 25 "scaleX": 1, 26 "scaleY": 1, 27 "alpha": 1, 28 "skewX": 0, 29 "skewY": 0, 30 "transform": { 31 "x": 0, 32 "y": 0, 33 "anchorX": 0, 34 "anchorY": 0, 35 "rotation": 0, 36 "scaleX": 1, 37 "scaleY": 1, 38 "alpha": 1 39 }, 40 "keyframes": [], 41 "shapeType": "SHAPE_RECT", 42 "fill": "#818cf8", 43 "stroke": "#4f46e5", 44 "strokeWidth": 5 45} 46

Path Shape Example

shapeElement.json
1 2{ 3 "id": "9106fbc1-e753-43b1-bccc-5402bee3bd40", 4 "type": "Shape", 5 "start": 0, 6 "duration": 5, 7 "trackIndex": 3, 8 "x": 0, 9 "y": 0, 10 "blendMode": "normal", 11 "anchorX": 0, 12 "anchorY": 0, 13 "rotation": 0, 14 "scaleX": 1, 15 "scaleY": 1, 16 "alpha": 1, 17 "skewX": 0, 18 "skewY": 0, 19 "view": { 20 "x": 0, 21 "y": 0, 22 "scaleX": 1, 23 "scaleY": 1, 24 "rotation": 0, 25 "anchorX": 0, 26 "anchorY": 0 27 }, 28 "transform": { 29 "x": 0, 30 "y": 0, 31 "anchorX": 0, 32 "anchorY": 0, 33 "rotation": 0, 34 "scaleX": 1, 35 "scaleY": 1, 36 "alpha": 1 37 }, 38 "keyframes": [], 39 "shapeType": "SHAPE_PATH", 40 "fill": "#EAA0E3", 41 "fillAlpha": 1, 42 "fillType": 1, 43 "stroke": null, 44 "strokeWidth": 1, 45 "paths": [ 46 { 47 "c": 1, 48 "v": [ 49 [349.601, 146.124], 50 [345.894, 171.368], 51 [174.8, 268.894], 52 [135.70100000000002, 265.807], 53 [118.95800000000003, 262.498], 54 [31.56900000000003, 309.817], 55 [67.26600000000003, 242.913], 56 [0, 146.124], 57 [174.801, 23.354], 58 [349.601, 146.124] 59 ], 60 "i": [ 61 [0, 0], 62 [2.4329999999999927, -8.150000000000006], 63 [84.21999999999997, 0], 64 [12.568999999999988, 2.0229999999999677], 65 [5.459999999999994, 1.2860000000000014], 66 [0, 0], 67 [-4.677000000000007, 19.093999999999994], 68 [0, 39.321], 69 [-96.54399999999998, 0], 70 [0, -67.804] 71 ], 72 "o": [ 73 [0, 8.651999999999987], 74 [-16.567999999999984, 55.691], 75 [-13.445999999999998, 0], 76 [-5.693999999999988, -0.9119999999999777], 77 [-33.803, 35.70800000000003], 78 [21.046, -21.045999999999992], 79 [-40.93500000000003, -22.461000000000013], 80 [0, -67.804], 81 [96.54399999999998, 0], 82 [0, 0] 83 ] 84 } 85 ] 86} 87