|
|
Mike Horvath <mik### [at] gmailcom> wrote:
> 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.
If you want to use a simple trigonometric function then I recommend using a
cosine wave, like this:
#macro MacroName(StartTime, EndTime)
#local R = (clock - StartTime)/(EndTime - StartTime);
#local S = min(max(0, R), 1)*pi;
#local T = (1 - cos(S))/2;
T
#end // macro MacroName
Now S will vary between 0 and +pi. cos(S) will vary between +1 and -1. And T
will vary between 0 and +1.
https://upload.wikimedia.org/wikipedia/commons/d/d2/Sine_and_Cosine.svg
--
Tor Olav
http://subcube.com
https://github.com/t-o-k/
Post a reply to this message
|
|