POV-Ray : Newsgroups : povray.binaries.scene-files : Animated Transitions Server Time
1 Sep 2024 12:23:07 EDT (-0400)
  Animated Transitions (Message 1 to 1 of 1)  
From: Afishionado
Subject: Animated Transitions
Date: 4 Jan 2006 15:55:00
Message: <web.43bc33aa6678dd0695f922a70@news.povray.org>
Hello,

The attached .inc file includes some macros to drive animation. No more #if
statements in the scene file! :-)

The macros are called with Start=[clock value at which to begin moving]
End=[clock value to end moving] and Current=[current clock value].

ConstantTransition returns zero before the start time is reached, then the
value steadily increases to one, and returns one from then on.
SmoothTransition is the same, only the resulting effect slowly gains
momentum, then coasts to a stop at Current=End. It's a much more organic
motion, which I particularly like for moving the camera around. :-)

In general, to move something around, you'll want to do something like this:

#declare foo = SmoothTransition(StartTime, EndTime, clock);
sphere {
  <x, y, z>, size
  translate <translateX * foo, translateY * foo, translateZ * foo>
}

where <translateX, translateY, translateZ> is a vector from the starting
location to the ending location. The object can move several times in the
same scene; just add more translate statements (or rotate, or scale
statements, whatever suits your fancy).

RepeatingConstantTransition(Period, Current) moves from one to zero every
Period clock ticks. Eventually I'll get around to implementing a
RepeatingSmoothTransition(), probably using a sine curve.

hand.pov includes a really sucky example of the transition.inc in action
(the hand demo from the Povray tutorial is animated to open and close). If
someone bugs me enough, I'll create some better demos.

William


Post a reply to this message


Attachments:
Download 'transition.zip' (3 KB)

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