POV-Ray : Newsgroups : povray.newusers : Rotation then Translation inside an animation : Re: Rotation then Translation inside an animation Server Time
14 May 2024 00:51:51 EDT (-0400)
  Re: Rotation then Translation inside an animation  
From: scott
Date: 1 Apr 2014 06:26:45
Message: <533a9465$1@news.povray.org>
On 01/04/2014 10:15, Romain wrote:
> Hello everyone,
>
> I started to use POV-Ray to create some mesh animation. I'd like to make an
> animation like this:
>   - During the first 15 frames, make a rotation on Y-axis.
>   - During the last 15 frames, make a translation on X-axis.
>
> I did something like this:
>
> mesh {
>   .... //My triangles
>
> #if (frame_number < 15)
>     rotate < 0, clock*360, 0 >
> #else
>     translate < clock*5, 0, 0 >
> #end
> }
>
> The problem with this, is that I don't save the state of the rotation so my
> translation is done on the wrong state.
>
> I tried to declare some variables (in .ini or .pov) but, like I though, their
> values are resetting for each frames.
>
> Can we save the previous transformation applied on one object?

If I understand correctly what you want to do, then you can just add an 
additional rotate line into the #else block to do the same rotation as 
in frame 14:

  #if (frame_number < 15)
      rotate < 0, clock*360, 0 >
  #else
      rotate <0,clockAtFrame14*360,0>
      translate < clock*5, 0, 0 >
  #end

BTW, is it wise to mix frame_number and clock? I would stick to using 
just one or the other, as at some point you might want to change the 
frames per second the animation is rendered at. Do you really want the 
rotation to last 15 frames regardless of the frame rate, or a fixed 
amount of time?


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.