POV-Ray : Newsgroups : povray.general : Dumb clock animation question : Re: Dumb clock animation question Server Time: 16 Jun 2019 08:03:18 GMT
 Re: Dumb clock animation question
 From: Alain Date: 17 Feb 2019 17:36:11
```Le 19-02-17 Ã  05:36, Mike Horvath a Ã©critÂ :
> This involves probably some very easy algebra.
>
> I want a cylinder to spin 360 degrees when the clock is between 0 and
> 0.6667. I want another object to spin when the clock is between 0.3333
> and 0.6667. Finally I want the camera to rotate 90 degrees when the
> clock is between 0.6667 and 1.
>
> How do I set this up? Thanks.
>
>
> Michael

Assuming that the clock goes from 0 to 1 :
To be added to the object of interest.

First case :
#if(clock <= 2/3) rotate x*360*3/2 #end
// *360 for a full rotation
// *3/2 adjust to the desired clock interval

Second case :
#if(clock > 1/3 & clock < 2/3) rotate y*(clock - 1/3)*720*3/2 #end
// *720 two full rotation, just because...

Third case :
#if(clock > 2/3) rotate z*(clock - 2/3)*90*3 #end

That should do it.

Alain
```