FORUMS: list search recent posts

Quick expression problem with Levels Adjustment

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Bryan Woods
Quick expression problem with Levels Adjustment
on Jan 25, 2013 at 7:45:02 pm

I've got a little fire I need to put out, so any quick responses to this would be MOST appreciated!

I thought I would be able to easily control the levels adjustment effect with the dynamic fade expression, and just modify values, but it keeps giving me the inverse of what I want. I'm using a Levels adjustment (The individual controls version), and applying the below expression to the Output Black parameter. This fades the clip up to white, instead of fading down from white. I can't figure out how to invert it! It seems like it'd be so simple, but its proving to be quite a problem. Any ideas?



transition = 20; // transition time in frames

if (marker.numKeys<2){
tSecs = transition / ( 1 / thisComp.frameDuration); // convert to seconds
linear(time, inPoint, inPoint + tSecs, 0, 2.5) - linear(time, outPoint - tSecs, outPoint, 0, 2.5)
}else{
linear(time, inPoint, marker.key(1).time, 0, 2.5) - linear(time, marker.key(2).time, outPoint, 0, 2.5)
}


Also a quick note: I have tried swapping values, and I get a negative (literally) effect instead of positive.


Return to posts index


Bryan Woods
Re: Quick expression problem with Levels Adjustment
on Jan 25, 2013 at 7:56:59 pm

Nevermind! Figured it out! Code below for any future reference:


Apply to Ouput Black on Levels effect (individual controls version):

//Autofade: Add to opacity

transition = 20; // transition time in frames

if (marker.numKeys<2){
tSecs = transition / ( 1 / thisComp.frameDuration); // convert to seconds
linear(time, inPoint, inPoint + tSecs, -1, -2.5) + linear(time, outPoint - tSecs, outPoint, 2.5, 4)
}else{
linear(time, inPoint, marker.key(1).time, -1, -2.5) + linear(time, marker.key(2).time, outPoint, 2.5, 4)
}


Return to posts index


Dan Ebberts
Re: Quick expression problem with Levels Adjustment
on Jan 25, 2013 at 7:58:11 pm

I'd do it like this:


transition = 20;
if (marker.numKeys<2){
tSecs = framesToTime(transition);
if (time < (inPoint + outPoint)/2)
linear(time, inPoint, inPoint + tSecs,2.5,0)
else
linear(time, outPoint - tSecs, outPoint,0,2.5);
}else{
if (time < (inPoint + outPoint)/2)
linear(time, inPoint, marker.key(1).time,2.5,0)
else
linear(time, marker.key(2).time, outPoint, 0, 2.5);
}



Dan



Return to posts index


Bryan Woods
Re: Quick expression problem with Levels Adjustment
on Jan 25, 2013 at 8:31:27 pm

Ah, that is a bit nicer. I'll take that into consideration.

Another issue I'm having maybe you can point out the issue. I'm trying to roll this into a script, and I'm having a hard time targeting the "Output Black" sub property of the levels control. At line 23 I get an error stating "Null is not an object".

//Set Undo Group

{
app.beginUndoGroup("SlideShow_FX");

//Define project and active items
var proj = app.project;
var theComp = proj.activeItem;
var selectedLayers = theComp.selectedLayers;

//For every layer selected...
for (var i = 0; i < selectedLayers.length; i++) {
var myLayer = selectedLayers[i];
var levelsAdjust = myLayer.Effects.addProperty("Levels (Individual Controls)");
myLayer.property("Levels (Individual Controls)")("Output Black").expression = "1"; //value of 1 is acting as debug. I'll put the actual expression in later
}
app.endUndoGroup();

}


Return to posts index


Dan Ebberts
Re: Quick expression problem with Levels Adjustment
on Jan 25, 2013 at 10:53:50 pm

Try changing that line to this:

myLayer.property("Effects")("Levels (Individual Controls)")("Output Black").expression = "1";


Dan



Return to posts index

Bryan Woods
Re: Quick expression problem with Levels Adjustment
on Jan 26, 2013 at 12:09:45 am

Thanks Dan. That's what I was missing; ("Effects"). Forgot that everything was in a master sub menu.

On a different topic, would you happen to know how to set an effect's window to be closed instead of twirlled open in the effects window? This script is adding an effect and some sliders, and I don't want the effect to be open (because it takes up a lot of space visually). I've seen others do it, but I have no clue how to access that kind of attribute. I'm sure its some boole operation, but I have no idea what the syntax would be for it.


Return to posts index


Dan Ebberts
Re: Quick expression problem with Levels Adjustment
on Jan 26, 2013 at 12:56:15 am

If controlling the twirl gizmos is possible with scripting, I would love to know how to do it. Are you sure you've seen it?

Dan



Return to posts index

Bryan Woods
Re: Quick expression problem with Levels Adjustment
on Jan 26, 2013 at 4:01:49 am

I could have sworn I've seen it done before. Some kind of multi effect from a script I used a long time ago plucked from AEscripts. I thought maybe plexus did this, but I just checked and all the effects palettes are open when they're created. I also checked the CS6 expressions guide pdf and no mention of anything like that in there. I can't believe they wouldn't put an option to set the state of the twirl down gizmo... :( Maybe Todd would know?

By the way, thank you yet again for all your help. I really do appreciate all the effort you put into helping me and so many others on this forum.


Return to posts index

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