Would you, dear all, suggest me best practices to get constant animation speed not depending on computer’s real speed? Frames may be skipped.
Would you, dear all, suggest me best practices to get constant animation speed not
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are two types of animation – frame based and time based and the names suggest the obvious.
What you are looking for is time-based where you call the display() function (the function which draws frames) is called continuously. Within the display function you set a global variable or a static variable(depends on language) to store the TIME(preferably in micro or milliseconds) when the previous occurrence to this call was made. We compare the current time and the saved time to find difference in time, dt, and the function must draw based on dt(time elapsed).