Quantcast
Channel: Adobe Community : Popular Discussions - After Effects Expressions
Viewing all 47983 articles
Browse latest View live

Possible to set Source Text from another comp?

$
0
0

Let's say there is a Comp1 with a pretty complicated animation that involves a text layer. CompMain is the main comp with 10 instances of Comp1. Each instance has different text, position and timing. Can I set the Comp1 text layer Source Text from an expression in CompMain? If this is not possible, is there any workaround? Otherwise, the alternative would be to have 10 versions of Comp1 with different text and that would be too messy.


Counting up in Multiples

$
0
0

How do i set an expression to my slider to count in Multiples of 10s, 20s.... to my very last key@@frame?

Thanks

Adapting this Cursor Expression

$
0
0

Calling for help!!

 

I have this great cursor expression that simulates a type on effect with blinking cursor:

 

     L = text.sourceText.length;

     It = time - thisLayer.inPoint;

     T = It*effect("Speed")("Slider")  -   effect("Start After")("Slider")*effect("Speed")("Slider");

     F = Math.round( It % 1 );

 

 

     if(F==1 | (T<L & T>0) ){Fl="|";}else{Fl="";}

 

 

substr(0,T) + Fl

 

However, I need the cursor colour to be not grey like the text but colour value #2196F3, and also made bolder if possible. Is anyone able to help me adjust the code to make this happen?

 

Many Thanks!

Mike Brookes

mikebrookes.tv

Measuring length of a curved path shape ?

$
0
0

Is it possible to measure the length of a curved shape (path) in after effects?

 

Illustrator has a built-in ability to measure stroke (curve lengths) so it seems like AE should have something similar.

Expression Error (cc2017)

$
0
0

Hi,

i have an expression error in project i bought but i dont know what is is. can you help me plz? (the warning say the error come from line 13)

 

wig=wiggle(thisComp.layer("CAMERA_CONTROLLERS").effect("WiggleSpeed")("ADBE Slider Control-0001"),thisComp.layer("CAMERA_CONTROLLERS").effect("WiggleAmount")("ADBE Slider Control-0001"))-value;

 

 

ST = content("Country_Targets").copies;

Min = Math.floor(ST);

Max = Min+1;

 

 

try{

L = effect("T-"+Min)("Layer"); M = effect("T-"+Max)("Layer"); exists = true;

}catch(err){

function countItems(obj) { a=0; while(true) { a++; try { eval(obj+"("+a+")"); } catch(error) { a--; break; } } return a }  TargetCount = countItems("effect") - 0; exists = false;

}

 

 

if(exists){  Amin = effect("T-"+Min)("Layer").position+wig; Amax = effect("T-"+Max)("Layer").position+wig; }else{Amin = effect("T-"+(TargetCount))("Layer").position+wig; Amax = effect("T-"+TargetCount)("Layer").position+wig;}

 

 

if(0){ linear(ST,Min,Min+1,Amin,Amax); }else{ ease(ST,Min,Min+1,Amin,Amax); }

After Effects Combine x2 Expressions - Bounce & loopOut

$
0
0

I'm after help combining x2 expressions. A bounce expression like below...

 

n = 0;

if (numKeys > 0){

n = nearestKey(time).index;

loopOut("cycle");

if (key(n).time > time){

n--;

}

}

if (n == 0){

t = 0;

}else{

t = time - key(n).time;

}

if (n > 0){

v = velocityAtTime(key(n).time - thisComp.frameDuration/10);

amp = .05;

freq = 4.0;

decay = 2.0;

value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);

}else{

value;

}

 

...with the standard loopOut("cycle") expression. I have a few key frames to lift an object slowly then to drop it quickly (hopefully with a bounce) and I need to repeat this indefinitely. Can any one help?

offset corner pin with different x y offset values

$
0
0

Hello!

 

Suppose you have a keyframed corner pin effect. Is there a way to extend a pin point (example: top left corner point) with different offset values for X and Y using expressions?

I tried everything, but I can't get it to work: the extended point doesn't stick with the right proportion over the animation.

