2412 posts Small, but tough
  • Has referred 500+ members
  • Has sold $125,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+9 more
EFEKT_Studio says

So Felt, I have this prob…. sorry, I mean, guys I have this problem with expression.

Here is what I need. I need AE to read out certain pixels, for example 20×20 but only alpha value. (For example, precomposed vector logo). Expression would be on a certain layer’s opacity and basically it would be something like this:

if(most of the pixel’s readout from 20×20 pixel area alpha==1){ then this layer’s opacity is 100} else 0;

I was trying with sampleImage and from Dan Ebberts website, I found an expression which would be most similar, but I just cannot make it work the way I want:

target = thisComp.layer(“clouds”);

alpha = target.sampleImage(effect(“Lens Flare”)(“Flare Center”),[3.5, 3.5])[3];

linear(alpha, 0, 0.36, 80, 10)

Thanks in advance.

417 posts
  • Made it to the Authors' Hall of Fame
  • Has sold $10,000+ on Envato Market
  • Has referred 1+ members
  • Has been a beta tester for an Envato feature
+4 more
DOGmotion says
I’m not Felt, but…
target = thisComp.layer("target_comp"); //comp from where you want to get alpha
samplePos = thisComp.layer("Eyedropper").transform.position;
//"Eyedropper" - null object, pick up location from wich to sample
r = 20; //radius
alpha = target.sampleImage(samplePos, [r,r], true, time);
if(alpha[3] >= 0.5) x = 100
else x = 0;
//if alpha in that location is less then 50% x = 0
[x]
That is all :)
2412 posts Small, but tough
  • Has referred 500+ members
  • Has sold $125,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+9 more
EFEKT_Studio says

I’m not Felt, but…
target = thisComp.layer("target_comp"); //comp from where you want to get alpha
samplePos = thisComp.layer("Eyedropper").transform.position;
//"Eyedropper" - null object, pick up location from wich to sample
r = 20; //radius
alpha = target.sampleImage(samplePos, [r,r], true, time);
if(alpha[3] >= 0.5) x = 100
else x = 0;
//if alpha in that location is less then 50% x = 0
[x]
That is all :)

wow, it works!!!! Thank you so muuuuch! :)

417 posts
  • Made it to the Authors' Hall of Fame
  • Has sold $10,000+ on Envato Market
  • Has referred 1+ members
  • Has been a beta tester for an Envato feature
+4 more
DOGmotion says

No problem, man ;)

5256 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Helps us moderate the forums
  • Has been part of the Envato Community for over 5 years
+11 more
felt_tips Moderator says

Yeah…. what DOGmotion said. :)

77 posts Film Production
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Made it to the Authors' Hall of Fame
  • Had an item featured on Envato Market
+7 more
PHANTAZMA says

Hey Felts, is it allowed to perhaps create a forum section on expressions we use to give to other authors? Or is that a noon? For instance, to help other folks, post expressions on controls I have made, or expressions used to help others?

77 posts Film Production
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Made it to the Authors' Hall of Fame
  • Had an item featured on Envato Market
+7 more
PHANTAZMA says

Hey Felts, is it allowed to perhaps create a forum section on expressions we use to give to other authors? Or is that a noon? For instance, to help other folks, post expressions on controls I have made, or expressions used to help others?

I mean “No No”. Thanks spell check.

417 posts
  • Made it to the Authors' Hall of Fame
  • Has sold $10,000+ on Envato Market
  • Has referred 1+ members
  • Has been a beta tester for an Envato feature
+4 more
DOGmotion says

Hey Felts, is it allowed to perhaps create a forum section on expressions we use to give to other authors? Or is that a noon? For instance, to help other folks, post expressions on controls I have made, or expressions used to help others?
It sounds like an idea for a new project… :zipped:
77 posts Film Production
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Made it to the Authors' Hall of Fame
  • Had an item featured on Envato Market
+7 more
PHANTAZMA says

Just thinking usually if I am trying to figure out how to do a specific expression of course I search the web and usually find what I need. But perhaps create a resource of expressions that may help each other and save have to scour the internet.

621 posts
  • Had an item featured on Envato Market
  • Made it to the Authors' Hall of Fame
  • Contributed a free file of the month
  • Has sold $40,000+ on Envato Market
+6 more
addeystock says

Hey Felts, is it allowed to perhaps create a forum section on expressions we use to give to other authors? Or is that a noon? For instance, to help other folks, post expressions on controls I have made, or expressions used to help others?

+1

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by