POV-Ray : Newsgroups : povray.animations : Animation block...acceleration on the x axis. : Re: Animation block...acceleration on the x axis. Server Time
27 Apr 2024 07:26:57 EDT (-0400)
  Re: Animation block...acceleration on the x axis.  
From: Chris B
Date: 24 Feb 2009 11:33:33
Message: <49a4215d$1@news.povray.org>
"RC" <nomail@nomail> wrote in message 
news:web.49a417c221b0f15ae1acfc5e0@news.povray.org...
> Warp <war### [at] tagpovrayorg> wrote:
>>   #declare ObjectX = ObjectX + AcceleratingSpeed(num - 3);
>
> Ok, so I'm trying this out, but I find I'm still hitting the same 
> fundamental
> block. "In other words, if clock*60 <= 3, the speed is linear, but for 
> larger
>> values it's accelerating." Not quite. I want the speed to increase lets 
>> say every three frames.
> So frames 1->3 = t 4->6 = t+1 7->9 = t+2 etc. At what point in the code 
> would I
> include a variable that changes the "function of t" value every three 
> frames?
> My apologies, I'm not a 3D animator nor am I much of a programmer. ;(
>

Ah. So you do want a stepwise change. You might like to try something like 
the following ( I still think you'll find it easier using the frame_number 
variable rather than the clock variable):

#declare ObjectX = frame_number*0.1+div(frame_number+1,3)*0.9;
#debug concat("ObjectX: ",str(ObjectX,3,3),"\n")

This creates a displacement that moves a small amount (0.1 units) each frame 
and adds a larger amount (0.9 units) every 3rd frame. The div function is 
just an integer divide. I added 1 to frame_number because it runs from 0 to 
59, so frames 2, 5, 8, etc. get the stepwise change applied.

Regards
Chris B.


Post a reply to this message

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