Dan Ebberts
Community Expert
Dan Ebberts
Community Expert
Activity
2 hours ago
If you also wanted to automate centering the text on the circle, you could use a position expresion like this for the text layer:
L = thisComp.layer("Shape Layer 1");
r1 = L.sourceRectAtTime(time,false);
c1 = L.toComp([r1.left + r1.width/2,r1.top + r1.height/2]);
r2 = sourceRectAtTime(time,false);
c2 = toComp([r2.left + r2.width/2,r2.top + r2.height/2]);
delta = c2 - c1;
value - delta
... View more
2 hours ago
If you have a circle shape layer and a text layer, you would apply the expression to the text layer's scale property and it should scale the text so that it will just fit inside the circle. That's all it does.
... View more
‎Mar 06, 2025
10:49 AM
I just tested your code on a comp with a solid with five keyframes, where the last keyframe is a hold keyframe, and it works perfectly for me.
... View more
‎Mar 05, 2025
06:00 PM
This works fine for me (where keyframe 5 is a hold keyframe):
var myProp = app.project.activeItem.layer(1).property("Position");
for (var i = 1; i <= myProp.numKeys; i++){
myProp.setSelectedAtKey(i,false);
}
myProp.setSelectedAtKey(5,true);
... View more
‎Mar 05, 2025
01:47 PM
Have you tried positioning the parent at the center of the 4 child objects?
... View more
‎Mar 04, 2025
10:23 AM
This is an interesting and tricky problem. I've been tinkering with it for a couple of days and here's what I've got. If the layer is a solid with the anchor point centered, you can use a position expression like this to "roll" the square in accordance with the rotation property:
w = width;
r = Math.sqrt(2*w*w)/2;
a = rotation%90;
a += a < 0 ? 90 : 0;
n = Math.floor(rotation/90);
a0 = Math.PI*5/4;
a1 = Math.PI*7/4;
a2 = linear(a,0,90,a0,a1);
c0 = Math.cos(a0);
x = n*w + r*(Math.cos(a2) - c0);
s0 = Math.sin(a0);
y = r*(Math.sin(a2) - s0);
value + [x,y]
If you're using a square shape layer (with anchor point centered), you need to change the first line to this:
w = content("Rectangle Path 1").size[0];
... View more
‎Feb 26, 2025
02:09 PM
1 Upvote
I'm not sure which method you're looking for, but if you just want to cycle through the colors, you could do something like this:
holdTime = 2; // hold each color for 2 seconds
a = effect("Color Control")("Color");
b = effect("Color Control 2")("Color");
c = effect("Color Control 3")("Color");
colors = [a,b,c];
idx = Math.floor(time/holdTime)%colors.length;
colors[idx]
but if you want to pick the colors randomly, it would be more like this:
holdTime = 2; // hold each color for 2 seconds
a = effect("Color Control")("Color");
b = effect("Color Control 2")("Color");
c = effect("Color Control 3")("Color");
colors = [a,b,c];
seed = Math.floor(time/holdTime);
seedRandom(seed,true);
idx = Math.floor(random(colors.length));
colors[idx]
... View more
‎Feb 26, 2025
09:11 AM
You would apply it to the null's position property.
... View more
‎Feb 20, 2025
09:36 AM
Have you tried wrapping your beginUndoGroup() and endUndoGroup() around the entire try/catch/finally structure instead of inside try and finally? It seems like that would be safer.
... View more
‎Feb 19, 2025
11:37 PM
2 Upvotes
A scale expression like this should size the text to fit the circle:
d = thisComp.layer("Shape Layer 1").content("Ellipse 1").content("Ellipse Path 1").size[0]; // circle diameter
r = sourceRectAtTime(time,false);
w = r.width;
h = r.height;
angle = Math.atan2(h,w);
wNew = d*Math.cos(angle); // desired text width
sf = wNew/w; //scale factor
[sf,sf]*100
... View more
‎Feb 19, 2025
07:06 AM
This is nice. I can't believe it never occurred to me to request this. I open other people's projects all the time and am never comfortable in their workspace. Definitely a set and forget and I would say default to enabled.
... View more
‎Feb 17, 2025
09:46 AM
It's a tricky geometry problem. If you were using a rectangle shape (with anchor point centered), you could use something like this:
h = content("Rectangle 1").content("Rectangle Path 1").size[1];
angle = degreesToRadians(content("Rectangle 1").transform.skew);
value + [-(h*Math.tan(angle))/2,0]
but that doesn't work with an irregular shape. I tried using sourceRectAtTime() to get the height, but I wasn't able to make that work. I'm stumped, but maybe someone will figure it out.
... View more
‎Feb 16, 2025
05:09 PM
1 Upvote
You have to make sure that all layers other than your target layer are deselected. I usually deselect all layers in the comp, then select the target layer, then apply the preset.
... View more
‎Feb 14, 2025
04:53 PM
I think it's always been upper left corner for layers with sources (solid, video, still, null) and anchor point for layers without sources (text, shape)
... View more
‎Feb 14, 2025
08:49 AM
I can confirm your observations. Also, if I load the 2023 project into AE 2025, it gives the "test 1" result, so it looks like a bug to me.
... View more
‎Feb 13, 2025
09:04 AM
Like this maybe:
m = marker;
t = time;
startKey = thisComp.layer("Controller").effect("Start")("Slider");
stopKey = thisComp.layer("Controller").effect("Stop")("Slider");
try{
tStart = m.key(startKey).time;
tStop = m.key(stopKey).time;
t = linear(time,tStart,tStop,tStart,tStop);
}catch(e){
}
t
... View more
‎Feb 13, 2025
08:48 AM
1 Upvote
Like this maybe:
freq = 3;
amp = 200;
hold = .5;
t = Math.floor(time/hold)*hold;
wiggle(freq,amp,1,.5,t)
... View more
‎Feb 12, 2025
10:42 AM
I ran a quick test, and it appears to me that scripting for essential graphics properties still works the way you expect. I'm guessing you know this, but that syntax only works when the selected layer is a precomp that has essential graphics properties defined inside the precomp.
... View more
‎Feb 12, 2025
09:07 AM
I'm not sure exactly what behavior you want, but this example should play normally until the first marker, then freeze:
m = marker;
t = time;
if (m.numKeys > 0){
t = Math.min(time,m.key(1).time);
}
t
... View more
‎Feb 12, 2025
03:54 AM
Your trimPath variable should indeed be between 0 and 1, but you don't use that anywhere. And, again, it's not clear to me that your ellipse actually has a .path property. Can you post a stripped down project file?
... View more
‎Feb 12, 2025
03:28 AM
It would help to see the error message, but I see a couple of things. In the first line, if Shape Layer 5 is an Ellipse, it probably wouldn't have a .path property, so you couldn't do pointOnPath() for that. Also, pointOnPath() expects its parameter to have a value between 0 and 1, and it looks like you're providing a path instead. What is it that you're trying to do, exactly?
... View more
‎Feb 11, 2025
03:22 PM
This example will create a text layer and set it to normal caps:
var myComp = app.project.activeItem;
var myTextLayer = myComp.layers.addText("Text");
var mySourceText = myTextLayer.property("ADBE Text Properties").property("ADBE Text Document");
var myTextDoc = mySourceText.value;
myTextDoc.fontCapsOption = FontCapsOption.FONT_NORMAL_CAPS;
mySourceText.setValue(myTextDoc);
... View more
‎Feb 08, 2025
09:11 AM
I think File() expects the path to be URI encoded, so the %20 for spaces should be fine, but are you sure the path is correct? I don't see a /assets/ folder in AE's Support Files folder..
... View more
‎Feb 05, 2025
07:07 PM
The problem is skipping the part before the loop (which is what I assumed you wanted). LoopOut, by itself won't do that. You could probably fiddle with the keyframes and make it work, but that seems like more trouble than the way I did it.
... View more
‎Feb 05, 2025
07:04 PM
I was assuming you'd leave the two keyframes created when you turn on time remapping, so yes, a total of 3.
... View more
‎Feb 05, 2025
03:10 PM
There are optional parameters you can supply to specify how many decimal places (fraction digits), so this would be like toFixed(0):
s = effect("Slider Control")("Slider").value;
s.toLocaleString("en-US",{minimumFractionDigits: 0,maximumFractionDigits: 0})
de
... View more
‎Feb 05, 2025
01:19 PM
1 Upvote
If I'm interpreting what you're asking correctly, you would enable time remapping, move the CTI to 2 seconds and click Time Remap diamond to create a keyframe there, and then use a Time Remap expression like this:
t = time%(key(3).time - key(2).time);
key(2).time + t
... View more
‎Feb 04, 2025
03:43 PM
The part between the forward slashes is a Regular Expression, which has its own cryptic syntax separate from JavaScript, which you can decode with a good RegExp reference. However, I think I'd advise switching to JavaScript's built-in number formating functionality, like this example:
s = effect("Slider Control")("Slider").value;
s.toLocaleString("en-US")
... View more
‎Feb 04, 2025
01:40 PM
1 Upvote
My guess is that you have the expressions engine set to Legacy ExtendScript in your project settings.
... View more
‎Feb 04, 2025
12:44 PM
1 Upvote
I think your "ADBE Text Selector Start" should be "ADBE Text Percent Start". That goes for the End parameter as well.
... View more