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

Wiggle expression - slider control

$
0
0

Hi all

 

I had a solve for this from Dan Ebberts but I seem to have lost that content in the Jive update. I want to use a slider control for a wiggle, but when I have my basic wiggle expression applied to position, then pick whip from that to the slider, I get the below expression.

 

temp = effect("Wiggle Control Sliders")("Slider");

[temp, temp]

 

What is the fix for this/ way to do it right?

 

At the minute I'm using the expression below instead, but I hate not knowing the right way to do something! Using sliders/ creating decay in expressions has always been an issue for me...

 

wiggle(15,effect("Slider control")("Slider"))

 

Any help would be appreciated

 

Thanks!


counting numbers expression with commas

$
0
0

I am using the following expression to create a number countdown but I need it to recognize or insert commas in eight digit numbers. Can anyone tell me how to alter it:

 

 

startT = 0;

endT = .5;

beginVal = 12400000;

endVal = 10700000;

t = linear(time,startT,endT,beginVal,endVal);

Math.floor(t) + ''

 

 

P.S. there are also times that I'd like to add dollar signs or percent signs.

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.

Advanced expression (position) question

$
0
0

I'm usually pretty good with expressions, but I'm really stumped on this one:

 

For the sake of keeping it simple, let's say I have:

1. A layer

2. A null object with a slider

 

I want my layer to slide in (x position only) from Point A, to Point B, pause on Point B for a few seconds, then slide back to Point A.

 

Here's the challenge: I want Point B to be controlled by the slider, but I always want Point A to be the same exact starting/ending point. (say 0, for the sake of simplicity). So the animation should go:

 

0 to X, then X back to 0, where X is the value driven by the slider.

 

Hope this makes sense. Thank you in advance to anyone who might be able to 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

Can you set wiggle at specific points in timeline?

$
0
0

Hi folks,

I did this cool tutorial on creating light streaks:

https://www.youtube.com/watch?v=w-JG1n_Yeo8

 

In it, he used the wiggle expression to create the random movements.  I am trying to get a light streak to follow a specific path and then wiggle within the confines of a boundry, and then travel on a specific path and wiggle within the confines of another boundry.  Imagine the light having to travel through a small tube that opens into a box where there is room for it to move and then going through a tube again to the next box, etc.

 

Can anyone give me tips on how to achieve that sort of effect, or feel free to tell me the name of what I'm trying to achieve so that I can google it.  Thanks!

Comp name to TEXT?

$
0
0

Hi Guys, any way to extract the name of a comp and put it in a text layer?

Dynamic layer width based on width of text layer

$
0
0

Hello,

 

I'm making a lower third in After Effects. I am planning to use them as templates in Premiere.

What I am trying to reach is: when the text on the bar is longer then the bar itself, the bar should get longer on the right.

 

Does someone know how to do this? First I was thinking to do something with Expressions. But I'm not sure.

 

Any help would be appreciated

 

If you need more info, or if you want to let me explain this in more detail, let me know.


keyframes control with layer markers

$
0
0

Hello,

 

I have an animation of a line that has two sets of keyframes of two different properties in CS4.

Basically a line gets generated in the first phase then it gets cleared out in the second phase.

This is done using two slider controls that act on the horizontal size of two rectangles and using merge paths (using the second rectangle as a matte for the first to clear it out)

 

I've put two layer markers on my layer hoping to link the keyframes to each of them.

 

Then I have found this script on the web and I put it on the first property :

 

L= thisComp.layer("ShapeLayer");

n = 0;

if (L.marker.numKeys > 0){

n = L.marker.nearestKey(time).index;

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

n--;

}

}if (n == 0){

valueAtTime(0);

}else{

t = time - L.marker.key(n).time;

valueAtTime(t)

}

 

This indeed lets me move the whole animation with the layermarker (which is very good) but I can't find a way to link the second set of keyframes to do the output.

I will add a link with the project file: WeTransfer

 

Please help!

Thanks

Typewriter Expression

$
0
0

Hey guys, I've got a thorny problem here.  I've got lines of text being "typed" on the screen one character at a time.  I'm currently animating the text using the "start" parameter of the "range selector" attached to the opacity of the text, but I'm open to better ideas.  I also have a typewriter keyboard where each key is an image sequence with two frames, a "pressed" and an "unpressed" state. 

 

What I'd like to do is apply an expression to each key, so that it displays the "pressed" state when that letter is being typed on.

 

Anyone have any brilliant ideas about how to execute this?  Thanks so much!

 

Cheers,

Ari

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.

How do text layer expression selectors operate on character value?

$
0
0

I'm banging my head against my desk here.  Every other attribute I try to animate using expressions selectors works by multiplying the value returned by the selector by the value of the property in question.  But I can't make heads or tails of what an expression selector does to either Character Value or Character Offset properties.

 

Has anyone had any luck with these?

 

I'm just trying to transcribe the characters from one text layer into another using the expression:

 

 

MT = thisComp.layer("Master Text").text.sourceText;
if(textIndex < MT.length) MT.charCodeAt(textIndex) else 32

 

 

I set my character value to 1, and left the Amount property set to [100,100,100] thinking the value coming out of my expression would be multiplied by 1.  Instead, the results I get are nonsensical.  Is there something obvious that I'm missing?

wiggle expression with stepped (not smooth) interpolation?

$
0
0

hi

 

not sure if it's even a wiggle expression I'm after,

 

but I'm wondering how to go about getting a series of random values that an object or parameter will jump to (rather than smoothly transition to, as in the basic wiggle expression).

 

thanks

 

