# Animation on consequence (DC)

Hi! im giving my first steps in OnClick animations with dynamic components, and the animation im trying to make its something like this:

Object A, moves forward and changes position (x, y and z) and in consequence, Object B takes the place of Object A.

Is this possible?
To add a new layer of difficulty to all this context, i want to use this on a Virtual reality device haha, i know i can move DCs in VR sketch using the meta quest 2, but i have neved made an animation this complex

OnClick can set the state of a variable and the location of components can be set based on that variable. This should work pretty well!

but the thing is, how i make that an action on COMPONENT A makes an effect on COMPONENT b?

Hello
What is the relationship between A and B
Are they brothers? Parent and child,
Natively you can obtain value from : parent, brother or child

B move at the same time of A withe same direction and length?
If yes put B on A
If B move only when A arrive to the same place
Put A and B in a super component, create an attribute Â« animate_value on it

A On click attribute on A that animate the animate_value
Set the formula on x for A
X= if(parent!animate_value<50, parent!animate_value,50)
And for B
X =if(paren!animate_value<50,50,parent!animate_value)

A and B are brothers, i guess, i struggle a bit to understand this.

To be more graphic, the situation is this : A and B are lets say cans of coca cola. on a slide shelf with pendence, when i took away A, B per â€śgravityâ€ť takes A place. As in this very humble design xD

I animated A as a sequence of movements. But i dont know how to connnect all this to B.

Make the location of both Component A and Component B dependent on a user defined attribute. Use IF statements to set the location based on that attribute (for example, set locX to 'IF UserAttribute=1, 10,20, then have UserAttribute change from 0 to 1 with OnClick).

Hello
Do you want something like that ?

Hello
Version with better rendering and only one subcomponent with copy. Bobbin rotation, pivoting retaining flap

4 Likes

THATS IT! Thank you so much im going to try it and let you know!

Attribute of the number of cans,

2 Likes

Challenge with option auto reload or not !

3 Likes

Hello, Do you try? do you have success or need the solution ?

1 Like

I tried to replicate your example and it worked! Unfortunately when applying it to mine they asked me to move on to another task so I will return to it in the future, thank you!