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

Offsetting time and position of several layers relative to preceding layer

$
0
0

Hello -

 

Pardon the newbie questions, but I've keyframed 'Black Solid' moving along the x axis and basically would like to duplicate the layer (perhaps with a new color) several times so that each 'new layer' follows the previous layer and offsets itself a certain amount of pixels...say 20px for example.

 

I found a simple expression that I applied to the first dup'd layer and it works fine but I can't figure out where to tell it to offset 20px to the left of the main layer.

 

thisComp.layer("Black Solid 1").transform.position.valueAtTime(time -.1);

 

I suppose I'm trying for a cascading effect + offset.

 

Thanks!

gj


Visualising audio as analog VU meter

$
0
0

Hey,

 

So I'm kinda new to AE, but I know enough to get around so that's clear now.

So I'm starting up a YouTube music channel and I'm trying to find out how to represent audio as an analog VU meter.

The image I am working with is below, and as you can see, it has 7 empty VU meters which I want to represent each track I have (7).

Does anyone know of how such thing would be done?

 

Thanks,

James.

 

background-VU.png

Creating a Sports Scoreboard Timer in AE

$
0
0

I have ventured Far and Wide to find the problem with an expression i am using. I am creating a Scoreboard timer for a Soccer game recently recorded. However i have met numerous problems with it. once i get to > 10 mins there is a zero constantly in the minutes column. i see the issues but im not sure what expression i could use to right the wrong. Any help would be greatly appreciated.

 

sec = Math.floor(time%60);

min = Math.floor(time/60);

if(sec<10)

{"0" + min +":0" + sec;}

else

{"0" + min +":" + sec;}

 

Thank you

Automat the Auto-Trace process

$
0
0

Hi guys,

 

 

I'm new on this forum and wanna ask you all, is someone knowing about a script or expression that will automate the process Auto-Trace (Alpha png to Masks) Without AE UI.What i mean is,

01_When I want to use .PNG image (Alpha) in Element 3d than i use auto track in AE.(suppose everything goes fine)

02_Next time if i change the source image (.png image which we used earlier).

03_And if I open the project again so now the mask comes in the shape of the new .png image.

 

 

I have given a link below to explain this process.

https://www.youtube.com/watch?v=-t5IbvGfWcQ&feature=youtu.be

 

 

Thank you

About JSX importing in AfterEffects 15.1

$
0
0

I've been importing json files with stringified javascript and evaled them in my comps to reuse scripts.

Since updating to 15.1 I get an error when I try to import them and as the error tells me, I renamed them to jsx files and it works fine.

 

I would like to know the specification of the imported jsx files. (Not the extended script jsx)

Are they just basically the same as imported JSON only with different file extensions?

I was hoping if I can write javascript directly without the hassle of having to stringify it everytime.

Are there any documents related to this?

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

Parenting Layer Positions - Can Variations Be Added?

$
0
0

If I parent one layer to a child layer, then the child layer will move exactly the same as the parent layer. If the parent layer moves 200 pixels to the right, then the child layer will move 200 pixels to the right.

 

Is there a way to vary the way the child layer moves? Say, a lesser percentage of pixels?

 

See below. The parent layer is the right pupil, and the child layer is the left pupil. Both pupils are centered, and look like they're in the right place.

Screen Shot 2015-01-05 at 10.45.10 PM.png

The right pupil parent layer moves to the right, and the child layer left pupil moves the same distance. It's starting to look wrong.

Screen Shot 2015-01-05 at 10.45.37 PM.png

The right pupil parent layer moves all the way to the edge of the eyeball. Now the child layer pupil has left the eye socket, and seems kind of other-worldly.

Screen Shot 2015-01-05 at 10.46.06 PM.png

 

Is there a way to tell the child layer to somehow move less than the parent layer? Say, 70% or 80% of the distance of the parent?

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.


How to get the footage's current frame number in expression?

$
0
0

There are 2 layers.One is text layer,one is sequence layer.

Footage has begun from the 20th frame.

Therefore, the number of composition's current frame number and footage's frame number has shifted.

 

I want to show footage's frame number in text layer . not composition's frame number.

How to get the footage's current frame number in expression?

 

 

Tatsuya

Is it possible to confine expressions to specific keyframes?

$
0
0

I am definitely a beginner when it comes to expressions.

I am currently using a "bounce" expression on the position parameter of some objects as they come on screen. However, the next time they change positions, I don't want them to bounce. Every time a motion tween ends in a static position, the position expression gets applied and the stuff is moving around.

I'd like to be able to keyframe the expression so that it worked only when on the keyframes that it makes sense to affect.

 

amp = .05;

freq = 1;

decay = 7;


n = 0;

if (numKeys > 0)

{

     n = nearestKey(time).index;

     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);

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

}

else

{

value

}

 

I got this script from somewhere online. The only thing I know how to manipulate are the initial values of amp, freq, and decay.

Move in x every [10] frames?

$
0
0

Hi!

 

Trying to figure out how out how to script this:

• Move an object forward in x every [45] frames the whole time of the comp. And no movement at all.


I tried doing this setup:

----------

length = Math.floor(thisComp.duration);

lengthFrames= timeToFrames(length);

cycle = lengthFrames/thisComp.layer("Null 2").effect("Value")("Slider");

tid = Math.floor(timeToFrames(time));

 

 

if (tid % cycle == 0) {

transform.xPosition +10;

}

----------

(I used a null layer with a slider for easier debugging and so I can change the value on the fly later.)
The equation results in 0 every 45th frame – which is good but the movement happens every frame. I can't figure out how to trigger a certain movement just on that occasion and nothing else!

 

