# Animation on consequence (DC)

**URL:** <https://forums.sketchup.com/t/animation-on-consequence-dc/250074>\
**Category:** Dynamic Components\
**Created:** [November 30, 2023, 2:13pm UTC](https://forums.sketchup.com/t/animation-on-consequence-dc/250074 "2023-11-30T14:13:10Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Syksy](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/syksy/32/194923_2.png) [@Syksy](https://forums.sketchup.com/u/Syksy)\
**Post date:** [November 30, 2023, 2:13pm UTC](https://forums.sketchup.com/t/animation-on-consequence-dc/250074/1 "2023-11-30T14:13:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![TheOnlyAaron](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/theonlyaaron/32/9436_2.png) [@TheOnlyAaron](https://forums.sketchup.com/u/TheOnlyAaron)\
**Post date:** [November 30, 2023, 2:17pm UTC](https://forums.sketchup.com/t/animation-on-consequence-dc/250074/2 "2023-11-30T14:17:32Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Syksy](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/syksy/32/194923_2.png) [@Syksy](https://forums.sketchup.com/u/Syksy)\
**Post date:** [November 30, 2023, 2:30pm UTC](https://forums.sketchup.com/t/animation-on-consequence-dc/250074/3 "2023-11-30T14:30:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![simjoubert](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/simjoubert/32/224620_2.png) [@simjoubert](https://forums.sketchup.com/u/simjoubert)\
**Post date:** [November 30, 2023, 3:04pm UTC](https://forums.sketchup.com/t/animation-on-consequence-dc/250074/4 "2023-11-30T15:04:33Z")

</div>

> [@Syksy](#):
>
> 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

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)

---

<div class="post-metadata">

**Author:** ![Syksy](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/syksy/32/194923_2.png) [@Syksy](https://forums.sketchup.com/u/Syksy)\
**Post date:** [November 30, 2023, 3:28pm UTC](https://forums.sketchup.com/t/animation-on-consequence-dc/250074/5 "2023-11-30T15:28:38Z")

</div>

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  
 ![Senza titolo](https://global.discourse-cdn.com/sketchup/original/3X/1/7/17c8dc59ff71aecb513917e25a6bf174f9b534a2.png)

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

---

<div class="post-metadata">

**Author:** ![TheOnlyAaron](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/theonlyaaron/32/9436_2.png) [@TheOnlyAaron](https://forums.sketchup.com/u/TheOnlyAaron)\
**Post date:** [November 30, 2023, 3:29pm UTC](https://forums.sketchup.com/t/animation-on-consequence-dc/250074/6 "2023-11-30T15:29:50Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![simjoubert](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/simjoubert/32/224620_2.png) [@simjoubert](https://forums.sketchup.com/u/simjoubert)\
**Post date:** [November 30, 2023, 5:20pm UTC](https://forums.sketchup.com/t/animation-on-consequence-dc/250074/7 "2023-11-30T17:20:32Z")

</div>

Hello  
Do you want something like that ?  
 ![](https://global.discourse-cdn.com/sketchup/original/3X/3/f/3facb48c5d113c45ab43ffaf9f0c47b20a407fb0.gif)

---

<div class="post-metadata">

**Author:** ![simjoubert](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/simjoubert/32/224620_2.png) [@simjoubert](https://forums.sketchup.com/u/simjoubert)\
**Post date:** [November 30, 2023, 10:52pm UTC](https://forums.sketchup.com/t/animation-on-consequence-dc/250074/8 "2023-11-30T22:52:57Z")

</div>

Hello  
Version with better rendering and only one subcomponent with copy. Bobbin rotation, pivoting retaining flap  
 ![](https://global.discourse-cdn.com/sketchup/original/3X/b/3/b32a15afa62b1cc146e26a1e7ff806e664aa21d7.gif)

---

<div class="post-metadata">

**Author:** ![Syksy](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/syksy/32/194923_2.png) [@Syksy](https://forums.sketchup.com/u/Syksy)\
**Post date:** [December 1, 2023, 7:00am UTC](https://forums.sketchup.com/t/animation-on-consequence-dc/250074/9 "2023-12-01T07:00:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![simjoubert](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/simjoubert/32/224620_2.png) [@simjoubert](https://forums.sketchup.com/u/simjoubert)\
**Post date:** [December 1, 2023, 7:07am UTC](https://forums.sketchup.com/t/animation-on-consequence-dc/250074/10 "2023-12-01T07:07:26Z")

</div>

[https://www.simjoubert.com/biblio3D/gif/SketchUp\_lvTYxuEflU.gif(image larger than 5 MB)](https://www.simjoubert.com/biblio3D/gif/SketchUp_lvTYxuEflU.gif)

Attribute of the number of cans,

---

<div class="post-metadata">

**Author:** ![simjoubert](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/simjoubert/32/224620_2.png) [@simjoubert](https://forums.sketchup.com/u/simjoubert)\
**Post date:** [December 1, 2023, 11:27am UTC](https://forums.sketchup.com/t/animation-on-consequence-dc/250074/11 "2023-12-01T11:27:17Z")

</div>

Challenge with option auto reload or not !

[https://www.simjoubert.com/biblio3D/gif/SketchUp\_dgZuCSLSBH.gif(image larger than 5 MB)](https://www.simjoubert.com/biblio3D/gif/SketchUp_dgZuCSLSBH.gif)
  
😉

---

<div class="post-metadata">

**Author:** ![simjoubert](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/simjoubert/32/224620_2.png) [@simjoubert](https://forums.sketchup.com/u/simjoubert)\
**Post date:** [December 6, 2023, 12:28pm UTC](https://forums.sketchup.com/t/animation-on-consequence-dc/250074/12 "2023-12-06T12:28:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Syksy](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/syksy/32/194923_2.png) [@Syksy](https://forums.sketchup.com/u/Syksy)\
**Post date:** [December 7, 2023, 7:28am UTC](https://forums.sketchup.com/t/animation-on-consequence-dc/250074/13 "2023-12-07T07:28:24Z")

</div>

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!
