if (do_name() != 'Home') : ?>
endif ?>
Posted by fdb on May 28, 2008
Kind regards,
Frederik
include("util/comment.php"); ?>
Use the time() library to detect the current time, and work with that. Here's an example:
from time import time size(500, 100) # The framerate and the speed of the animation are independent. # Lower the framerate and the animation will finish at the same time, # but it will look choppier. speed(60) # When starting the script, keep the current time start_time = time() # The duration of the script, in seconds duration = 5.0 # The time when the script would end. end_time = start_time + duration def draw(): # Get the current time current_time = time() # If the current time is smaller than the end time, the # animation is still running. if current_time < end_time: # The current position is a value between 0.0 # (at the start of the animation) and 1.0 (at the end) current_pos = (current_time - start_time) / duration # Draw a rectangle whose WIDTH is relative to the current # position in the animation, so if the animation is halfway, # the width of the rectangle will be half of the canvas' WIDTH. rect(0, 0, WIDTH*current_pos, HEIGHT) else: # If the animation is done, draw the text "Done" text("Done!", 50, 50)Processor speed, of course, makes a big difference in animation speed. If you're using timed animations like in the example, you could set the framerate to a sufficiently large number (60) will do, and the computer will do its best to match that speed.
Kind regards,
Frederik
Frame Rate vs. Speed
Posted by toby_ on May 27, 2008How is it possible to get constant Motion Speed.
Because the factor speed change also the complete
speed of the Scene.
Its not only slowing down the Framerate.
I would love to have a fixed timing of my Animations.
Like a square moves 1 sec. with 15 and also with 30 frames per sec.
Also whats about different Systems?
I am sure that the Mac Pro will run my MacBook away.
I can imagine to do a work around - like a system speed test
at beginning and then work with measured factor.
But wouldnt be nice to have that fixed in the system?
Fantastic thing you start!
Its my choice to do some Art Animations.