Somebody in here that has a suggestion how to solve this?

 

 

 

 

Best

Expression disabled error !!

$
0
0

//The below script creates jiggle for keyframes in any property but sometimes

//results in attached error

//Can someone please help me with this

 

Thanks

 

n = 0;

if (numKeys > 0){

  n = nearestKey(time).index;

  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 = 2.0;

decay = 5.0;

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

}else{

value;

}

 

Thanks in advance !!

erro.PNG

Can't 'Save Animation Preset'

$
0
0

Hi,

 

I just wrote a series of expressions linking two text layers together along with controls on a null object, I'm trying to save it as an animation preset so that I can quickly reuse it in the future, however when I select my layers and go to 'Animation', 'Save Animation Preset', the option is greyed out.

 

Am I using the correct method?

 

Thanks

Expression apply on Y value only

$
0
0

xz.jpg

 

I have added an expression to a puppet pin so that this pin is parented with a Null. But is there a way to only parent the Y value with the Null?

I'm very bad with expressions so I don't know how to explain, but let's say..

Both X and Y values are red now, meaning they're both animated. But I want the X value to be locked, so that it won't be animated.

Change text colour with an existing slider control

$
0
0

Hi guys, I am making a 9:16 (vertical) graphics template themed with the logo and colours of the 20 teams of the English Premier League.  My expressions knowledge only goes so far as wiggle and a bit of pick whipping!

 

I am trying to make an essential graphics template so that the editors can use the slider to pick the team that they want to have as their on screen graphic in Premiere (rather than having to go into AE).

 

So far I have in my essential graphics tab the four lines of text, the slider, and a comment which tells the user which team is which number. The slider goes from 1 to 23 (20 teams plus three others).

 

 

Here is what that looks like:

Screen Shot 2018-02-05 at 10.27.04 PM.jpg

I have so far been able to use the slider to change the logo (by making all other logos 0% opacity), to change the name of the team (by making all other team names 0% opacity) and to change the background colours of the boxes.

This is the expression I used to do all of this. It is in the opacity setting for each object:

 

 

slider = thisComp.layer("Team Slider").effect("Slider Control")("Slider");

 

 

if (slider == 6) 100 else 0;

 

 

My problem is that I also want to be able to change the colour of the text when the slider is changed. Does anybody have any idea of how I can do this?

 

 

Below is the project file:

 

https://www.dropbox.com/sh/0yrknu66b8fjvcg/AADNJFMAoNLRlT7INQ1yh9rla?dl=0

 

Thank you!

 

David.


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.

 

animating a slider control where only last keyframe is the result of an expression

$
0
0

I apologize if this is an exceedingly obvious thing, but I'm having a hard time wrapping my head around how to do this. I'm importing data from a JSON file to drive a slider control animation. I want to choose the time on the time slider (with a keyframe?) where the slider control for a layer is set to 0.0, and then I want to choose a time on the time slider (another keyframe?) where my slider control will be set to a value pulled in from my JSON file.

 

So I want to manually set the first keyframe of an animation, but I want the last keyframe to be a value that is determined by an expression. I've had success pulling in JSON file data using expressions for other layers (changing "sourceText," for example), but the way to bring in the data so it defines a keyframe value is eluding me. I've searched the forum and looked at several different expression tutorials found through internet searches, but I'm not finding anything that addresses this particular question. Your help will be greatly appreciated.

 

Thank you!

Control two (X-)position keyframes while keeping the (temporal) interpolation

$
0
0

Hi, I'm a little bit new to expressions. After hours of googling trying and coding I gave up and try to get some help here.

 

 

I just want to keep my simple animation with the temporal interpolation. I only want to change with two sliders two keyframes. Is that somehow possible?? I found much codes for scale, opacity, and also some for position but none of these work for me

 

 

image_20180510150504_1.png

 

 

Thank you very much!!! I'd very happy if anyone could also explain the expressions to me!

 

 

Here are some of my tries:

 

{

  slider = key(1);

t2 = key(2);

t3 = key(3);

t4 = key(4);

 

 

 

 

  slider = comp("Comp 1").layer("txtlayer").effect("Keyframe Slider 1")("Slider");

slider2 = comp("Comp 1").layer("txtlayer").effect("Keyframe Slider 2")("Slider");

  t1 = [slider];

t2 = 960 = t3;

t4 = [slieder2];

 

 

}

 

 

 

 

// other expression now

 

 

 

 

if (numKeys > 1){

  t1 = key(1).time;

  t2 = key(2).time;

t3 = key(3);

t4 = key(4);

 

 

slider = comp("Comp 1").layer("txtlayer").effect("Keyframe Slider 1")("Slider");

  linear(time,slider,t2,t3,t4);

}else

 

 

valueAtTime(t);

Can you make an object follow a text length?

$
0
0

Can you make an object follow the end of a text? I need to make the green dot (look at picture) follow the end of the text. I want it to work, so no matter how long or short the text is, the green dot will continue to be the same distance from the text.

 

It sounds a lot like some kind of expression. But is it possible?

 

I use this template daily at work and would love to make an essential graphic. But right now I have to move the dot manually every time i write a new text or change the text.

The reason why it's not just a normal dot, is because the dot is animating.

 

Hope someone can help.
Thanks in advance!

 

PICTURE:

punktum.PNG

Limit Rotation Expression

$
0
0

Hi all. A (hopefully) quick question. Can anybody please advise on a basic expression to limit the rotation of an object when rotated manually. For example, so it can only move between 0-360, and no further in either direction?

Thanks in advance or any help!

Viewing all 47983 articles
Browse latest View live