Transitions for when setting a new variable?

Ive been playing around with using variables + components. You can change Figma component variants using a string variable (which is great!) but everything is instant. There doesn’t seem to be a way to define any sort of transition between variants. This is also true for number, color and boolean variables. When a variable is set it’s always an instant change.

Is there a way to achieve this?

Hey @Chris_Keith1,

While it won’t be possible to set up a transition in your design file when switching between variables, you’ll have the possibility to build a prototype to do this, with smart animate or any other animation.

Animating the design file itself would use more memory and would tend to lower the overall design experience in most cases.

1 Like

Hi @mfelix , thanks for getting involved in trying to find a solution for this.

From what I can tell, I don’t think your solution solves the issue @Chris_Keith1 was referring to. The problem is that when using variables to change component variants, there is no way to manage the transitions as one normally can when prototyping.

Does anyone know if a solution to this is on the cards, soon?

2 Likes

It’s pretty insane (to me) that this feature was launched without transitions.

1 Like

I have the same question. I don’t think the answer to use smart animate is correct, unless there is a way to apply it to state changes resulting from setting a variable (eg color, component variants). Unless I’m missing it, I don’t see a way to do that.

This trick is probably not intended by Figma, but you can use a variable to change to a second variant. This variant is just temporary. Set it to change to a third variant with the “After delay”-event, with the transition set to 10ms. With the third variant you are free to use whatever transitions you like.

@Marcus_Vedde thats a very interesting idea, did that work for you? I am seeing that the “after delay” animation doesn’t work the variant appears because of variable change.

Animation_example

This is the basic setup. I should mention that you have to set up a click-event with “instant” transition between “first” and “second-incoming”, and also between “second” and “first-incoming”. This is probably because Figma needs a default transition when switching variants from a variable.

1 Like

The solution is actually super simple. If possible connect the variants using an interaction you’re not going to use i.e drag or keypress with smart animate. As long as the variants are linked using smart animate they will animate on the variable update.

1 Like

This is such a useful trick. It works most of the times for me, havent figured out exactly why it doesnt work sometimes