POV-Ray : Newsgroups : povray.newusers : Rotation then Translation inside an animation : Re: Rotation then Translation inside an animation Server Time
14 May 2024 07:59:31 EDT (-0400)
  Re: Rotation then Translation inside an animation  
From: Romain
Date: 1 Apr 2014 09:45:00
Message: <web.533ac1f4e4fdc502281b7210@news.povray.org>
scott <sco### [at] scottcom> wrote:
> 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?

Thanks you for your very quick answer.

I'd like to have a rotation in a fixed amount of time. But I'm not sure how to
do this without the fps.
Is it possible?

For now, I did something like that:
in .pov:
#declare MyClock=Start + (End-Start)*clock;

#if (MyClock < 2.5)
 rotate< 0, clock*360, 0 >
#else
 #declare previousClock = 2.5 * fps / final_frame;
 rotate < 0, previousClock*360, 0 >
 translate < clock*5, 0, 0 >
#end

in .ini:
Initial_Frame=1
Final_Frame=150
Initial_Clock=0
Final_Clock=1

Declare=fps=30
Declare=Start=0;
Declare=End=5;


This script works but I don't know if it's the best solution.


Post a reply to this message

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