POV-Ray : Newsgroups : povray.general : Dumb clock animation question Server Time
31 Oct 2024 21:27:45 EDT (-0400)
  Dumb clock animation question (Message 1 to 10 of 15)  
Goto Latest 10 Messages Next 5 Messages >>>
From: Mike Horvath
Subject: Dumb clock animation question
Date: 17 Feb 2019 05:36:39
Message: <5c693937$1@news.povray.org>
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


Post a reply to this message

From: Mike Horvath
Subject: Re: Dumb clock animation question
Date: 17 Feb 2019 06:09:29
Message: <5c6940e9$1@news.povray.org>
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?


Michael


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Dumb clock animation question
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

From: Alain
Subject: Re: Dumb clock animation question
Date: 17 Feb 2019 12:36:11
Message: <5c699b8b@news.povray.org>
Le 19-02-17 à 05:36, Mike Horvath a écrit :
> 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

Assuming that the clock goes from 0 to 1 :
To be added to the object of interest.

First case :
#if(clock <= 2/3) rotate x*360*3/2 #end
// *360 for a full rotation
// *3/2 adjust to the desired clock interval

Second case :
#if(clock > 1/3 & clock < 2/3) rotate y*(clock - 1/3)*720*3/2 #end
// *720 two full rotation, just because...

Third case :
#if(clock > 2/3) rotate z*(clock - 2/3)*90*3 #end


That should do it.

Alain


Post a reply to this message

From: Mike Horvath
Subject: Re: Dumb clock animation question
Date: 18 Feb 2019 07:47:31
Message: <5c6aa963$1@news.povray.org>
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


Thank you! That's perfect.


Mike


Post a reply to this message

From: JimT
Subject: Re: Dumb clock animation question
Date: 18 Feb 2019 12:40:05
Message: <web.5c6aed9530cdf982c97227110@news.povray.org>
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
>
>
> Thank you! That's perfect.
>
>
> Mike

I hesitate to try to improve on a TOK solution, but in my animations, a very
early line will be

#declare MyTime = clock;

then I use MyTime wherever I would use clock. This lets me #declare MyTime =
0.6667, for example to go to a position in the animation to test a particular
stage without running the whole animations. You would pass MyTime to the #macro.
This may be obvious, but it is an improvement.


Post a reply to this message

From: Mike Horvath
Subject: Re: Dumb clock animation question
Date: 19 Feb 2019 00:15:33
Message: <5c6b90f5@news.povray.org>
On 2/18/2019 12:38 PM, JimT wrote:
> 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
>>
>>
>> Thank you! That's perfect.
>>
>>
>> Mike
> 
> I hesitate to try to improve on a TOK solution, but in my animations, a very
> early line will be
> 
> #declare MyTime = clock;
> 
> then I use MyTime wherever I would use clock. This lets me #declare MyTime =
> 0.6667, for example to go to a position in the animation to test a particular
> stage without running the whole animations. You would pass MyTime to the #macro.
> This may be obvious, but it is an improvement.
> 
> 


I'll keep that in mind, thanks! What I usually do is set the clock value 
using the +K switch if I need to. I get confused by all the INI settings 
sometimes too.


Mike


Post a reply to this message

From: Mike Horvath
Subject: Re: Dumb clock animation question
Date: 19 Feb 2019 00:18:05
Message: <5c6b918d$1@news.povray.org>
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.


Mike


Post a reply to this message

From: clipka
Subject: Re: Dumb clock animation question
Date: 19 Feb 2019 04:28:04
Message: <5c6bcc24$1@news.povray.org>
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.


Post a reply to this message

From: Bald Eagle
Subject: Re: Dumb clock animation question
Date: 19 Feb 2019 07:15:00
Message: <web.5c6bf27730cdf982765e06870@news.povray.org>
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.

insert

#declare S = sin(S*Tau);
or
#declare S = abs(sin(S*Tau));

before the line
S

However you're running it.


Post a reply to this message

Goto Latest 10 Messages Next 5 Messages >>>

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