ADOBE AFTER EFFECTS: Forum Expressions Tutorials Podcasts Creative Cloud

Lens Flare position on dynamic text or logo

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jimmy AndersonLens Flare position on dynamic text or logo
by on May 20, 2016 at 3:03:00 pm

Hello World,

As I begin the scary world of expressions, I'm stuck and need help.

I have an image layer 'placeholder' where a png logo will be placed (replace footage). There will be logos of all different shapes and colors. I want to place a lens flare on the bottom of the logo (not the bounding box, but where the actual pixels begin of the png).

My layer 'placeholder' is in it's own comp 'logo isolated'. I have this comp in the 'Main' composition flying in and then after it settles, a lens flare blooms on the bottom of the logo. The keyframes for the fly-in are on the 'main' comp. The 'placeholder' doesn't have any keyframes on the position, scale, rotation, or opacity.

I started by creating a 'Point Control' inside the 'logo isolated' comp on the 'placeholder' layer. I animated the Point Control to start at the bottom (Y) and animated it with keyframes to the top edge of the 'logo isolated' comp.

I then was testing a text layer to output to help identify the change in opacity:

targetLayer = thisComp.layer("placeholder");
samplePoint = targetLayer.effect("Point Control")("Point");
sampleRadius = [1,1];
sampledColor_8bpc = 255 * targetLayer.sampleImage(samplePoint, sampleRadius);
A = Math.round(sampledColor_8bpc[3]);
outputString = A

So, as the Point Control moves from bottom to top of the PNG layer on the Y, I can see when the Alpha changes from 0 to some number. My problem is that I can't figure out is how to identify the Y position value of when the alpha changes. This Y value would then need to be linked to the lens flare position XY on the main comp (and adjusted for position and scaling of 'logo isolated'). If the Point Control doesn't encounter any non-transparent pixels as it scans, I guess it wouldn't retrieve a Y value? I don't know how to adjust for this situation. It might be easiest to have the lens flare bloom on the bottom or top Y of the main comp (so its half-off screen).

Ideally, I would love for this concept to be able to be applied to text or a png placeholder.

Am I headed in the right direction? Any help would be appreciated.

Also, I'm not a huge fan of how I have to animated the Point Control across the placeholder as this takes time and if I repeat this process in a future project where the lens flare begins on frame 1, I won't have the time to scan across a png looking for alpha. It would be better if I could scan the placeholder comp for a change in alpha and find the X or Y value without animating the Point Control.

Thanks in advance.

Return to posts index

Kevin CampRe: Lens Flare position on dynamic text or logo
by on May 20, 2016 at 7:08:41 pm

there's not really a good way to do what you want with expressions... to do it with expressions, you'd need to scan every pixel, every frame and return the bottom most opaque pixel. it's possible but not very practical. maybe limiting the scan to just the bottom 100px or so might help, but it's still not very efficient. there was an old expression that someone had to detect the size of a text layer that used this same process, it would probably apply to what you are doing (search the cow or google for 'text size detection after effects', i first saw the expression about 5 years ago).

a script might be better. you'd need to run the script each time you updated the logo, but the script would scan the image and set the flare point once, rather than every frame.

you should try posting in the after effects expressions forum (or maybe you did, i haven't checked there yet).

i love expressions, but honestly, i think it would be easier to manually adjust the flare point each time, even for lots of logo updates...

Kevin Camp
Art Director

Return to posts index

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