Skip to main content

applyAnimationStyle

Applies a Motion animation style to this node and returns the applied animation style instance id.

Signature

applyAnimationStyle(styleId: string, animationStyleData?: AnimationStyleConfiguration): string

Parameters

styleId

The styleId of the animation style to apply. Use figmaAnimationStyles to get available styles.

animationStyleData

Optional values used to configure the applied animation style.

Remarks

const node = figma.currentPage.selection[0]
const [style] = figma.motion.figmaAnimationStyles()
if (node && style) {
const appliedStyleId = node.applyAnimationStyle(style.styleId, {
duration: 0.4,
timelineOffset: 0,
props: {
direction: 'right',
distance: 120,
},
})
console.log(appliedStyleId)
}