ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

How to calculate shape area?

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Andrew ShishkinHow to calculate shape area?
by on Jun 2, 2015 at 2:35:07 pm

Hi, guys.
What about calculations of complex shape area or area of text with strokes (maybe not quite accurate) and its correlation to overall screen size (in percent)?
Does anyone know easy way how to do this?

Return to posts index

Dave LaRondeRe: How to calculate shape area?
by on Jun 2, 2015 at 4:20:47 pm

You'd do it the same way you'd calculate the area of any other kind of shape.

If it's curved and irregular, you'd better dust off your calculus book.

Dave LaRonde
Promotion Producer
KGAN (CBS) & KFXA (Fox) Cedar Rapids, IA

Return to posts index

Peter DiefenthalerRe: How to calculate shape area?
by on Jun 6, 2015 at 7:47:48 pm

I figured something like this out a while back, maybe it will help.

Precompose the layer you want to calculate the area for and make sure the background is transparent. On the precomposed layer, add a slider expression control, alt click the slider and apply this expression:

sampleArea = [thisComp.width,thisComp.height]; // Specifies the comp frame dimensions
color = sampleImage(sampleArea*0.5,sampleArea); // Samples the colors of entire frame area

100*(color[3]*4) // Returns the percentage of Alpha within the frame

Note: You should be in 16 or 32bpc for this to be accurate and I don't think multiprocessing will work with the “sampleImage” expression.

I hope this was helpful. Good luck.

Peter Diefenthaler

Return to posts index

Andrew ShishkinRe: How to calculate shape area?
by on Jun 7, 2015 at 5:50:04 pm

Peter, that is awesome! Exactly what I searched. Thank you so much!

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 All Rights Reserved