FORUMS: list search recent posts

# keep scale positive

FAQ   •   VIEW ALL
 keep scale positive on Oct 8, 2012 at 2:36:11 pm

hi!
I am using this follow the leader with delay code
``` e=thisComp.layer("lead").transform.scale; d=thisComp.layer("lead").effect("delay")("Slider")*thisComp.frameDuration*(index - 1); e.valueAtTime(time - d); ```

How could I prevent the scale (of the follower layer) from going negative so when the scale is negative make it 0?

thanks!

Pete.

 Re: keep scale positiveon Oct 8, 2012 at 3:15:19 pm

Try changing the last line to this:

s = e.valueAtTime(time - d);
[Math.max(s[0],0),Math.max(s[1],0)]

Dan

 Re: keep scale positiveon Oct 8, 2012 at 3:39:30 pm

great!! thanks!

Now I`m adding +value
``` s = e.valueAtTime(time - d); sm=[Math.max(s[0],0),Math.max(s[1],0)]; sm+value ```

so I can rescale down some followers... but no it doesn`t seem to work
(Now I have some follower layer with scale [-30,-30] when Lead is [0,0], so when lead is [100,100] Follower is [70,70], ans similar with other followers.. but as I added the "+value", theMath.max thing seems not to work (when lead 0, follower keep being on -30)

 Re: keep scale positiveon Oct 8, 2012 at 3:55:35 pm

I'm confused. I don't see how the follower could ever have a negative scale unless the leader does. What is the relationship between leader and follower that you're trying to establish? I'm guessing that you might need to be multiplying instead of adding but I'm not sure.

Dan

 Re: keep scale positiveon Oct 8, 2012 at 4:24:48 pm

yes! this is image is a portion of the thing (is a big big graphic full of branches like these. Note the leader. Is scaled 100%.

(The leader has a bounce expression there).

Look at the followers shorter than the leader...
Using the first expression, if followers have scale= 0, they will follow leader`s scale exactly, right? ,but I wanted the followers to have smaller scales than 100% when the Leader is 100%.
So I added the + value and added negative start on their scale values so when they reach the leader 100%, they are 70%, 80%, ecc. (making them having a -30 as value instead of 0)

Definetely a bad approach I guess. It worked until I wanted to go deeper...

 Re: keep scale positiveon Oct 8, 2012 at 5:56:58 pm

More like this, probably:

s = e.valueAtTime(time - d);
[value[0]*s[0],value[1]*s[1]]/100;

Dan