FORUMS: list search recent posts

Dynamic shapes with a dynamic advance or delay

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Nicolas Pageaud
Dynamic shapes with a dynamic advance or delay
on Apr 13, 2020 at 12:00:30 pm
Last Edited By Nicolas Pageaud on Apr 14, 2020 at 8:55:28 am

Hi I'm pretty new to script, but I've learned a lot the past few weeks on this forum.

I've created a dynamic shape with a dynamic advance or delay based on where the shape is from the source.

It works well, except for one diagonal where it follows the source, but not in a good way. Here it is :



I think it's mainly a mathemical issue, but I can't figure out how to resolve it.
here's the code :

//the Source position
var curTargetPos = thisComp.layer("source").transform.position;
//the Source position in the future and the past
var future = curTargetPos.valueAtTime(time+.15);
var past = curTargetPos.valueAtTime(time-.15);

//the Dynamic condition for X position
if(future[0]-past[0]>0) {
var T0 = -.15;
} else if(future[0]-past[0]<0) {
var T0 = +.15;
} else {
var T0 = 0;
}

//the Dynamic condition Y position
if(future[1]-past[1]<0) {
var T1 = -.15;
} else if(future[1]-past[1]>0) {
var T1 = +.15;
} else {
var T1 = 0;
}

//applying the advance or delay;
[curTargetPos.valueAtTime(time + T0)[0],curTargetPos.valueAtTime(time + T1)[1]]


Thank you very much. I tried so many things, but hope you can help me.


Return to posts index

Nicolas Pageaud
Re: Dynamic shapes with a dynamic advance or delay
on Apr 17, 2020 at 8:58:02 am

maybe I should move this post to "after effects expression" ? Is it possible ?


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]