question

Sebastian Kemper avatar image
0 Likes"
Sebastian Kemper asked Matthew Gillespie edited

Edit animation variables

Hello,

I've got a simple question and I don't know what I'm doing wrong.

I create an object and in the Properties->Triggers I create a Custom Draw.

As you know in the tree view you can find it in Object/variables/ondrawtrigger.

Now I want to influence variables in my animation, so I need to go to:

Object/visual/animationinfo/animations/...

Up to now I tried the following commands:

setnodenum(node("@>objectfocus+>visual/animationinfo/animations/turn360/keyframes/1/bodies/1/9"),getlabel(current, 5));

setnodenum(node(">visual/animationinfo/animations/turn360/keyframes/1/bodies/1/9"),getlabel(current, 5));

setnodenum(node("../visual/animationinfo/animations/turn360/keyframes/1/bodies/1/9"),getlabel(current, 5));

Nothing is really working.

Thank you in advance!

FlexSim 17.0.0
animationcustom drawanimation variable
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Matt Long avatar image
3 Likes"
Matt Long answered

Instead of referencing the keyframe values through the tree, create an animation variable. This can be done through the Quick Properties window. Once you add a new variable, use the sampler to sample the keyframe you want to be able to manipulate.

Then the code becomes simple:

setanimationvar(current, "Variable1", current.labelName));

You can also get the value using the getanimationvar() command. Animation variables can also be used to reference components in your animation.


animationvar.png (15.5 KiB)
keyframe.png (37.5 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Marco Baccalaro avatar image
0 Likes"
Marco Baccalaro answered Sebastian Kemper commented

If current is your starting point you may use this syntax:

current.attrs.find("visual/animationinfo/animations/turn360/keyframes/1/bodies/1/9").value = current.labels["labelName"];
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Sebastian Kemper avatar image Sebastian Kemper commented ·

Yes, this is working! Thanks a lot Marco :)

0 Likes 0 ·