Problem with multiple animations inside a dynamic component

Hi everybody !

I’m trying for the first time to animate a mold where each part needs to have an independent trajectory.
I want to interact with the full mold, and that each piece take its subsequent place, depending on the step. Here is the code i came with :

Main Component, behaviors, onClick :
set(“step”,1,2,3,4,5,6,7);
animateslow(“X”,if(step=1,0,if(step=2,150,if(step>=3,300))));
animateslow(“Z”,if(step>=4,-3.2)) ;
animateslow(“Moule_SL_Middle!Z”,if(step>=5,-2)) ; animateslow(“Moule_SL_Base!Z”,if(step=5,-2,if(step>=6,-5))) ; animateslow(Moule_SL_Base!Y,if(step>=7,150))

So, there is animation on the full mold, and then on the insides components (Moule_SL_Middle, Moule_SL_Base)

If i’m trying each animateslow individually, it works like a charm. If i’m putting them altogether, i have the following messages :
ERROR : could not parse formula: if(step=5, -2, if(step>=6,-5))
ERROR : could not parse formula : if(step>=7,150)

Why ?
How to work through ?

Thanks a lot for your time and help :smiley:

Each animate function call in an onClick should have the same number of click arguments, even if they do nothing.

So for the Z animation, the first 3 args need to be Z's current value if you want it to remain as it is for these clicks.

I think having you IFs inside the animate function calls will only work if they properly return both true and false values. (The errors are for 2 that only return a true value.)

In other words I think there is a fundamental difference between:
animateslow(Moule_SL_Base!Y,if(step>=7,150))
and
if(step>=7,animateslow(Moule_SL_Base!Y,150),0)

But this may also work:
animateslow(Moule_SL_Base!Y,if(step>=7,150,current(Moule_SL_Base!Y)))

Hi Dan ! Thanks a lot for your quick answer !

So :smiley:

  • i can’t insert an animate fonction inside an if, it needs a value.
  • the fact to put an else value at the end of the ifs doesn’t change the parsing problem

I’m pretty sure the error is not coming from the formula it self: i tried to apply all the animation to the main component, it works fine.

But when i’m trying to apply the exact same formula to an inside component, only the first animateslow works, the other can not be parsed. That’s weird…