ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Control layer size-changing expression not working correctly

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Patrick Perkins
Control layer size-changing expression not working correctly
on Nov 6, 2017 at 8:01:45 pm

Hello, I'm having some trouble and I'm sure it's because I'm making some bonehead mistake.

I have a grid of shapes, and I'd like to control their size using a control layer. I've done this before in other files. I want them to be basically at 0% scale when the control layer below them is white, and 100% scale when the control layer behind them is black. I'm kinda basing it off this tutorial video:





Here's a screenshot of the grid of x's, with the control layer (Pottery.psd) behind it.


Deeply confused, since this expression has worked perfectly in other files (at least when attached to "rotation" instead of scale), I would love to get someone else's take on it. I'm not getting error messages, the x's just aren't responding in scale to the control layer at all. I don't know what I'm doing wrong!

The expression I'm adding to the "Scale" attribute on the x's is below.

sourceLayer = thisComp.layer("Pottery.psd");
sampleSize = [1,1];
samplePoint = transform.position;
color = sourceLayer.sampleImage(sampleSize,samplePoint);
x = color[0]*100;
[x,x]


Return to posts index

Dan Ebberts
Re: Control layer size-changing expression not working correctly
on Nov 6, 2017 at 8:24:54 pm

I think sampleSize and samplePoint should be swapped in sampleImage().

Dan



Return to posts index

Patrick Perkins
Re: Control layer size-changing expression not working correctly
on Nov 6, 2017 at 8:59:52 pm

Dan, nothing happened when I tried that!


Return to posts index


Dan Ebberts
Re: Control layer size-changing expression not working correctly
on Nov 6, 2017 at 9:43:03 pm

Is anything parented? Is your sample layer not comp-sized? Is it scaled? If so, this might help:

sourceLayer = thisComp.layer("Pottery.psd");
sampleSize = [1,1];
samplePoint = sourceLayer.fromComp(toComp(anchorPoint));
color = sourceLayer.sampleImage(samplePoint,sampleSize);
x = color[0]*100;
[x,x]


Dan



Return to posts index

Patrick Perkins
Re: Control layer size-changing expression not working correctly
on Nov 6, 2017 at 11:22:32 pm

That worked! My control layer WASN'T comp-sized and WAS scaled, I didn't know that would affect that. Thank you, Dan!! This has been annoying me for days, I appreciate your help!


Return to posts index

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