POV-Ray : Newsgroups : povray.general : Dumb clock animation question : Re: Dumb clock animation question Server Time
18 Apr 2024 19:30:30 EDT (-0400)
  Re: Dumb clock animation question  
From: Tor Olav Kristensen
Date: 17 Feb 2019 07:30:00
Message: <web.5c69532030cdf98241e3d39f0@news.povray.org>
Mike Horvath <mik### [at] gmailcom> wrote:
> On 2/17/2019 5:36 AM, Mike Horvath wrote:
> > This involves probably some very easy algebra.
> >
> > I want a cylinder to spin 360 degrees when the clock is between 0 and
> > 0.6667. I want another object to spin when the clock is between 0.3333
> > and 0.6667. Finally I want the camera to rotate 90 degrees when the
> > clock is between 0.6667 and 1.
> >
> > How do I set this up? Thanks.
> >
> >
> > Michael
>
>
> PS - I was thinking of maybe a macro that takes a start time and an end
> time, and outputs a value between 0 and 1?

#macro MacroName(StartTime, EndTime)

    #local R = (clock - StartTime)/(EndTime - StartTime);
    #local S = min(max(0, R), 1);

    S

#end // macro MacroName


object {
    YourCylinder
    rotate MacroName(0/3, 2/3)*360*y
}

object {
    YourOtherObject
    rotate MacroName(1/3, 2/3)*SomeAngle*y
}

camera {
    YourCamera
    rotate MacroName(2/3, 3/3)*90*y
}

--
Tor Olav
http://subcube.com
https://github.com/t-o-k/


Post a reply to this message

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