My 5 COW Posts
Re: rescaling numbers by Dan Ebberts on Aug 27, 2009 at 2:54:25 pm in the Adobe After Effects Expressions Forum If there aren't any parents involved, it could be as simple as this:
p1 = thisComp.layer("layer 1").transform.position;
p2 = thisComp.layer("layer 2").transform.position;
linear(length(p1,p2),1064,2748,0,50);
Dan...
Re: Change Position relative to a different layer by Dan Ebberts on Aug 6, 2009 at 2:35:10 am in the Adobe After Effects Expressions Forum A Slider control and a position expression like this should do the trick:
s = effect("Slider Control")("Slider");
startY = 100;
endY = 400;
y = linear(s,0,100,startY,endY);
[value[0],y]
You may want to modify it so that the slider is on a control null and both of your...
Re: Alternate between two values x-times per second. by Dan Ebberts on Jul 31, 2009 at 8:21:50 am in the Adobe After Effects Expressions Forum I think this will do it:
zVal1 = 500;
zVal2 = 1000;
freq = 50;
phase = Math.floor(time*freq);
z = phase%2 ? zVal2 : zVal1;
[value[0],value[1],z]
Dan...
Re: Number Count up by Dan Ebberts on Jul 15, 2009 at 2:16:11 am in the Adobe After Effects Forum A text expression like this should get you started:
beginTime = 0;
endTime = 2;
startVal = 100;
endVal = 1000;
"$" + Math.round(linear(time,beginTime,endTime,startVal,endVal))
Dan...
Re: Arrow always pointing to centre. by Dan Ebberts on Jun 18, 2009 at 7:51:13 am in the Adobe After Effects Forum An expression like this for rotation should do it:
offset = 180;
L = thisComp.layer("sun");
P1 = L.toWorld(L.anchorPoint);
P2 = toWorld(anchorPoint);
delta = P2 - P1;
offset + radiansToDegrees(Math.atan2(delta[1],delta[0]))
Adjust "offset" until the layer is pointing where you want (probably 0, 90, 180 or -90.
Dan...
Re: Impossible expression by Dan Ebberts on Apr 29, 2009 at 2:12:18 pm in the Adobe After Effects Expressions Forum Start your expression with:
seedRandom(index,true);
Dan...
Re: Help! 2D vector rotate. by Dan Ebberts on Apr 23, 2009 at 2:08:51 am in the Adobe After Effects Expressions Forum I haven't tried it, but it looks like you might be changing too soon. Try your function this way:
function doRotate(p, a) { //rotates a point p, angle a around the origin [0,0]
x0 = p[0];
y0 = p[1];
x =...
Re: same expression for several layer by Dan Ebberts on Apr 21, 2009 at 5:56:24 am in the Adobe After Effects Expressions Forum It shouldn't. Copy once, select all other layers, paste once.
Dan...
Re: generate varying lengths of random numbers by Dan Ebberts on Apr 18, 2009 at 1:58:03 pm in the Adobe After Effects Expressions Forum The are a lot of possibilities. Try plugging this into the source text property of a text layer:
frames = 4; // generate new number every 4 frames
minDigits = 3;
maxDigits = 15;
f = timeToFrames();
n = Math.floor(f/frames);
s = "";
seedRandom(index,true)
while (n >=...
Re: Null rotation driving/affecting multiple opacities by Dan Ebberts on Apr 14, 2009 at 12:52:18 pm in the Adobe After Effects Expressions Forum Play around with this version. Adjust "factor" until you get something you like:
factor = 2;
C = thisComp.activeCamera;
v1 =normalize(anchorPoint - fromWorld(C.toWorld([0,0,0])));
angle = Math.acos(dot(v1,[0,0,1]));
100/Math.exp(angle*factor)
No book (yet), but I did write an expressions chapter for the latest edition of Mark Chrisiansen's book.
Dan...
Re: Null rotation driving/affecting multiple opacities by Dan Ebberts on Apr 14, 2009 at 10:50:09 am in the Adobe After Effects Expressions Forum It's going to look something like this:
C = thisComp.activeCamera;
v1 =normalize(anchorPoint - fromWorld(C.toWorld([0,0,0])));
angle = Math.acos(dot(v1,[0,0,1]));
linear(angle,0,Math.PI,100,0)
Dan...
Re: Hold frame script by Dan Ebberts on Apr 9, 2009 at 7:51:58 am in the Adobe After Effects Expressions Forum Enable time remapping and try this time remapping expression:
framesToTime(Math.floor(timeToFrames()/4));
Dan...
Re: how to get the opposite? by Dan Ebberts on Mar 25, 2009 at 12:48:40 pm in the Adobe After Effects Expressions Forum Try this:
s = 200 - thisComp.layer("1st solid").transform.scale[0];
[s,s]
Dan...
Re: Parenting puppet tool by Dan Ebberts on Mar 12, 2009 at 3:44:39 pm in the Adobe After Effects Expressions Forum Something like this:
L = thisComp.layer("face");
L.toWorld(L.effect("Puppet").arap.mesh("Mesh 1").deform("Puppet Pin 1").position)
Dan...
Re: Camera follows an object in 3D space by Dan Ebberts on Feb 25, 2009 at 5:16:25 pm in the Adobe After Effects Expressions Forum Apply an expression like this to the camera's Point of Interest:
L = thisComp.layer("Flying Object");
L.toWorld(L.anchorPoint)
Dan...
Re: Simple text expression by Dan Ebberts on Feb 22, 2009 at 6:59:19 pm in the Adobe After Effects Expressions Forum This seems to work:
words = ["Hi","Bye","Dog","Cat","House"];
seedRandom(index,true);
idx = Math.floor(random(words.length));
str = "";
for (i = 1; i...
Re: AE Script error... by Dan Ebberts on Feb 10, 2009 at 3:08:21 am in the Adobe After Effects Expressions Forum You'll get that error message if you try to set the opacity value of a layer that doesn't have that property, like a camera, or an audio layer.
Dan...
Re: Uniform Scale Wiggle by Dan Ebberts on Feb 6, 2009 at 7:06:52 am in the Adobe After Effects Expressions Forum Like this:
w = wiggle(5,30);
[w[0],w[0]]
Dan...
Re: Stop rotation then start again wull null by Dan Ebberts on Dec 18, 2008 at 9:49:02 am in the Adobe After Effects Expressions Forum You could do it with a couple of layer markers on the null. This example follows the sphere's rotation until the first layer marker, stops until the 2nd marker, then starts rotating again:
r = comp("Ball").layer("Disco Ball Surface").effect("CC Sphere")("Rotation Y");
if (marker.numKeys...
Re: case problem in a .jsx script by Dan Ebberts on Dec 14, 2008 at 12:25:51 am in the Adobe After Effects Forum "Anchor Point", "anchorPoint", "Position", and "position" all work for me.
Check page 150 of the Scripting Guide:
http://www.adobe.com/products/aftereffects/pdfs/aftereffectscs3_scripting_guide.pdf
Dan...
Re: steep of a curve to drive the color of a dot by Dan Ebberts on Dec 9, 2008 at 7:46:53 am in the Adobe After Effects Forum You could add a fill effect to the pointer with an expression like this for the fill color:
zeroSpeedColor = [1,0,0,1]; // red
maxSpeedColor = [1,1,0,1]; // yellow
maxSpeed = 500; // pixels per second
linear(transform.position.speed/maxSpeed,0,1,zeroSpeedColor,maxSpeedColor)
You'd need to adjust the colors and maxSpeed to...
Re: Help With Expressions - Faking Stop Motion by Dan Ebberts on Dec 7, 2008 at 10:27:53 am in the Adobe After Effects Expressions Forum Give this a try:
n = 5; // play every 5th frame
m = 2; // play each frame twice
f = timeToFrames();
p = Math.floor(f/m);
framesToTime(p*n)
Dan...
Re: random frames without repeating by Dan Ebberts on Dec 3, 2008 at 3:10:01 pm in the Adobe After Effects Expressions Forum Assuming that your images are sequenced 1 per frame (either as an image sequence, or in a precomp), a time remapping expression like this should do what you want:
n = 100; // number of images
minDur = 25;
maxDur = 40;
seedRandom(index,true);
images =...
Re: expression to display name of the source footage by Dan Ebberts on Nov 25, 2008 at 4:05:27 pm in the Adobe After Effects Forum This should help:
http://www.motionscript.com/design-guide/source-name.html
Dan...
Re: Match position but not scale by Dan Ebberts on Nov 13, 2008 at 2:59:58 pm in the Adobe After Effects Expressions Forum If you parent the text layers to the map, you can add a scale expression like this to the text layers:
parentNormalScale = 100;
value * parentNormalScale/parent.transform.scale[0]
You would want to adjust the first parameter to be whatever your map scale starts at.
Dan...
Re: Get time from keyframe-position by Dan Ebberts on May 30, 2008 at 10:24:37 am in the Adobe After Effects Expressions Forum Like this:
prop = thisComp.layer("Null 1").effect("Angle Control")("Angle");
n = prop.numKeys;
prop.valueAtTime(time - prop.key(n).time)
Dan...
Re: Random layer position constrained by another layer's alpha by Dan Ebberts on Feb 27, 2008 at 12:31:24 pm in the Adobe After Effects Expressions Forum This seems to work for 2D. I'm not sure how you have your 2.5 D set up, but you should be able to do something similar.
L = thisComp.layer("island");
seedRandom(index,true);
P = L.transform.position;
offset = [L.width,L.height]/2;
minPos = P - offset;
maxPos = P + offset;
while(true){...
Re: Accessing textIndex from the Position property by Dan Ebberts on Feb 27, 2008 at 12:31:24 pm in the Adobe After Effects Expressions Forum Lloyd,
It looks like you understand the limitations. My example wasn't the best though. If you change it to this:
seedRandom(textIndex,true);
random([-100,-100],[100,100]);
you'll see that you have access to a rectangle with the character's original position in the center. I've actually constructed...
|
**Note: Get your favorite posts around the COW to show up here by being logged in and rating a post with 5 COWs. |
|