POV-Ray : Newsgroups : povray.animations : Animation macros : Re: Animation macros Server Time
16 Apr 2024 19:57:15 EDT (-0400)
  Re: Animation macros  
From: Cousin Ricky
Date: 8 Apr 2022 09:50:00
Message: <web.62503bfd52a008d560e0cc3d949c357d@news.povray.org>
"Shadowbeast007" <nomail@nomail> wrote:
> How can i let a part of code run as a macro and then define a return value?

When in doubt, wrap the macro in parentheses.  See if this works:

#macro Soft_Transition(time,t1,t2,V1,V2,theta)
    #local a=(V2-V1)/(2*(t2-t1)*(t2-t1)*(theta-theta*theta));
    #local b=2*a*theta*(t2-t1);
        #range(t1,t1+theta*(t2-t1))//soft transition at beginning
        #range(t1+theta*(t2-t1)+0.001,t2-theta*(t2-t1))//linear center range
        #range(t2-theta*(t2-t1)+0.001,t2)//soft transition at end

P.S.  The word 'time' shows up in a different color in my editor, which means
that someone, somewhere, used 'time' as a keyword in a well-known unofficial
patch.  I would change it to 'Time' in case the POV development team decides to
make it official.  It is recommended that all identifiers contain at least one
capital letter.

Post a reply to this message

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