# Interactive multiple folding steps

**URL:** <https://forums.sketchup.com/t/interactive-multiple-folding-steps/32628>\
**Category:** Dynamic Components\
**Tags:** folding, fold\
**Created:** [October 23, 2016, 9:06am UTC](https://forums.sketchup.com/t/interactive-multiple-folding-steps/32628 "2016-10-23T09:06:49Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![stephensaid](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@stephensaid](https://forums.sketchup.com/u/stephensaid)\
**Post date:** [October 23, 2016, 9:06am UTC](https://forums.sketchup.com/t/interactive-multiple-folding-steps/32628/1 "2016-10-23T09:06:50Z")

</div>

Hi all

This is my first post, here.  
I am trying to fold a game board in four. I need to move a panel twice in the same animation. Is this possible?

Thanks  
Stephen

---

<div class="post-metadata">

**Author:** ![jim\_foltz](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/jim_foltz/32/74787_2.png) [@jim\_foltz](https://forums.sketchup.com/u/jim_foltz)\
**Post date:** [October 23, 2016, 9:53am UTC](https://forums.sketchup.com/t/interactive-multiple-folding-steps/32628/2 "2016-10-23T09:53:37Z")

</div>

Here’s a quick example.

[dc-folding-board.skp](https://forums.sketchup.com/uploads/short-url/8Wmf4UvIPikYoPUa7vCcdYK1etu.skp) (22.8 KB)

I used flat quads which end up in the same plane when folded - this causes some z-fighting to occur between the faces. Giving the quads some thickness would solve this, but you then would need to move the axis of rotation so each quad is stacked rather than ending up in the same plane.

This example shows the stack. I faked it by just animating the Z height of 2 of the quads.

[dc-folding-board.skp](https://forums.sketchup.com/uploads/short-url/8Wmf4UvIPikYoPUa7vCcdYK1etu.skp) (22.8 KB)

![](https://global.discourse-cdn.com/sketchup/original/3X/1/4/140d42e3128b900a2a4736c60e43bd6fe1433abe.gif)

---

<div class="post-metadata">

**Author:** ![stephensaid](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@stephensaid](https://forums.sketchup.com/u/stephensaid)\
**Post date:** [October 23, 2016, 10:16am UTC](https://forums.sketchup.com/t/interactive-multiple-folding-steps/32628/3 "2016-10-23T10:16:54Z")

</div>

Hi Jim.

Many thanks for taking the time to answer my question.

This is what I have come to till now. The folding of the board is a bit different from what you did.

My model is folding the board through the table. I wish to turn the model 45 degree up, the do the folding I have, and put the board back on the table.

https://3dwarehouse.sketchup.com/embed.html?mid=705a81f8-71b3-4b67-b64c-b0f908ead30e&width=580&height=326

Is it possible?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![jim\_foltz](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/jim_foltz/32/74787_2.png) [@jim\_foltz](https://forums.sketchup.com/u/jim_foltz)\
**Post date:** [October 23, 2016, 10:32am UTC](https://forums.sketchup.com/t/interactive-multiple-folding-steps/32628/4 "2016-10-23T10:32:16Z")

</div>

I believe it’s possible - with another cup of coffee…

---

<div class="post-metadata">

**Author:** ![stephensaid](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@stephensaid](https://forums.sketchup.com/u/stephensaid)\
**Post date:** [October 23, 2016, 10:51am UTC](https://forums.sketchup.com/t/interactive-multiple-folding-steps/32628/5 "2016-10-23T10:51:07Z")

</div>

I’ll make u a cuppa if you where over

---

<div class="post-metadata">

**Author:** ![jim\_foltz](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/jim_foltz/32/74787_2.png) [@jim\_foltz](https://forums.sketchup.com/u/jim_foltz)\
**Post date:** [October 23, 2016, 11:15am UTC](https://forums.sketchup.com/t/interactive-multiple-folding-steps/32628/6 "2016-10-23T11:15:04Z")

</div>

Ok try this.

[Gameboard[jf].skp](https://forums.sketchup.com/uploads/short-url/kxyKVzowuTXEYDPHU8Z38l5O3Si.skp) (923.0 KB)

---

<div class="post-metadata">

**Author:** ![stephensaid](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@stephensaid](https://forums.sketchup.com/u/stephensaid)\
**Post date:** [October 23, 2016, 12:33pm UTC](https://forums.sketchup.com/t/interactive-multiple-folding-steps/32628/7 "2016-10-23T12:33:44Z")

</div>

WOW!

I’ve got some arithmetics to look into to see how you managed to do all that with one variable (anim) but this is exactly what I was looking for.

Many thanks, mate.

---

<div class="post-metadata">

**Author:** ![jim\_foltz](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/jim_foltz/32/74787_2.png) [@jim\_foltz](https://forums.sketchup.com/u/jim_foltz)\
**Post date:** [October 23, 2016, 12:56pm UTC](https://forums.sketchup.com/t/interactive-multiple-folding-steps/32628/8 "2016-10-23T12:56:30Z")

</div>

I can try to explain, but I’m not a good teacher. Luckily, it’s fairly simple.

[1] When we click on the Component, we animate the `anim` attribute from 0 to 3. The next click will animate it back from 3 to 0.

Your animation requires 3 steps which is why I used 3. Step 1 occurs when `anim` is between 0 - 1, Step 2 occurs between 1 -2, and step 3 occurs between 2 and 3.

[2] the `a1`, `a2`, and `a3` attributes are how we divide `anim` into 3 steps.

- `a1` goes from 0 - 1 when `anim` goes from 0 - 1
- `a2` goes from 0 - 1 when `anim` goes from 1 - 2
- `a3` goes from 0 - 1 when `anim` goes from 2 - 3.

Any number of components can be animated for each step by tying their positions or rotations to the appropriate `a#` attribute. [3] So for the Child4 Component, it only moves during step2 because it is tied to the `a2` attribute. As `a2` goes from 0 - 1, the `angle` goes from 0 to 180° because multiplication.

Of course, the technique can be used for any number of steps just by creating more `a#` attributes. Just increase the “step” in `onclick` and follow the same pattern for the `a#` attributes.

 ![](https://global.discourse-cdn.com/sketchup/original/3X/1/9/19ff5cf66a12b3e045c64c478138e77c53a7eb1b.png)

---

<div class="post-metadata">

**Author:** ![sjdorst](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/sjdorst/32/13212_2.png) [@sjdorst](https://forums.sketchup.com/u/sjdorst)\
**Post date:** [October 23, 2016, 3:46pm UTC](https://forums.sketchup.com/t/interactive-multiple-folding-steps/32628/9 "2016-10-23T15:46:55Z")

</div>

Nice technique! I’m adding to my forum bookmarks for future reference!

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [October 23, 2016, 6:20pm UTC](https://forums.sketchup.com/t/interactive-multiple-folding-steps/32628/10 "2016-10-23T18:20:15Z")

</div>

Moved to [Dynamic Components](http://forums.sketchup.com/c/sketchup/dynamic-components) category, and  
now linked in the **Tips & Tricks** list of the  
[Dynamic Components Resources [wiki]](http://forums.sketchup.com/t/dynamic-components-resources-wiki/25936) thread.
