Graphics

 View Only
  • 1.  Running second hand with ClockTimer Widget

    Posted 06-18-2012 15:21
    I am looking for a way to run a second hand(resized cube) on a timer with the ClockTimer Widget in Timer mode. How would I make the hand rotate every second? Would I put the script in OnRender? I don't want a smooth motion. I want the "tick". I'm not using continuous motion because of the smooth thing and I need it to stop at 77 seconds. Thanks in advance for any ideas.


  • 2.  RE: Running second hand with ClockTimer Widget

    Posted 06-18-2012 16:50
    Never mind. I went with this method instead:

    dim hand as xpBaseObject

    dim clip as xpAnimController

    dim i as integer

    Self.GetAnimControllerByName("AnimController1", clip)

    Self.GetObjectByName("Cube1",hand)

    for i=0 to 77

    clip.SetKeyFrameRotation(hand,i*59.94,0,0,i*4.675,5)

    next

    That sets a Z rotation keyframe every second and divides the 360 degree rotation by 77. The 5 at the end is to make the keyframes into Hold keyframes.

    If there is a better way, please let me know.

    #XPression


  • 3.  RE: Running second hand with ClockTimer Widget

    Posted 06-19-2012 03:14
    I tried a quick sample using an OnRender script and linking it to a widget set to 77 seconds and counting down.

    https://rossvideo.centraldesktop.com/p/eAAAAAAAAQA4AAAAADBD8hg

    You should be able to tweak this as required..

    Also, instead of OnRender, you could put the script in the OnSetText event of a text object which you would then link to the widget (this would be more efficient than running the script in OnRender, but it's such a simple script it probably wouldn't make much difference).

    #XPression