Skip to main content
J.D_Posey
Jun 22, 2023 7:50 PM UTC
Question

Variables + Smart Animate?

Not seeing a way to have variable bool states allow for smart animations in the same way changing variant states allows for it (i.e. if you made a switch that flipped using 2 variants, it’s easy to have them smart animate to each other… but not possible with variables, as variable state changes don’t seem to have controls for animation)

This topic has been closed for replies.

27 replies

Michael_Kwasiuk
Jun 26, 2023 5:09 PM UTC

Indeed… this makes the new variable boolean states unusable in prototyping. Since prototypes are ment to represent the production product closely as possible.

Jul 12, 2023 10:50 AM UTC

I have been looking for the same thing since the variable update and very surprised that it wasn’t done from the start as it seemed to me the natural way of using them. I also can’t find any info on if it is coming up at any point.

Marshall1
New Member
Jul 13, 2023 6:51 PM UTC

+1

I need the variable changes to be able to use the same smart animate that the other pieces can use

Bez1
New Participant
Jul 25, 2023 11:08 PM UTC
Aug 30, 2023 3:52 PM UTC

It’s convoluted… But I found a work-around. Variables are set up to trigger any “change to” animations that are set up at the component level.

ie. if you create a toggle component with two variants that smart animate to one other on click, then changing the variant state of that component with variables would also trigger that animation.

The trouble is that sometimes you want variables to be the only thing to trigger that state change, and not any other prototyping interaction options like “on hover” or “on click”. If that’s the case, you can kind of hack it by using the “key/gamepad” interaction, but not assigning any key. You can then set up your animation settings, and when the variable triggers the state change from one variant to another, it will pull those “key/gamepad” animation settings without anything else being able to trigger it.

Melissa_A_Casole
Sep 7, 2023 8:21 PM UTC

@J.D_Posey im not sure if you’ve already found the solution to this. But during the Figma Expo they do show how to retain the smart animate function while using variables. The trick is to create a variable that holds all the component states.

  1. create a component with multiple states
  2. smart animate between the states
  3. create a text variables that ‘holds’ each state (i usually just name the variable the name of the component state)
  4. create another text variable that will toggle b/t all the other states (name it like ‘currentState’)
  5. Here’s the. magic: for each state variable - for the value, type in the name of that component state. Figma will automatically pick up that state.
  6. Assign the currentState variable to the element on the frame that will toggle b/t states.
  7. All done!
Cat_de_Leon
Sep 19, 2023 11:23 PM UTC

I’m unable to recreate this using your method. Does this still work for you?

JustJest
New Member
Sep 20, 2023 6:57 PM UTC

How about with a component with one variant and you’re just toggling the layer visibility on and off (ie for a dropdown menu)?

Melissa_A_Casole
Sep 20, 2023 9:08 PM UTC

Here’s a loom i created showing how to do it

Loom
Cat_de_Leon
Sep 20, 2023 9:27 PM UTC

That was really super helpful, thank you so much! Can you please take a quick screenshot or show what the prototyping settings looks like for your component/variants?