Sliding door with rotating handle
-
I'm trying to create a sliding door that moves on click and also have the door handle rotate 90 degrees at the same time.
please post a solution or re-upload sliding door.skp with solution so I can see what you did.Thanks in advance
-
So i kinda figured it out but i couldn't get the handle to rotate 90 degrees. The rotation seems to be restricted by the x position of door#1.
so still looking for a better solution.
-
Instead of using the
animate
function to change the X, you could create a new custom attribute, and then animate that attribute.Let's say you add an attribute named movement. Then onClick would animate the movement variable, which is used by both the Door and its child Component (the handle.)
See image for example;
-
I have a question though could you explain further what /100*-36 means in door position x means.
Thanks for your help
-
@jharchar said:
I have a question though could you explain further what /100*-36 means in door position x means.
Sure, it means: "divided by 100 times negative 36."
I am using the movement as a percent. The movement variable goes from 0 to 100, so dividing it by 100 means it goes from 0 to 1. (Note I did move the Axis of the Door so it was also at the origin.
@jharchar said:
Thanks for your help
Y'er welcome.
-
that makes perfect sense. is there any way to make it more realistic and have the door handle rotate first and then have the door slide? maybe with some type of animation delay.
-
Consecutive animations are harder, unless I'm missing something obvious.
What I did is double the movement from 0-100 to 0-200. Then I use IF statements to test if movement is < 100 and movement is > 100, and set m1 & m2 based on the value of movement. Basically, m1 goes from 0 to 100 when movement goes from 0 - 100, and m2 goes from 0 - 100 when movement goes from 100 - 200.
This is one way, but I would welcome something cleaner.
-
Just a note - you could also have done the concurrent animations by placing 2 (or more) animate functions on the same onClick function, just seprate them using a semi-colon:
onClick: animate(X, 0, 36);animate(Handle!RotY, 0 , 90)
Advertisement