2505 posts Small, but tough
  • Affiliate Level 7
  • Author Level 8
  • Beta Tester
  • Collector Level 4
+13 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.

480 posts
  • Author Level 6
  • 3 Years of Membership
  • Affiliate Level 2
  • Collector Level 1
+6 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 :)
2505 posts Small, but tough
  • Affiliate Level 7
  • Author Level 8
  • Beta Tester
  • Collector Level 4
+13 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! :)

480 posts
  • Author Level 6
  • 3 Years of Membership
  • Affiliate Level 2
  • Collector Level 1
+6 more
DOGmotion
says

No problem, man ;)

5327 posts
  • Elite Author
  • Moderator
  • Weekly Top Seller
  • Top Monthly Author
+13 more
felt_tips
Moderator
says

Yeah…. what DOGmotion said. :)

77 posts Film Production
  • Weekly Top Seller
  • Elite Author
  • Author Level 8
  • Featured Author
+8 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
  • Weekly Top Seller
  • Elite Author
  • Author Level 8
  • Featured Author
+8 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.

480 posts
  • Author Level 6
  • 3 Years of Membership
  • Affiliate Level 2
  • Collector Level 1
+6 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
  • Weekly Top Seller
  • Elite Author
  • Author Level 8
  • Featured Author
+8 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.

666 posts
  • Weekly Top Seller
  • Trendsetter
  • Featured Author
  • Featured Item
+8 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

by
by
by
by
by
by