POV-Ray : Newsgroups : povray.general : Dumb clock animation question : Re: Dumb clock animation question Server Time
19 Apr 2024 06:33:40 EDT (-0400)
  Re: Dumb clock animation question  
From: JimT
Date: 19 Feb 2019 09:25:01
Message: <web.5c6c109030cdf982be7517870@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 19.02.2019 um 06:18 schrieb Mike Horvath:
> > On 2/17/2019 7:27 AM, Tor Olav Kristensen wrote:
> >> #macro MacroName(StartTime, EndTime)
> >>
> >>      #local R = (clock - StartTime)/(EndTime - StartTime);
> >>      #local S = min(max(0, R), 1);
> >>
> >>      S
> >>
> >> #end // macro MacroName
> >
> > What do you think would be a good way to gradually speed up and then
> > slow down the motions using this macro? I'm thinking it would require a
> > sine wave (or some other bell curve), but am not sure how to apply it.
>
> A spline might help with this.

Using a spline would de-linearise the time variable, which isn't the idea. The
simplest way is to just use a cubic:

#macro Spline_Param(StartTime,EndTime)
//
#local LinParam    = (clock - StartTime)/(EndTime - StartTime);
#local LinParam    = min(max(0,LinParam),1);
//
#local SplineParam =   2*LinParam*LinParam*(3/2 - LinParam);
//
SplineParam
//
#end // Spline_Param

but this doesn't have any adjustment. If you are interested in a constant
acceleration, followed by constant speed, followed by constant deceleration,
respond and I'll do it.


Post a reply to this message

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