Robun
Robun

Reputation: 61

How to calculate time taken by perspective camera going from one to another position?

I have a perspective camera which is travelling across a spline curve.So I want to get the traveled time of the camera. total distance is calculated.what next?

Upvotes: 0

Views: 49

Answers (2)

gaitat
gaitat

Reputation: 12632

To get the time at the beginning of your animation use:

var startTime = performance.now();

when your animation is finished use:

var endTime = performance.now();

and then

speed = distance / (endTime-startTime);

Upvotes: 1

bjorke
bjorke

Reputation: 3305

speed is distance/time, so if you know the distance and the desired speed, then time is distance/speed. Seems straightforward, but your question IS rather vague.

Upvotes: 0

Related Questions