POV-Ray : Newsgroups : povray.general : moving things around : Re: moving things around Server Time
2 May 2024 02:43:01 EDT (-0400)
  Re: moving things around  
From: dick balaska
Date: 24 May 2017 15:16:19
Message: <5925dc03$1@news.povray.org>
Am 2017-05-24 05:51, also sprach Richard S:
> Hi All
>   I’m trying to move an object between 0 and 100 in different ways.
> First I want to move the variable mover form 50 to 0 in between clock values of
> 0 and 5.
> Then as the clock values increase from 5 to 10 I want mover to go from 0 to 50.
> Then as the clock values increase from 10 to 15 I want mover to go from 50 to
> 100.
> Then as the clock values increase from 15 to 20 I want mover to go from 100 to
> 50.
> 
> I have found the section
> 3.2.1.2 Internal Animation Loop
> And the bit…
>   For new scenes, we recommend you do not change the Initial_Clock or Final_Clock
> from their default 0.0 to 1.0 values. If you want the clock to vary over a
> different range than the default 0.0 to 1.0, we recommend you handle this inside
> your scene file as follows...
> #declare Start    = 25.0;
> #declare End      = 75.0;
> #declare My_Clock = Start+(End-Start)*clock;
> Then use My_Clock in the scene description. This keeps the critical values 25.0
> and 75.0 in your .pov file.
> I rename most of these so as not to interfere with pov internal values.
> 
> Here is what I have so far…
> 
> //----start code segment----
> #switch(MyClock)
>    #range(0,5)//centre to full left
>      #local MinClock= 0;
>      #local MaxClock= 5;
>      #local MinMove = 50;
>      #local MaxMove = 0;
>    #break
>    #range(5,10)//full left to center
>      #local MinClock= 5;
>      #local MaxClock= 10;
>      #local MinMove = 0;
>      #local MaxMove = 50;
>    #break
>    #range(10,15)//center to right
>      #local MinClock= 10;
>      #local MaxClock= 15;
>      #local MinMove = 50;
>      #local MaxMove = 100;
>    #break
>    #range(15,20)//right to center
>      #local MinClock= 15;
>      #local MaxClock= 20;
>      #local MinMove = 100;
>      #local MaxMove = 50;
>    #break
>    #else
>      #error concat("MyClock=",str(MyClock,0,0),".\n")
> #end
> 
> #local Mover=
> (MinMove+(MaxMove-MinMove))*(MyClock/(MinClock+(MinClock-MaxClock)));;
> //----end code segment----
> 
#local Mover=
((MyClock-MinClock)/(MaxClock-MinClock)) * (MaxMove-MinMove) + MinMove;

clock becomes 0-1, times range, plus minimum.

-- 
dik


Post a reply to this message

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