Nested animation stops when using variables

I am encountering a bug where the nested animation inside a component stops in the middle when variant state is changed using variables. Can anyone from Figma team help?

Steps to reproduce:

Step1: Lets say a component named X has 3 variants(named alpha, beta and gamma) out of which one variant(alpha) has an animation (animated using a nested component named Y).

Step 2: A local string variable(StringVar) is created and the value is set to one of the component X’s variant names eg:‘alpha’.

Step 3: Drag a child component of component X onto canvas and link the state to the local string variable created above.

Step 4: Create two buttons labeled betaBTN and gammaBTN with mouseenter and mouseleave interactions. So on mouseenter, the local variable StringVar is set to variant names (beta or gamma) based on the buttons(betaBTN or gammaBTN) the mouse is moved over. This works well so far. The issue is with the mouseleave trigger which is set to the animated variant (alpha) so when mouse is outside the button areas you will see some animation. But it is not working as expected. It is changing the variant, but the nested animation stops in the middle of the animation and doesn’t continue. There is no option to reset the state of the variant when using variables.

variable_state_change

I have attached the file if anyone wants to look at this. Thanks in advance.
variable state change.fig (48.7 KB)

1 Like

Hi there,

Thanks for reaching out and sharing the details with the file! I am asking with our internal team. I will get back to you when I have any update.

Thanks,
Toku

Thank you, @y_toku . Looks like there were a few posts talking about this issue. When changing component variants/states using variables, nested animation within a component doesn’t work.

Please let us know if there is an update on this issue.

2 Likes

@y_toku more than happy to jump on a zoom to demo the issue. :slight_smile:

Any update on this? @y_toku @Junko3

@N.A.G.A @Guy_Meyer1 My deepest apologies for the late reply! I’ve been consulting with our internal team about your issue. However, I think it’s best if our support team takes a closer look at your file.

Could you please contact our support team directly and provide a copy of your file: https://help.figma.com/hc/en-us/requests/new?

Make sure to use the email linked to your Figma account, include links to the file in question, and grant access to support-share@figma.com. Don’t worry, sharing your file with us won’t affect your billing.

Sorry again for keeping you all wait but I hope our support team will help you further.

Thanks,
Toku

I have a workaround to this that may help. TL;DR - opening an overlay jump-starts nested animations.

Explanation and demo file here: Trigger `On Delay` action with boolean logic - #6 by Darwin_Campa

Same problem with me — a nested component with looped animation on delay doesn’t work after parent component variant is changed

Problem still exists. I have had no success getting any animation to work when using a variable to change component states.

First try: Creating a “start” variant on the parent level that after a short delay triggers auto animate (slide into view) to another variant “end”. Variable would be set from navigation but animation would never happen.

Second try: Nest a component that has the same animation then set several of those as variants in a master component that would then be switched via variable…animation never runs.

Basically, what I am trying to accomplish is having a hover state on a navigation item that would then trigger an image animating into view (slide + fade-in). Each nav item would have a different image animating into view.

Hi there, Thanks for reaching out. Sorry to hear that you still have an issue.

It’s hard to know if what you’re seeing is a bug or how it’s supposed to work without looking at the file. I suggest you contact our support team so they can take a closer look at your file here: https://help.figma.com/hc/en-us/requests/new?ticket_form_id=360001744374
When reaching out, please remember to include the following details:

  • Your Figma account email
  • Recording or Screenshots of the issue, capturing the full Figma screen with the left and right-hand panels
  • The URLs of the affected file and any related library files, add support-share@figma.com as an editor of those files(this will not affect your billing)

Thanks for your assistance and understanding!

@N.A.G.A I’ve downloaded your Figma file and created a nested component with a variant animation: https://www.figma.com/proto/poImmmhAmduAyKWYRaukQc/variable-state-change?page-id=0%3A1&node-id=1-7&node-type=CANVAS&viewport=184%2C32%2C0.63&t=ZDKIGdcZANtvwnF9-1&scaling=min-zoom&content-scaling=fixed

Let me know if that’s correct :sweat_smile:

It seems like it is close to what I was looking for but it is pretty glitchy :slight_smile:. When I hover over one of your nav items the animation doesn’t always play. Are the star and triangle animations part of the same component? What I was trying to do in my scenario was have a group of images all with a fade-in animation within the same component. Hover over a nav item and nav item updates variable, component switches to proper variant but then the delay I have set on that variant to transition to the next variant never gets triggered (see attached fig file).
Navigation Test.fig (3.4 MB)

@Shane_ANDERSON Apologies for the glitch :sweat_smile:. I was just trying to show that a nested component with a variant animation is working.

I have a project now that uses nested components but I used the action “On click/On tap” . I’ve shown the status on purpose right now to show you how the animation and conditions work when the action is loaded and clicked.


For your project right now, you are using the hover/mouse enter/leave action.
I will try that… :grinning:

Just take note, in nested components and are you going to play the animation of the child component*(component with variant animation)* you need to call the variant1 and variant2 to trigger the animation*(because if you just call the variant1 it will not play the animation)*.

Take a look at this screenshot to call the nested component to play the animation when the button is clicked:

I don’t know what I’m doing… if this advanced prototyping or a damn thing :rofl:… but I hope it will help ya’ll until the Figma update and make this in simple way. :v:

1 Like

Well I don’t know what I’m doing either :slight_smile: but saying to call the start variant and end variant did get me closer but for some reason it plays the animation twice.
Navigation Test.fig (3.4 MB)

Ok, I added the set variable to the Hover action and now it works much better, though it would be nice if the nav hover animation and the image animation played at the same time, but this is at least looking good :slight_smile: Thanks for your help!
Navigation Test.fig (3.4 MB)

So… 7 months later, we still havn’t heard from Figma about this? :thinking:
This issue is still persistent.

Nested smart animation do not trigger on ‘Conditional’ & ‘Set Variable’.

The only smart animation that works is a drag animation like a carousel.

@Shane_ANDERSON That’s great! You’ve figured it out! :clap:
I agree with @Miggi_from_Figgi that “Start Simple”. :grin:

@Shane_ANDERSON By the way, I’ve created a simple way for your Fig Test…

For the hover issue… I’ve created a simple trick for the button.
I added a hidden button to handle the “Mouse Enter” on top of the “Hover” button.

For your components with the animation variant, I’ve made a simple trick as well. For the interaction use “Key/Gamepad” to handle the smart animation and use one variant for your transition effect like make as default or variant1.

I know this is difficult to explain here but check out the screenshot and the Fig file that I created based on your Fig test file. I’ve created a Slide fade and a simple fade.

https://www.figma.com/proto/ynunPitJ9bSuGIeeAVTRfu/NavigationTest_Simplify?page-id=0%3A1&node-id=1-53&node-type=CANVAS&viewport=-235%2C7%2C1&t=ifwbBdmZdjo8btiE-1&scaling=min-zoom&content-scaling=fixed

NavigationTest_Simplify.fig (3.5 MB)