This expression is one of the many i applied without any success. It works only if offset X and Y values are equal (ex.

Any suggestion? Thanks.

 

 

// CALCULATE CENTER COORDINATES

TL = effect("Pin")(1);

TR = effect("Pin")(2);

DL= effect("Pin")(3);

DR = effect("Pin")(4);

var vertices_x = [];

var vertices_y = [];

var min_x = Math.min(TL[0],TR[0],DL[0],DR[0]);

var max_x = Math.max(TL[0],TR[0],DL[0],DR[0]);

var min_y = Math.min(TL[1],TR[1],DL[1],DR[1]);

var max_y = Math.max(TL[1],TR[1],DL[1],DR[1]);

var mid_x = (min_x + max_x) / 2;

var mid_y = (min_y + max_y) / 2;

center = [mid_x,mid_y];

 

// OFFSET

offset = [20,50];

 

// TOP LEFT VECTOR

vector = normalize(TL - center);

 

// CALCULATE NEW TOP LEFT

x = TL[0] + * vector[0] * offset[0];

y = TL[1] + * vector[1] * offset[1];

[x,y]

Controlling tangents of a shape layer (cc 2018)

$
0
0

Figured it would be a lot of discussion re: the new scripting functionality of paths, but I can't find anything on this topic.

 

Is it possible to control the in and out tangents of an existing object by reference say the width of a shape layer? In other words: can I control the shape layer objects tangents other than just using the values on other objects.

 

I'm trying to define the tangent value this way:

myPath = thisComp.layer("Shape Layer 1").content("Shape 1").content("Path 1").path

myPath.inTangents()[2] = [120,50]

(the values are not referencing anything, I know!)

I get the 'object of type array found where a Property is needed' warning.

 

What is the correct way of doing this? Can't find any example in the expression reference help.


Using Create Nulls From Paths without Nulls (self contained)

$
0
0

Is it possible to use the new "Create nulls from paths" and relink the expression to its own layer rather than the null object.

I have a very basic object - a flower

It has a stem which is one single path.

Using Create Nulls from paths makes one at the stop of the stem and the bottom as you would expect

I then link the top of the stem null to the flower petals position.
This way I can move the flower and the stem bends and follows nicely

 

However I am wondering if I can alter the expression to bypass the null and link it directly to the position of the petals object group.

 

The direct code created out of create nulls from paths script.

 

I have been able to link the stem up using the Expression controls automatically created to select the shape instead of the null

however the null which then does nothing, breaks the code if deleted and it no longer works.

So I can bypass the null but its effectiveness is still dependent on the existence of the null which  makes the attempt pointless.

 

var nullLayerNames = ["Shape Layer 2: Path 1 [5.1.0]","Shape Layer 2: Path 1 [5.1.1]"];
var origPath = thisProperty;
var origPoints = origPath.points();
var origInTang = origPath.inTangents();
var origOutTang = origPath.outTangents();
var getNullLayers = [];
for (var i = 0; i < nullLayerNames.length; i++){    try{         getNullLayers.push(effect(nullLayerNames[i])("ADBE Layer Control-0001"));    } catch(err) {        getNullLayers.push(null);    }}
for (var i = 0; i < getNullLayers.length; i++){    if (getNullLayers[i] != null && getNullLayers[i].index != thisLayer.index){        origPoints[i] = fromCompToSurface(getNullLayers[i].toComp(getNullLayers[i].anchorPoint));     }}
createPath(origPoints,origInTang,origOutTang,origPath.isClosed());

 

I can do without obviously but I was hoping to make the flower self-contained if possible. And then if it were possible to bypass the null I could learn by extrapolation and apply the bypass to other projects

Multiple Expression To One Property

$
0
0

Hi everyone,

 

I have wiggle expression on rotation property of the layer with keyframes. I also want to add master Dan Ebberts' pendulum expression on the same property. Is this possible? I tried if else statement with checkbox (if checkbox =true do wiggle thing else do pendulum) but gave me error message "cannot assign value because it is read only". By the way this layer is Duik's controller and parented to zero object. Is there a way to do it?

 

Thanks.

loopOut expression ignores layer in-point

$
0
0

Hi all,

 

I'm trying to use a loopOut expression on a slider to control the size of many other layers with precise repetition.

 

The problem is, the loop ignores the defined number of key frames to loop, which begin at the layer in-point.

Instead, the loop starts at the beginning of the composition. Therefore the loop includes unwanted time and gets more and more out of whack with each pass.

 

Any suggestions?

 

Screen Shot 2018-06-19 at 3.25.57 pm.png

 

loopOut(type = "cycle", numKeyframes = 4)
cb = effect("Checkbox Control")("Checkbox");
if (cb.value == true)  t = time%key(numKeys).time
else if (cb.numKeys &gt; 0)  t = cb.key(cb.numKeys).time%key(numKeys).time
else  t = 0;
valueAtTime(t)

Randomly rotate layer in specific increments

$
0
0

The random(x) expression is simple enough to randomly rotate a layer to any angle, but what if I want that angle to be to the nearest 45 degrees? So my layer would randomly rotate to any of the following angles: 0, 45, 90, 135, 180, 225, 270, 315, or 360 degrees.  Thanks, Jim

Accurate Timer For Sports

$
0
0

Hi all. I'm trying to make an expression you apply to a text layer to time sports videos accurately. So far, I have the minutes and seconds figured out, but can't seem to get the milliseconds to work. They keep adding extra values past 100 which is what i dont want. Whenever it reaches 100 it should start over.

 

milli = Math.floor(time*100);

sek = Math.floor(time%60);

min = Math.floor(time/60);



if(sek<10)

{

   "0" + min +":0" + sek + ":" + milli;

}

else

{

   "0" + min +":" + sek + ":" + milli;

}

Full auto-orient via expression

$
0
0

Hi!

 

I'd like a 3D Null to get the orientation of 3D a layer. (without parenting, it would be too easy )

 

I've tried a lot of solutions, through orientation, rotations, both combined... some results are close, but never perfect.

 

If I'm right, orientation is computed before rotations...

I think the simplest way would be with auto-orientation, or the lookAt() expression on orientation, wich gives me correct X and Y orientations, and then get an expression on zRotation to get a "full" orientation.

 

But what would it be?

How can I get the Z orientation in layer space?

 

Any idea will be appreciated!

 

François

How to control only the WIDTH of a rectangle with slider control using expression

$
0
0

I have a simple rectangle shape layer that I want to control (only the width) with slider control using expression. How do I do that?

 

Thanks in advance.


Expression Control / Slider Control work with percentage?

$
0
0

For example, I want to make one expression with keyframes, so opted to use "slide control," but the expression is now defined by the "slide control ", if I put the expression wiggle(2,5) and place the 2 on the slide control, know that the value will be replaced by the value of "slide control" if in case the slide control was "10", would look like this: wiggle(10,5)

 

 

But what I want to know is if have how to control the original expression through a percentage and not a replaced, for the slider control value.

 

Thanks!

link a keyframe to a slider control

$
0
0

Hey all,

 

Got 2 keyframes on the Trim Paths 1 (End) of a Shape layer 1

The first keyframe has a value of 0

 

Now I want to be able to control the second keyframe with a slider control on Null. So when the slider value is 50, the keyframe value is 50.

 

Thanks in advance.

Strings of A,C,G,T?

$
0
0

I am trying to see if anyone has made a script to generate strings of DNA bases-A,C,G,T.  Or can offer suggestions.  Not unlike the random digital 0,1 generator, but with those four letters, and even better if the color of each letter can be specified such that, for example A is always red, C is always green. 

Thanks.

Text tracking amount contoled by source text via expressions

$
0
0

Hi all,

I've spent a pretty stupid amount of time trying to figure this out, and I'm guessing someone here knows exactly how to do this:

 

I need to setup a bunch of Live Text Templates in AE, to be used by editors in Premiere.

I need to provide extra controls that do not exist off the bat, and I plan to do so via non-visible text layers that drive numeric data linked to the properties I want to control.

 

The basics of what I'd need:

 

Text Tracking that can support negative and positive values. '0' is pre-entered

Text Scale- which could be the layer scale

Layer Position in X,Y

 

These are the current minimum controls I'm looking for, and I know they are pretty humble goals. But I can't figure out the syntax of how to get my typed "0" to be read as the value needed to drive the Text tracking, specifically. I have never learned JS, and have sub-rudimentary expression skills.

 

I'd love to see a set of these type of Live Text Template specific expression controls (Driven solely by text entry in Premiere) posted somewhere online, as I have NOT been able to find them.

 

Many thanks!

D

PS after deliberation and tests, I have made the decision not use Essential Graphics .MOGRT workflow (as disappointing as that is), as the current implementation of EG is not suitable for administering graphics templates on a facility scale.

This was put most concisely and constructively in this thread Motion Graphics - Limits & Frustrations when put to actual use.

Slider control price countdown

$
0
0

Hi, i'm stuck in this problem and maybe it's just a simple trick.

 

I need a way to make a countdown of a price with baseline shift on the two last numbers. The price should go from 22,25 to 19,95.

 

If i use slider control with the expression: Math.round(effect("Slider Control")("Slider"))  - i can't format the text to baseline shift.

 

Viewing all 47983 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>