Ross Klettke
Forum Replies Created
-
Ross Klettke
April 28, 2016 at 5:44 pm in reply to: After Effects Scripting – swapping composition dimensionsJust a note that the top for-loop should have:
i <= theComp.numLayerswith a less-than sign — not, the weird html entity thing
-
Ross Klettke
April 28, 2016 at 5:39 pm in reply to: After Effects Scripting – swapping composition dimensionsHaven’t fully tested it out but attached is something that might help
//
Borrowed an idea and a bit of code from “Scale Composition.jsx” — thanks to whoever wrote that (I believe it comes bundled with AE)
function makeParentLayerOfAllUnparented(theComp, newParent)
{
for (var i = 1; i <= theComp.numLayers; i++) {
var curLayer = theComp.layer(i);
if (curLayer != newParent && curLayer.parent == null) {
curLayer.parent = newParent;
}
}
}var comp = app.project.activeItem;
var origCompSize = [comp.width,comp.height];var null3DLayer = comp.layers.addNull();
null3DLayer.threeDLayer = true;
null3DLayer.position.setValue([origCompSize[0]/2,origCompSize[1]/2,0]);
makeParentLayerOfAllUnparented(comp, null3DLayer);var newCompSize = [origCompSize[1], origCompSize[0]];
comp.width = newCompSize[0];
comp.height = newCompSize[1];null3DLayer.position.setValue([newCompSize[0]/2, newCompSize[1]/2,0]);
null3DLayer.remove();
-
Sure, expression attached
movementDuration = .5;
pauseDuration = .5;
movementAmount = -50;////////////////
sequenceDuration = movementDuration + pauseDuration;
whichIteration = Math.floor(time / sequenceDuration);seqStartTime = whichIteration * sequenceDuration;
moveEndTime = seqStartTime + movementDuration;startYPos = whichIteration * movementAmount;
endYPos = (whichIteration + 1) * movementAmount;yValueChange = ease(time, seqStartTime, moveEndTime, startYPos, endYPos);
value + [0, yValueChange];
-
On the footage layer make 4 Color Control effects (in Effects > Expression Controls > Color Control)
Then for each Color Control, add the sampleImage expression:
sampleImage(point, radius = [.5, .5], postEffect = true, t = time)
— swapping in the correct value for pointAnd finally, in the 4-Color Gradient effect add expressions to each color linking them to the Color Control effects
Hope that helps!
sampleImage(point, radius = [.5, .5], postEffect = true, t = time) -
Oh, I forgot to mention: The expression I attached doesn’t have the on/off movement of your original expression (currently, it only includes the upwards y motion with a duration) but it is a nice simple platform for adding that functionality if you want.
-
Within After Effects go to Preferences > Memory
— you can allow Adobe to take advantage of more memory there -
Hey, you might find this simplified version helpful (I’ve added some explanatory comments):
movementDuration = .5; // in seconds
movementAmount = -200;//here the ease function reads the current time and compares it to the next 2 parameters: 0 and movementDuration. If the time is 0, then the ease function outputs 0 (the 4th parameter). If the time is equal to movementDuration, then the ease function outputs movementAmount (the 5th parameter).
yValueChange = ease(time, 0, movementDuration, 0, movementAmount);//finally, we take the initial position of the layer and modify it with what the ease function gave us
value + [0, yValueChange];————-
The weird motion blur thing is a byproduct of using the frameNumber as input to the ease function. Basically — to create motion blur, After Effects renders a bunch of images of your composition at times that are slightly off your current time. Then it merges these images into the final motion-blurred image that you see.
Most of these “slightly off in time” images don’t fall on a whole-frame number. Example: If you are trying to render Frame 15 with motion-blur, then AE might be combining the images at Frame 15 and Frame 14.8 and Frame 14.6 and 14.4 and 14.2 and 14… etcBecause the initial expression you have uses just the whole frameNumber (not allowing any of the 14.8, 14.6, etc), when AE tries to render frame 14.8, the expression is actually just telling AE about the layer’s position at Frame 14.
The easy way to fix the motion blur, as the attached script does, is to just use seconds instead of frames. Using “time” gives you seconds and includes partial seconds (example: 1.255 seconds)
Hope that helps!
movementDuration = .5;
movementAmount = -200;yValueChange = ease(time, 0, movementDuration, 0, movementAmount);
value + [0, yValueChange];
-
Ross Klettke
April 25, 2016 at 10:09 pm in reply to: External text file that updates text in the compositionPrior to trying this out here I’ve never used external files — so take this with a grain of salt, but here’s what I got to work:
Inside a text file I called externalText.txt: var comp1 = [“30 YEAR”, “3.628%”];
The expression on the text layer’s “source text”:
try{
$.evalFile (“C:\\Users\\rklet\\Documents\\TEMP\\externalText.txt”);
comp1[0];
}catch (err){
“not found”
}——
Some things that might be issues in your code:
myPath = “file://C:/Users/kjennings/Desktop/30yr.txt”; //this line not necessary
try{
$.evalFile (“file://C:/Users/kjennings/Desktop/30yr.txt”); //I don’t believe the file:// is necessary and, at least on my Windows computer, the file path uses \ not /. Also, maybe try doubling up the slashes (see my example above — I think this acts as what’s known as an “escape character”)
eval(“Comp 1”); //there’s no variable named “Comp 1” in your text file. use “comp1” instead
}catch (err){
“not found”
}Hope that helps!
-
Ross Klettke
December 18, 2012 at 10:06 pm in reply to: expression reading output of expression and misc questions regarding thisAwesome, thanks Dan! And that “publish”-to-negative-time workaround is really interesting.
-
Hey,
This expression might be what you’re looking for:
[value[0], time * 50]Like you said, because the Center property requires an X and a Y parameter, values need to be provided for both– so the above expression feeds “value[0]” into the X parameter and “time *50” into the Y. value[0] is the value of whatever you’ve keyframed the X parameter to be, so you can have “time *50” control the Y parameter and you can still keyframe the X value if you’d like.
These can be changed to whatever you want.
Hope that helps!
–Ross