• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

Animating a roller shade

Scheduled Pinned Locked Moved Dynamic Components
sketchup
14 Posts 2 Posters 1.3k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    Jim
    last edited by 6 Jun 2012, 19:32

    @buckyman said:

    1. 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.

    Hi

    1 Reply Last reply Reply Quote 0
    • J Offline
      Jim
      last edited by 6 Jun 2012, 20:01

      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

      Hi

      1 Reply Last reply Reply Quote 0
      • J Offline
        Jim
        last edited by 7 Jun 2012, 20:14

        I played around a little more - I think this does everything you would expect (minus the material scaling issue.)


        Solar_Shade_LC_zipper_animate2 (1).skp

        Hi

        1 Reply Last reply Reply Quote 0
        • B Offline
          Buckyman
          last edited by 11 Jun 2012, 13:29

          Thanks for the great tips Jim!
          I have two remaining items to solve:

          1. 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.
          2. Some trick to scale the model in 1/4" (for instance) increments.

          Many thx!


          Solar_Shade_LC_zipper_animate2.skp

          1 Reply Last reply Reply Quote 0
          • B Offline
            Buckyman
            last edited by 15 Jun 2012, 19:53

            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!


            Solar_Shade_LC_zipper_animate2.skp

            1 Reply Last reply Reply Quote 0
            • B Offline
              Buckyman
              last edited by 1 Jul 2012, 06:54

              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.

              1 Reply Last reply Reply Quote 0
              • J Offline
                Jim
                last edited by 1 Jul 2012, 12:45

                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".

                2012-07-01_084226.png

                Hi

                1 Reply Last reply Reply Quote 0
                • J Offline
                  Jim
                  last edited by 1 Jul 2012, 16:06

                  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.


                  Solar_Shade_LC_zipper_animate[jf].skp

                  Hi

                  1 Reply Last reply Reply Quote 0
                  • B Offline
                    Buckyman
                    last edited by 5 Jul 2012, 17:45

                    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 😄

                    1 Reply Last reply Reply Quote 0
                    • B Offline
                      Buckyman
                      last edited by 7 Jul 2012, 01:29

                      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

                      1 Reply Last reply Reply Quote 0
                      • J Offline
                        Jim
                        last edited by 7 Jul 2012, 08:33

                        @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?
                        Regards

                        Yeah, 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"

                        Hi

                        1 Reply Last reply Reply Quote 0
                        • 1 / 1
                        • First post
                          Last post
                        Buy SketchPlus
                        Buy SUbD
                        Buy WrapR
                        Buy eBook
                        Buy Modelur
                        Buy Vertex Tools
                        Buy SketchCuisine
                        Buy FormFonts

                        Advertisement