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

    Animation in SketchUp

    Scheduled Pinned Locked Moved Developers' Forum
    58 Posts 10 Posters 8.8k Views 10 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.
    • M Offline
      MartinRinehart
      last edited by

      @morisdov said:

      I think its best to stay with the native API timer with its limitation of firing every one second,

      Huh? I'm using UI.start_timer( 1.0/fps, true ) (fps usually 25) and getting nice, smooth animations.

      Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        @martinrinehart said:

        @morisdov said:

        I think its best to stay with the native API timer with its limitation of firing every one second,

        Huh? I'm using UI.start_timer( 1.0/fps, true ) (fps usually 25) and getting nice, smooth animations.

        Did a quick test:

        t=Time.now; i=0;id = UI.start_timer(1.0, true) { puts Time.now - t; i+=1; UI.stop_timer(id) if i > 9 }; 826 1.015 2.027 3.041 4.056 5.07 6.085 7.097 8.111 9.125 10.14

        t=Time.now; i=0;id = UI.start_timer(1.0 / 2, true) { puts Time.now - t; i+=1; UI.stop_timer(id) if i > 9 }; 783 0.045 0.072 0.093 0.113 0.132 0.151 0.171 0.19 0.211 0.23

        Note that the timer set to less than one second doesn't trigger every half second as you'd expect it to. The results are the same if it's 1.0 / 2 or 1.0 / 10 ...

        Thomas Thomassen — SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • thomthomT Offline
          thomthom
          last edited by

          Seems that when the timer is less than a second it's the same as a normal loop, the timer code block will trigger as fast as I can.

          Thomas Thomassen — SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

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

            You may be getting smooth animations, but they are not 25 fps. When you use a timer, the animations play as fast as your computer can play them because the timer rounds the fractional second down to near zero.

            It's not terribly important, in my opinion because you can still generate the correct frame-rate when exporting images to compile into an animation; and also renderers can do the same. It is only the in-sketchup animation that will be incorrect.

            Hi

            1 Reply Last reply Reply Quote 0
            • M Offline
              MartinRinehart
              last edited by

              ThomThom and Jim:

              Thank you!

              Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

              1 Reply Last reply Reply Quote 0
              • Chris FullmerC Offline
                Chris Fullmer
                last edited by

                @jim said:

                It's not terribly important, in my opinion because you can still generate the correct frame-rate when exporting images to compile into an animation; and also renderers can do the same. It is only the in-sketchup animation that will be incorrect.

                +1

                I agree completely. I don't think that main desire for animations is to make something move inside of SU, but to make something move that can be output inside a video. It should also be viewable in SU, but the final output only needs to be accurate in the video for my needs.

                Chris

                Lately you've been tan, suspicious for the winter.
                All my Plugins I've written

                1 Reply Last reply Reply Quote 0
                • thomthomT Offline
                  thomthom
                  last edited by

                  Does help if SU can display an approximate - so you get a feel of the animation before you render.

                  Thomas Thomassen — SketchUp Monkey & Coding addict
                  List of my plugins and link to the CookieWare fund

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    MartinRinehart
                    last edited by

                    I'm going to try to make stuff move in SketchUp. And move at the rate I specify. Chapter 16 has now been re-purposed to Animation. Will I get an accurate (or at least more-or-less accurate) frame rate using Animation?

                    What we are saying here is that Lininger's article on timers was dead wrong. Are you comfortable with that?

                    When I use a timer, I get smooth animation. For example, a clock hand rotates from 3 to 6. When I use a loop, the clock hand just jumps 90 degrees. SU somehow sees that invalidate() is a waste of time in the latter case? Or the timer wastes so many clocks that SU has time to redraw, or ... I'm not comfortable. Forging ahead, but not comfortable.

                    Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

                    1 Reply Last reply Reply Quote 0
                    • thomthomT Offline
                      thomthom
                      last edited by

                      @martinrinehart said:

                      When I use a timer, I get smooth animation. For example, a clock hand rotates from 3 to 6. When I use a loop, the clock hand just jumps 90 degrees. SU somehow sees that invalidate() is a waste of time in the latter case? Or the timer wastes so many clocks that SU has time to redraw, or ... I'm not comfortable. Forging ahead, but not comfortable.

                      Not sure what it actually do, but it's clear that plain loops locks up the processing completely preventing UI to redraw. I'm guessing that timers will allow other things to process after each execution of the block, while loops keep it's control.

                      Thomas Thomassen — SketchUp Monkey & Coding addict
                      List of my plugins and link to the CookieWare fund

                      1 Reply Last reply Reply Quote 0
                      • Chris FullmerC Offline
                        Chris Fullmer
                        last edited by

                        I think animation in SU, however it is achieved, is susceptible to skipping if the model is large, or vast amounts of data are being animated. Try it in a DC. DC's animate objects and you can put them on a timer. The more complex the object being animated is, the bumpier the live animation is.

                        But if it could be exported to a video, then it wouldn't matter so much.

                        Lately you've been tan, suspicious for the winter.
                        All my Plugins I've written

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

                        Advertisement