FORUMS: list search recent posts

Controlling color and scale with a Null's position?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Simon Terrey
Controlling color and scale with a Null's position?
on Sep 21, 2015 at 3:55:09 pm

Hi everyone!

I'm making a timeline where when I move a Null, data panels attached to the timeline scale in size.
I've managed to find a script to do this (which I assign to the scale parameter of the data panels):

So when I move the Null (called Scale_Control) towards the panels the panels grow! Great. But what I want to do as well is change their color as they grow in size and go back to their original color when the Null has passed-on. I've looked everywhere and know I need to convert the colors to HLS with an array (I think) and use a similar approach to the scale expression above but I can't get it to work.
Hope you can help?

mouse_layer = thisComp.layer("Scale_Control");//Mouse layer
beginScale = 75;//Scale begins at this
endScale = 100;//Scale ends at this
beginDistance = 200;//Distance to begin magnifying in pixels
endDistance = 0;//Distance to end magnifying in pixels
//--Don't modify below here
dis = length(this.position, mouse_layer.position);
val = ease(dis, beginDistance, endDistance, endScale, beginScale);
[val, val]


Return to posts index

Dan Ebberts
Re: Controlling color and scale with a Null's position?
on Sep 21, 2015 at 4:24:03 pm

You didn't mention exactly what you want the color to do.

Dan



Return to posts index

Simon Terrey
Re: Controlling color and scale with a Null's position?
on Sep 21, 2015 at 4:26:22 pm

Hi Dan,

I just wanted it to change from grey to orange as it scales-up, then go back to grey when it scales back-down again.


Return to posts index


Dan Ebberts
Re: Controlling color and scale with a Null's position?
on Sep 21, 2015 at 4:37:46 pm

If you applied a Fill effect you could use something like this on the Color parameter:


mouse_layer = thisComp.layer("Scale_Control");//Mouse layer
beginColor = [.5,.5,.5,1]; // grey
endColor = [1,.5,0,1]; // orange
beginDistance = 200;//Distance to begin magnifying in pixels
endDistance = 0;//Distance to end magnifying in pixels
//--Don't modify below here
dis = length(this.position, mouse_layer.position);
ease(dis, beginDistance, endDistance, endColor, beginColor);



Dan



Return to posts index

Simon Terrey
Re: Controlling color and scale with a Null's position?
on Sep 21, 2015 at 4:45:56 pm

Hi Dan,

Many thanks for getting back to me with this!

I've just tried it on the Fill layer (of my shape layer) and it returned with this:

Error at line 0 in property 'Color' of layer 15 ('DataPanel 11') in comp 'Timeline'.
Object of type Layer found where a Number, Array, or Property is needed.

This was the message that flagged-up when I tired other techniques earlier...


Return to posts index

Dan Ebberts
Re: Controlling color and scale with a Null's position?
on Sep 21, 2015 at 5:00:01 pm

I hadn't tried it on a shape layer (I was using a solid with the Fill effect), but it seems to work fine for me (with a shape layer, the anchor point will need to be at the center of the shape). The only way I can generate your error message is to leave out everything except the first line.

Dan



Return to posts index


Simon Terrey
Re: Controlling color and scale with a Null's position?
on Sep 21, 2015 at 5:17:21 pm

Hi Dan,

I've just tried uploading a small comp aep file with my controller Null and a shape layer (and a new solid with fill) to show you what i'm doing.
I tried your expression on a new Solid with a fill and it flagged the same error message!
Are expressions different between CC versions by any chance?

Simon


Return to posts index

Simon Terrey
Re: Controlling color and scale with a Null's position?
on Sep 21, 2015 at 5:24:46 pm

Hold the fort!

I've got it working. When I paste the expression in, it goes in on one line.
As soon as I added returns at the end of each line to match-up with the original the error message went away and it's all good!

Dan the Man!

Thank you very much.

Simon


Return to posts index

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