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

    Animate doesn't return to normal

    Scheduled Pinned Locked Moved Dynamic Components
    sketchup
    5 Posts 3 Posters 1.4k 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.
    • F Offline
      fizgig
      last edited by

      I have a component that has an onclick function that looks like this : "animate(swing_angle,0,-90)"

      This changes the custom variable called "swing_angle" which is located right next to the above rule in the same component.

      a sub-component has a rule that its RotX is "=Main Component!swing_angle"

      Anyhow, if I click on the whole thing, the sub-component swings down like I want. When I click it again, I expect it to go back to where it was (0 degrees). Instead, it doesn't animate back, but makes a new custom variable called "-90" with a value of "0".

      Anyone know why a new custom variable is created instead of just changing swing_angle back to 0?

      1 Reply Last reply Reply Quote 0
      • jason_marantoJ Offline
        jason_maranto
        last edited by

        Without seeing the file I'd say it sounds like a bug.

        Best,
        Jason.

        I create video tutorial series about several 2D & 3D graphics programs.

        1 Reply Last reply Reply Quote 0
        • S Offline
          Saladyne
          last edited by

          Jason - The file is available in fizgig's 'Anyone know why changing "RotZ" to 45...' thread.
          I would agree that this is a Sketchup bug; I was able to duplicate the problem in a new file using new Components. If a negative value is used in the OnClick 'Animate' or 'Set' functions a new Attribute is created when the negative value is reached; the Attribute is given the name of the -value; it can be deleted but not edited.
          I'm new to DCs but I checked the advice on usage in the 'Dynamic Components Function Examples' and I don't think there is an problem with fizgig's usage.
          Regards, S

          1 Reply Last reply Reply Quote 0
          • S Offline
            Saladyne
            last edited by

            No-one else stepped in so I've done a bit more research and there is a problem with the coding in fizgig's DC. To quote the 'Assembling a Dynamic Component' example from this site; "When you want to reference an attribute value quotation marks are not needed. If you are telling an attribute to do something they are needed". The quotes are noticeably missing around 'swing_angle' in fizgig's component... adding them in fixes the problem of creating a rogue attribute. It doesn't however fix the referencing issues, but these can be corrected by moving the 'onClick ANIMATE' command to the BODY part of the component.

            1 Reply Last reply Reply Quote 0
            • F Offline
              fizgig
              last edited by

              @saladyne said:

              No-one else stepped in so I've done a bit more research and there is a problem with the coding in fizgig's DC. To quote the 'Assembling a Dynamic Component' example from this site; "When you want to reference an attribute value quotation marks are not needed. If you are telling an attribute to do something they are needed". The quotes are noticeably missing around 'swing_angle' in fizgig's component... adding them in fixes the problem of creating a rogue attribute. It doesn't however fix the referencing issues, but these can be corrected by moving the 'onClick ANIMATE' command to the BODY part of the component.

              Sorry Saladyne, I didn't see your post there. Funny enough, I ran into the problem again and knew I had discussed it before. I just came back and searched for my posts and found this thread and your last post about the need for quotes. That did the trick. Thanks so much!

              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