ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Highlighting Shaper layer using sampleImage

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Wyatt Woolley
Highlighting Shaper layer using sampleImage
on May 5, 2020 at 4:31:40 am

Attempting to Create a Gauge Risk Chart, like those fire danger signs. High risk-Red, Moderate risk-Orange, Low risk-Yellow, No Risk-Green.

Attempting to use sampleImage to highlight the colors, but whenever the null is tied to anything, like the needle pointer in the middle, it stops working.

I tried to load the project, only 285 KB but Creative Cloud won't do it.

p = thisComp.layer("Null 2").transform.position
s = thisLayer

a = s.sampleImage(p,[.1,.1])[3]
linear(a,0,1,0,100)


Return to posts index

Robert Mueller
Re: Highlighting Shaper layer using sampleImage
on May 5, 2020 at 10:36:24 am

Hi,
if you parent your null to another layer, the position of the null will always be relevant to the parent layer. You need to use "toComp" (or "toWorld" for 3d layers) to get the global position of your null.

p = thisComp.layer("Null 1").toComp(anchorPoint);
s = thisLayer;

a = s.sampleImage(p,[.1,.1])[3];
linear(a,0,1,0,100)


Return to posts index

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