sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Animating a roller shade

    Scheduled Pinned Locked Moved Dynamic Components
    sketchup
    14 Posts 2 Posters 1.3k Views 2 Watching
    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.
    • B Offline
      Buckyman
      last edited by

      I was able to find some examples in the forum that helped a lot. My fabric now "rolls up" into the cassette, and I learned that my fabric texture will only scale with the model (later I can design a dynamic fabric component that will do what I want). All the scale handles are still visible despite my settings to the contrary 😞

      I would like the model to scale in 1/4" increments, neither ROUND, NEAREST, LARGEST nor SMALLEST seem to be able to accomplish this. Any pointers?

      I got rid of the Dynamic Option for choosing the colour, and opted instead to use onClick.
      I believe I have structured the code properly, but SU is telling me there is an error with my formula. (file attached)

      TIA


      solarshade_material_error.jpg


      Solar_Shade_LC_zipper_animate2.skp

      1 Reply Last reply Reply Quote 0
      • J Offline
        Jim
        last edited by

        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.

        Hi

        1 Reply Last reply Reply Quote 0
        • J Offline
          Jim
          last edited by

          @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

            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

              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

                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

                  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

                    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

                      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

                        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

                          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

                            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

                              @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