English subtitles

← Step Size - Interactive 3D Graphics

Get Embed Code
2 Languages

Showing Revision 2 created 05/25/2016 by Udacity Robot.

  1. This animation works, but it has a potential problem. We're basing the
  2. animation entirely off of the number of frames rendered. Each frame rotated the
  3. bird half a degree. However, what if your machine runs this demo at 60 frames
  4. per second, and mine runs it at 30 frames per second? This means your drinking
  5. bird is rotating 30 degrees a second. Mine is rotating only 15. This might be
  6. fine for drinking birds but say we had a facial animation play and it was
  7. supposed to be synced with the sound file of the character's voice. This would
  8. be a disaster. What we really want to do is use the real world time to know how
  9. far to rotate before rendering the next frame. For example, say our target rate
  10. is 60 frames per second, meaning that the bird should rotate 30 degrees per
  11. second. We'd like to know how much time has gone by since the last frame. In a
  12. moment, I'll show you how this is done. As you can see from demo, once we
  13. switch to the timed version of the code, the rate of the drinking birds motion
  14. is unaffected by the frames per second shown. Give this demo a try yourself.