|
 |
Hi,
to get smooth transitions in animations i thought about writing a macro that
changes values depending on the time in three ranges. However, I can't get a
switch statement in a macro running.
How can i let a part of code run as a macro and then define a return value?
My macro code looks like that:
#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);
#switch(time)
#range(t1,t1+theta*(t2-t1))//soft transition at beginning
V1-a*(time-t1)*(time-t1)
#break
#range(t1+theta*(t2-t1)+0.001,t2-theta*(t2-t1))//linear center range
V1-a*theta*theta*(t2-t1)*(t2-t1)-b*(time-t1-theta*(t2-t1))
#break
#range(t2-theta*(t2-t1)+0.001,t2)//soft transition at end
V2+a*(t2-time)*(t2-time)
#break
#end
#end
Any help would really be appreciated
Post a reply to this message
|
 |