Animated Atrribute doesn't work in parent/sibling components
-
Hey, so I thought I had see this work before, and now its not working. I'm guessing I'm doing something wrong?
I have a DC with 2 subcomponent boxes. One box has an onclick = animate("animated",0,10)
So its attribute of animated is being animated between 0 and 10. So I set its rotZ =animated
I set its sibling component's LenZ =box1!animated
To me, that should mean that its Z height gets animated too on the onclick, because its Z is based on the same animating number. However, its not working like that. The rotation of the first box works fine. But the value of that animated attribute is not being sent out to the sibling. Even after that animation is over and the the value in "animated" is 10, the box2's LenZ still reads 0. Its not updating. I've uploaded my simple model. This is so simple its making my brain hurt, thanks!
Chris
-
It seems to work if you force a redraw. Then the second box changes LenZ. But when you do that it also changes its overall size.Why I haven't figured out yet.
-
I had a play with a few different arrangements and it seems like things will only animate if they or the parent have the attribute.
Here is a working version. I constrained some things as well, to stop the resizing you mentioned, which I believe happens as the dimensions of the master component change due to the animation.
See if that is more like what you wantbetter animating.skp
-
After working with DC a while I've found these rules of thumb. You have to arrest me if I am wrong.
- One sibling cannot make instantly use of a custom attribute value from the others, a redraw is needed
- One sibling cannot make use of a custom attribute value within itself more than in one attribute at a time.
- If you make a custom attribute in the parent refer to a siblings value you can use it simultaneously in all parent/sibling attributes.
So the safe thing to do is to route a value from one sibling to another via a custom att. in the parent. Even so if you want to use it locally in more than one attribute inside one sibling.
Advertisement