Animating a roller shade
-
The Scale Mask will work on a Component, which you should be using instead of Groups anyway.
For the Materials, I would set a Color attribute in the parent Component from the child. I.E.
LargeCassette: (child)
onClick: set(Parent!Color, 1, 2, 3)
Solar Shade: (parent)
Color: 1 Material: =if(Color=1,"Color_000",if(Color=2,"Color_D10","Color_C14"))
then remove the Color attribute from the child - it's no longer needed.
A side note - you should include a small, hidden palette of the colors within the DC so when the DC is distributed, the colors always exist.
-
@buckyman said:
- Shortly after adding the onClick attribute, I noticed a custom attribute with numbers. Please refer to attached screen shot. Is this related to the onClick attribute, or did I have an epileptic seizure?
This happens (it seems to me) when an animation goes into negative values. The fix is to double-quote the attibute being animated:
onClick: animate(**"**Z**"**, ...)
The rules for when you need to double-quote attributes and when not to are not clear to me.
-
For the animation, I would also animate an attribute in the parent from the child.
Solar Shade: (parent)
anim: 0
Shade Cloth: (child)
onClick: animate(Parent!anim, 0, 100)
(The trick that you may not have realized is that the animate function can animate not only the built-in attributes, but also any arbitrary attribute.)
Now, all of the child components of Solar Shade can use the
anim
attribute. I used 0 to 100 because it makes it easy to think of the animation goimg from 0 to 100%. Then of course you need to scale each animated attribute from 0 to 100%. for example, if a rotation goes from 0 to 90 degrees, you might use:RotZ: =anim / 100 * 90
-
I played around a little more - I think this does everything you would expect (minus the material scaling issue.)
-
Thanks for the great tips Jim!
I have two remaining items to solve:- Scale Tool is set to only move X & Z axis but ALL controls are visible.
Your version on the other hand correctly shows the visible controls. - Some trick to scale the model in 1/4" (for instance) increments.
Many thx!
- Scale Tool is set to only move X & Z axis but ALL controls are visible.
-
I figured out how to constrain the scale tool to 1/8" increments.
Everything is perfect except one thing...
Scaling vertically results in strange animation behaviour. Please load attached model, scale vertically higher or lower, then click the blue fabric to see what happens.This is the last detail I need, hope someone out there has the answer!
-
Bump my own thread
I haven't been able to solve this last part of the puzzle, sure would appreciate a hint to help get this sucker finished. -
Recomendation 1
Use a minimum height so that the component can not be scaled to impossibly small dimensions. Here, the component can not be scaled to anything under 24".
-
Recommendation 2
The reason the Scale does not work is that you are controlling the size of the shade from the onclick event. Scaling does not trigger the onclick, so the size is never updated.
You need to base the size and position of the shade cloth off of some attributes of the parent component. When you scale the top-level component, the redraw then "trickles down" to child components (at least one level down.)
In both the shade and bottom rail component, I use the exact same animation formula - animating an attribute in the parent component as a percent (from 0 to 100). DC's track the state of animations, so this keeps the animation in sync because the same attribute is animated, although from different onclick events in separate components. My goal in doing this was to allow onclick on the bottom rail as well as the shade cloth because I was finding it hard to click on the cloth to trigger the anim.
I'm not sure I'm explaining it well, so have a look at the formulas and see if they make sense.
-
Thanks a bunch Jim.
Sorry for the late reply, I though I was supposed to get email notification when there was a new post, I'll have to check that.
Your explanation was fine -
Hi again Jim
SU does not like rounding in .125" increments, it jumps in higher amounts (usually .5" is the min increment I get) despite zooming in to try to get more control.
How does it behave at your end?
Regards -
@buckyman said:
Hi again Jim
SU does not like rounding in .125" increments, it jumps in higher amounts (usually .5" is the min increment I get) despite zooming in to try to get more control.
How does it behave at your end?
RegardsYeah, the scaling works for me, although it can be hard to control especially when scaling "freely" without using any reference geometry to snap to. Are your units set to less precision than 1/8"? If so and you are using Dimensions, the dimensions will round to the precision settings even if the actual height is rounded to 1/8"
Advertisement