POV-Ray : Newsgroups : povray.animations : Animation block...acceleration on the x axis. : Re: Animation block...acceleration on the x axis. Server Time
8 May 2024 12:31:16 EDT (-0400)
  Re: Animation block...acceleration on the x axis.  
From: RC
Date: 24 Feb 2009 17:50:00
Message: <web.49a4793d21b0f15ae1acfc5e0@news.povray.org>
"Chris B" <nom### [at] nomailcom> wrote:
> "RC" <nomail@nomail> wrote in message
> news:web.49a4526f21b0f15ae1acfc5e0@news.povray.org...
> > "Chris B" <nom### [at] nomailcom> wrote:
> >>
> >> Maybe it would help if you could list the values you'd like to generate
> >> for
> >> the x-displacement for say the first 12 frames.
> >
> > 1-1fps
> > 2-1fps
> > 3-1fps
> > 4-2fps
> > 5-2fps
> > 6-2fps
> > 7-3fps
> > 8-3fps
> > 9-3fps
> > 10-4fps
> > 11-4fps
> > 12-4fps etc.
> >
>
> I'm still not quite sure I'm getting it, but I'll take another stab at it.
>
> What you've listed is simply 'div(frame_number,3)+1', so if that's what you
> need then it's easy, but I can't see how that fits with your descriptions
> and I can't see what fps means in this context. In my experience fps
> normally means frames per second, but I don't see how that would be relevant
> here.
>
> Is this the speed? ie the distance travelled per frame? If so you'd get a
> displacement from the initial position of:
>
> Frame 0 - 0 units in 'x'
> Frame 1 - 1 unit in 'x'
> Frame 2 - 2 units in 'x'
> Frame 3 - 4 units in 'x'
> Frame 4 - 6 units in 'x'
> Frame 5 - 8 units in 'x'
> Frame 6 - 11 units in 'x'
> Frame 7 - 14 units in 'x'
> Frame 8 - 17 units in 'x'
> Frame 9 - 21 units in 'x'
> Frame 10 - 25 units in 'x'
> Frame 11 - 29 units in 'x'
> etc?
>
> If that's what you need then the following code should give you this:
>
>
> #declare ObjectXDisplacement = 0;
> #declare Speed = 1;
> #local I = 1;
> #while (I<=frame_number)
>   #if (mod(I,3)=0) #declare Speed = Speed+1; #end
>   #declare ObjectXDisplacement = ObjectXDisplacement+Speed;
>   #local I = I+1;
> #end
> #debug concat("Frame Number: ",str(frame_number,3,0),"  ObjectXDisplacement:
> ",str(ObjectXDisplacement,3,0),"\n")
>
>
> Here's hoping that's what you want :-)
>
> Regards,
> Chris B.

Ah-ha! Works! That mod function is exactly what I was looking for. Thank you for
your patience. RC


Post a reply to this message

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