# Interactive multiple folding steps

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

Hereâ€™s a quick example.

dc-folding-board.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 (22.8 KB)

4 Likes

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.

Is it possible?

I believe itâ€™s possible - with another cup of coffeeâ€¦

Iâ€™ll make u a cuppa if you where over

Ok try this.

Gameboard[jf].skp (923.0 KB)

2 Likes

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.

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.

4 Likes

Nice technique! Iâ€™m adding to my forum bookmarks for future reference!

Moved to Dynamic Components category, and
now linked in the Tips & Tricks list of the