POV-Ray : Newsgroups : povray.animations : Animation block, unblocked...almost. Server Time
16 Apr 2024 16:29:23 EDT (-0400)
  Animation block, unblocked...almost. (Message 1 to 4 of 4)  
From: RC
Subject: Animation block, unblocked...almost.
Date: 3 Mar 2009 16:45:00
Message: <web.49ada3fba85553de1acfc5e0@news.povray.org>
Hi Guys,

Thought you might be interested in how I solved that acceleration issue I
posted. I wanted an object to move at a constant and increasing rate, so this
is what I came up with.

#fopen fileSpeed "speed.txt" read
#read (fileSpeed, speedValue)
#fclose fileSpeed
#debug concat("speedValue: ", str(speedValue,3,3), "\n")
#local delta = floor(frame_number / 10)*0.01; //Increase every 10 frames
#local Speed = speedValue + 0.1 + delta;  // Where 'speedValue' is read in from
the file
sphere { <0, 0, 0>, 1
    pigment { Blue }
    translate -0.5*x
  }
  translate <-5.5.0.0>
  translate <Speed,0,0>
}
#fopen filespeed "speed.txt" write
#write (filespeed, Speed)
#fclose filespeed

With this particular example the speed will increase every 10 frames
consistently. Thanks to jfilip for the help.

Now on the question #2, I have to find a way so that when the object gets to the
edge of the image, it will turn and go the other way, and once it hits the other
edge of the image turn again and go forward. Any suggestions? I tried a loop
that would write a negative Speed to my text file, but I end up with an
animation that just jumps from one end of the image to the other every frame.
;(


Post a reply to this message

From: clipka
Subject: Re: Animation block, unblocked...almost.
Date: 3 Mar 2009 17:40:01
Message: <web.49adb1712d0a94b54b67233c0@news.povray.org>
"RC" <nomail@nomail> wrote:
> Now on the question #2, I have to find a way so that when the object gets to the
> edge of the image, it will turn and go the other way, and once it hits the other
> edge of the image turn again and go forward. Any suggestions? I tried a loop
> that would write a negative Speed to my text file, but I end up with an
> animation that just jumps from one end of the image to the other every frame.
> ;(

Maybe you want to inverse the acceleration once you reach the center of the
screen.

Or do you want it to just bounce back and forth then at a constant speed (but
changing direction)?


Post a reply to this message

From: RC
Subject: Re: Animation block, unblocked...almost.
Date: 3 Mar 2009 17:50:00
Message: <web.49adb3672d0a94b5e1acfc5e0@news.povray.org>
Ya, the idea is that it could bounce back and forth, and I could render any
number of frames. I guess I'm going to have to find a way to change the Speed
to Speed = speedValue - 0.1 - delta;

"clipka" <nomail@nomail> wrote:
> "RC" <nomail@nomail> wrote:
> > Now on the question #2, I have to find a way so that when the object gets to the
> > edge of the image, it will turn and go the other way, and once it hits the other
> > edge of the image turn again and go forward. Any suggestions? I tried a loop
> > that would write a negative Speed to my text file, but I end up with an
> > animation that just jumps from one end of the image to the other every frame.
> > ;(
>
> Maybe you want to inverse the acceleration once you reach the center of the
> screen.
>
> Or do you want it to just bounce back and forth then at a constant speed (but
> changing direction)?


Post a reply to this message

From: clipka
Subject: Re: Animation block, unblocked...almost.
Date: 3 Mar 2009 17:55:00
Message: <web.49adb4e72d0a94b54b67233c0@news.povray.org>
"RC" <nomail@nomail> wrote:
> Ya, the idea is that it could bounce back and forth, and I could render any
> number of frames. I guess I'm going to have to find a way to change the Speed
> to Speed = speedValue - 0.1 - delta;

Ah, that's an easy one:

#declare Speed = speedValue + sgn(speedValue)*(0.1 + delta);


Post a reply to this message

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