ML

Multiple checkbox related to each other with expressions Enquiry

$
0
0

Hello Guys,

Basically I need to do three colour options only one of them must be selected at a time so for example if I select Red colour then the other two options (Blue & Green) will be deselected automatically.

I've been trying quite hard to get this to work but I can't seems to figure it out alone.
Here's what I did.  3 checkbox controls, all in one layer (R, B, G) to control three colour or anything. And the rule for that is "if R checked in the box then the others un-checked at a time and vice versa".

The idea is a three way checkbox selection which coordinates with each other in the following way:

  • checkbox 1 - if ( (B ==1) || (G == 1)) false; else true;
  • checkbox 2 - if ( (R ==1) || (G == 1)) false; else true;
  • checkbox 3 - if ( (R ==1) || (B == 1)) false; else true;

It's seems like all work fine but when I checked the boxes nothing would change on the effected layer that I linked it with all checkboxes.
If you managed to understand what I'm trying to do, I'd love to hear your thoughts about this and what I am doing wrong.



I use this expression for each checkbox
R checkbox:

R = effect("R")("Checkbox"); T = effect("B")("Checkbox"); C = effect("G")("Checkbox");  if ((T == 1) || (C == 1)) {false} else  true;

B checkbox:

R = effect("R")("Checkbox"); T = effect("B")("Checkbox"); C = effect("G")("Checkbox");  if ((R == 1) || (C == 1)) {false} elsetrue;

G checkbox:

R = effect("R")("Checkbox"); T = effect("B")("Checkbox"); C = effect("G")("Checkbox");  if ((T == 1) || (R == 1)) {false} elsetrue;

The effected layer I did this rule:
Red = thisComp.layer("Red").effect("Fill")("Color"); Blue = thisComp.layer("blue").effect("Fill")("Color"); Green = thisComp.layer("Green").effect("Fill")("Color");  R = thisComp.layer("Controler").effect("R")("Checkbox"); B = thisComp.layer("Controler").effect("B")("Checkbox"); G = thisComp.layer("Controler").effect("G")("Checkbox");  if (R==1)  Red; else if (B==1) Blue; else if (G==1) Green; else value;

 

The project file in this link Project checkbox test


 

AE expression for "length of text layer" for lower thirds nameplate

$
0
0
Hello everyone,

Is there a way to measure the total width (and height) of a text layer, to automatically update the length (and height) of a shape layer? I produce web news segments with 7-15 lower thirds displays for each video. I'm looking for a more efficient way to re-size each nameplate. Currently I manually re-size each shape layer to fit the name. Is there an expression that will update the shape layer, based on the length (in pixels) of the text layer?

See an example video of what I'm talking about:
http://dallasvoice.com/dvtv_track.php?s=345
(look for the nameplates that animate in at the beginning of each interview)

I've read everything I can get my hands on, but nothing has helped. Any help would be appreciated!
-RY

Expression to control speed with the option to stop?

$
0
0
I made a simple animation with an expression to move a layer at a constant speed. With the Separate XYZ effect I used the expression time*120 on the X position. (120 is linked to a slider control but that is irrelevant for the problem)
This works great but now I want to stop the layer for a bit and then move on from that very same spot. And there comes the problem. As soon as I set the speed to 0 the animation jumps to the start. This is pretty obvious because time*0 = 0, but I can't come up with a solution :s

Expression error using checkbox control

$
0
0

I'm trying, for the first time, to create an expression that controls a value depending on whether or not a keyed checkbox is on.  This is my code.

 


x = comp("overlay grain").layer("frame").transform.position;

 

If (effect("Frame Stutter")("Checkbox") == true)
{
    value = x + wiggle(25,5);
}
Else
{
    value = value + wiggle(25,5);
}

 


When I run this, I get the error:

 


After Effects warning: Function If is undefined
Expression disabled.

 

Error occurred at line 3.
Comp: 'main'
Layer: 1 ('Date Stamp')
Property: 'Position'

 


I have been racking my brain over what the problem is.  I have used If/Else statements in the past successfully and I know that there is just something very simple that I am missing.  I have also tried using "== 1" instead of "== true", but I got the same result.

 

Help please.

How to get relative position of layer in larger precomp.

$
0
0

The Setup:

 

Comp 1 is 2000x3000 pixels. Comp 1 contains Layer X that is positioned at 1750,1250. (or whatever)

 

I pull Comp 1 into Comp 2 which is 800x600. I scale and move Comp 1 inside Comp 2 by an arbitrary amount.

 

How can I determine Layer X's position using Comp 2's coordinate space?

How to wiggle a layer on odd frame numbers.

$
0
0

Hello. I am using AE CS6. Now I am trying to make an cartoon animation, and now I am trying to wiggle some layers' position.

But I don't want to wiggle the layers on every frame. I want to wiggle them only on odd frame numbers.

I mean, I want to wiggle them on frame 1,3,5,7,,,,, but don't want to wiggle on frame 0,2,4,6,,,,,  .

I am not familiar with expressions, but is it possible to make such a expression? I don't know what to write in "If" clause of wiggle expression.

Please give me your advice. Thank you in advance.

Track nested child layer's position

$
0
0

Hi,

 

I have a Main Comp with a layer named 'Controller'.I have several 2d layers parented to this controller.

Now,i need to precompose two of them.let's say this precomposition of these two layers is named 'precomp 1'.

How can i parent these two layers in the 'precomp1' to the 'Controller' in the Main Comp again via Expression?

 

Dan,any ideas?

Viewing all 47983 articles
Browse latest View live


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