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

Expression Syntax

$
0
0

Hi,

how is the right expression syntax if i want to control only one value of a value pair (y position only) ?

 

I tried this :

 

xpos;

ypos = comp("Concept_01").layer("Control").effect("Y-Pos Sub-Title")("Slider");

[xpos, ypos]

 

but that gives an error and i don't know how to "not define" the x-pos.

 

 

Regards,

Frank


Disable expression error popup (AE)?

$
0
0

Hello,

 

It is possible to disable the error popup when editing expressions in After Effects?

I regularly want or need to click outside the expression typing box. When there is an error in the expression an error message pops up. It is getting annoying to click that away before I can continue.

Most of the time I know the expression is not correct, I'm just not finished yet. The yellow warning triangle is clear enough for me.

 

TIA

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

substring() not a function?

$
0
0

Hi!

 

trying to do the simple task of separating 6 characters (numbers) and adding a space after the first 3.


My script reads:

 

 

siffror = parseFloat(Math.round(thisComp.layer("Räknare Slider").effect("Slider Control")("Slider")));

s1 = siffror.substring(0, 3);

s2 = siffror.substring(3, 6);

"Co2 saved: " + s1 + " " + s2 + " ton";

 

it says siffror.substring is not a function.

 

What am I doing wrong here?

AE: Expressions - Animate position change of each layer from top to bottom?

$
0
0

So I just started using AE this week. I'm a super newbie. Any assistance you give me is appreciated, but should also be dumbed down so I can follow it.

 

I'm making these dungeon tutorial videos for Final Fantasy XV and I started working on the first project.
I spent about an hour making 1 table and animating it, and I will obviously be using this same table for every dungeon tutorial, but rather than copying and pasting every layer and making new compositions and yadda yadda, I started looking into expressions today to achieve this (I'm assuming simple) effect that I'm going for.

 

So essentially, picture this in your brain.
The dungeon tutorial is something you'd see in a strategy guide. The first 30 seconds of the video feature: The Treasure you will find in the Dungeon, the Monsters you will fight in the Dungeon, the name of the Dungeon, the Dungeon Level, etc. And each of these things I will need to be able to customize for future dungeon tutorials, so naturally I don't want to spend 8 years editing these things keyframe by keyframe, that's just madness. I'd rather play the game.


I have 1 Composition named "Treasure Overview"
And this Composition is made up of 14 Pre-Comps.
Each Pre-Comp is basically a row in a table.

 

So picture the table as such:

(Pre-Comp 1) TREASURESALE VALUE
(PC2) Earth Gemstone1500
(PC3) Beautiful Bottle120
(PC4) Strong Bone200
(PC5) Rough Scales250


etc...

Each Pre-Comp is comprised of 4 layers:
- text: TREASURE
- text: SALE VALUE
- background for Treasure
- background for Sale Value

 

Super easy, nothing fancy

 

For simplicity sake, let's say that the first row of the table is at position (0,0)
That would put row 2 at (0,1)
row 3 at (0,2)
row 4 at (0,3) etc

 

I want to animate the rows in the table using expressions. So that the rows basically unfold vertically.
They all start at (0,0) and end up in their final position (0,1) (0,2) (0,3), etc

 

SO FAR, the only thing I've managed to do is create an expression on each layer so that the Y position is offset by 38 (the height of each pre-comp)

 

y = thisComp.layer(index-1).transform.position[1];

[0, y+38];

 

this sets the y value for each row in the final position that it's supposed to be in, but I can't get it to animate in succession.
I've tried looking up tutorials using valueAtTime()

 

and that works... but not really. I'm clearly missing something, because I can't seem to specify both the POSITION AND THE "DELAY in animation"
every time i follow these tutorials I get errors upon errors when I try to adjust the tutorials to fit what im trying to do

 


I need something like (pseduo-code incoming)

 

thisLayer.transform.position[0, y+38].valueAtTime(time + 5);

 

Something that will let me specify the start and end position and the delay in animation
using an expression

How to Apply specific values to a Slider Control

$
0
0

I'm trying to have a Slider Control to scrub trough a specific list of values.

 

This is the list of values:
0.7
1.0
1.2
1.4
1.8
2.0
2.5
2.8
3.5
4.0
4.5
5.6
6.7
8.0
9.5
11
13
16
19
22
27
32
38
45
54
64

 

I want to connect the slider to a text layer and have the text display whatever the slider value is from the list above.
As you can see in the list above I want to be able to scrub the slider and have it only show those values.
One decimal place in the first few numbers and no decimal place in the rest as the list above shows.
I'm trying to figure out how to code this into the expression of the slider and the blue slider value as well.

 

Also, can a list of strings be applied to a slider to have the slider scrub trough the list bellow?

 

30"
4"
0"7
4
30
500
1000
8000

 

I want to connect this slider to a text layer and have the text be whatever the slider value is from the list above (including the quotation marks).

 

Thank you for your assistance.

Height of layer depending its scale

$
0
0

Hello everybody,

 

I'm working on a UI on After Effects and I want to automate it with expressions.

 

I'm kinda stuck right now. Here's my issue :

 

I have a shape layer (SL 1) whose scale is animated. Above it, i have an other shape layer (SL 2). I want the SL 2 to never cross the SL 1, I want it to slide along when the SL 1 is growing up (as in Apple OS Desktop interface toolbar).

 

For that, I want to get the height/width of my SL 1. I used sourceRectAtTime() but unfortunately, this expression doesn't considered the evolution of my scale.

 

Is there a way to get the height/width of a layer evolving as my scale is changing ?

 

Is there a "toComp" expression but for scale's values ?

 

Tell me if I'm not clear on my demand.

 

Thank you very much !

How to calculate the 4 corners of a text layer?

$
0
0

Hello

 

I need to know how to translate the size of a text layer to get the coordinate of his corners. My need is to be able , in an automatic way, to give a solid the size of a text. For exemple if i write a longer text, the solid increases his size.

I tried this expression but AE (10.0.1) notified me that the Source's function is not defined.

 

var r = thisComp.layer("Layer").sourceRectAtTime(0, false);

alert(r.top + " " + r.left + " " + r.width + " " + r.height);

 

Any idea?


Can`t access to gradient colors in shape.

$
0
0

Hi.

Trying to access to gradient colors using expression.

I thought that I can access to them using array, something like this:

 

thisComp.layer("Cubes").content("Group 1").content("Rectangle 1").content("Gradient Stroke 1").colors[0]

 

But it work only for colors[0], rest of them (color[1]. color[2]) doesn`t work at all.

 

Maybe there is another option how to access them?

 

Thanks.

Expression for image replacement depending on text layer text.

$
0
0

Hello, i wanted to ask is it possible to replace image in composition depending on text layer text. I.E. text layer contains code ##34 and expression tells what kind of image should be placed depending on if conditions in image expression.

Sincerely, Deimantas

Replace text from external source expression from AE CS6 not working in AE CC

$
0
0

We have used some expressions in an AE CS6 project to fill text from an external file. Here's an example:

 

try{

/* "mypath" must be absolute to data file */

myPath = "file:////nynfile1/Production/Egg/Marque/data.txt";

$.evalFile(myPath);

/* Use [0,1,2] for array offset value(Name, Date, Time)*/

eval(thisComp.name)[0];

}catch(err){

/* Display if data error found*/

"text not found";

}

 

 

It works fine in CS6. When we open the file in AE CC, the expressions can't find the data.txt file to pull text from. All we get is the "text not found" error. We stepped through debug and the data.txt file doesn't open/isn't found.

 

What up with that?

Number Counting Expression with $ - Understanding how to set stop points

$
0
0

Hello, I'm using an expression I found on: Dan Ebberts's Expressioneering Design Guide which has saved me quiet a bit of frustration since I needed to have a comma and a custom character at the end of my counting numbers. But I have a simple question that I can't quite get out of the page's instructions and I'm hoping someone here could direct me.


Issue: The numbers are counting for the first 4 seconds - or whatever I change it too, but I don't understand how to set my number stop points. ie, I want to go from 0 to 1,800 pause at a specific point for several seconds and then count up to 6,500 pause again and count up and so on. So the part I'm not understanding is, how to start the count and stop on a number and then start the count again. I've set key frames for where I want those numbers to be on the timeline in the 'Source Text' which Dan's page references but this isn't working. Thoughts? Direction??? Expression is below and I've attached a reference image of my timeline. Many thanks for any direction you can provide!


Expression:

numDecimals = 0;

commas = true;

dollarSign = true;

beginCount = 0;

endCount = 17000;

dur = 4;

 

 

t = time - inPoint;

s = linear (t, 0, dur, beginCount, endCount).toFixed(numDecimals);

 

prefix = "";

if (s[0] == "-"){

  prefix = "-";

  s = s.substr(1);

}

if(dollarSign) prefix += "±";

 

if (commas){

  decimals = "";

  if (numDecimals > 0){

    decimals = s.substr(-(numDecimals + 1));

    s = s.substr(0,s.length - (numDecimals + 1));

  }

  outStr = s.substr(-s.length, (s.length-1)%3 +1);

  for (i = Math.floor((s.length-1)/3); i > 0; i--){

    outStr += "," + s.substr(-i*3,3);

  }

  outStr + decimals + prefix;

}else{

  prefix + s;

}

ref.jpg

Why do I need an expression to Scale X/Y independently?

$
0
0

Scale is what... the 2nd or 3rd most used form of motion?

 

So why do I need an expression (and a **** tonne of googling) to find out how to link the X or Y scale of an object independently to a slider?

 

Why doesn't each of the two scales (X/Y) have the ability to simply be pickWhipped to a Slider or any other form of controller?

 

Would make sense, surely. And save newcomers a world of time.

 

UPDATE: Part 2 of this question:

 

If this works:

[temp, temp]

 

then why can't this work?

[temp, value]

 

Would this also make too much sense?


Surely it would be far more logical than this nonsense:

[temp[0], value[1]]


After Effects Universal Expressions

$
0
0

1. What are universal expressions?

  • I want examples of applications of universal expressions and how to identify non-universal expressions.


  • When my project use non-universal expressions, I can use a plugin called "ExpressionUniversalizer 2" to support all languages.

2. But there's another way to get the result of transforming the non-universal expressions in universal without use the plugin?

 

Please provide me all possible details.

 

I need to create a template that uses expressions and need that the template supports all languages.

 

Thanks!

Offset Color Control keyframes across multiple layers

$
0
0

I've got an array of layers with a tint effect, the parameters of which are linked via an expression to a Color Control knob on an adjustment layer in the same comp. I'd like the different layers to respond to the keyframes on the Color Control with offset timing.

 

So when I change a color on the adjustment layer, I'd like all the linked layers to respond at different times (+/- 5 frames or so).

 

Any thoughts on how to achieve this?

 

Thanks!


Is there an AE expression I can use to randomly exchange the positions of several equally sized layers?

$
0
0

Hi, I am a beginner in expressions in After Effects, I am working on an animation in which I have a small grid of images (each one on a separate layer) and I would like to have them randomly and quickly exchange positions while staying within the structure of the grid. I was able to use an expression to randomly turn them on and off but I would like to additionally have them exchange positions. This is beyond my capabilities. Does anyone have any suggestions on how to do this with an expression?

Expression on checkbox to control opacity of other layers

$
0
0

I'm making a template with multiple color schemes, and I'd like to work backwards a little:

 

Typically when I make a template, I'll have a pre-comp with multiple background layers in it and I'll use a Null in my main comp with an appropriate amount of Expression Control checkboxes to control the respective BG layers' opacities – pretty normal stuff.

 

The downside is that if I want to reuse this background layer in different comps I have to duplicate it and change the expression to match the location of the null each time it moves.

 

I'd like to work backwards (if possible) and instead apply an expression to the checkbox itself that references a single BG precomp. This way I can copy the null to my 20 different template comps, while the expressions always reference a single pre-comp, thus enabling me to simply copy the null from one comp to another without ever having to change the expressions.

 

Is that possible?

haw use 2 code loop and code motion2 ?

$
0
0

hello
help me

haw use 2 code loop and code motion2

example

motion 2 script

try {

 

  amp = effect("Rotation - Overshoot")("ADBE Slider Control-0001") / 2.5, freq = effect("Rotation - Bounce")("ADBE Slider Control-0001") / 20, decay = effect("Rotation - Friction")("ADBE Slider Control-0001") / 20, n = 0, 0 < numKeys && (n = nearestKey(time)

            .index, key(n)

            .time > time && n--), t = 0 === n ? 0 : time - key(n)

        .time, 0 < n ? (v = velocityAtTime(key(n)

            .time - thisComp.frameDuration / 10), value + v / 100 * amp * Math.sin(freq * t * 2 * Math.PI) / Math.exp(decay * t)) : value;

 

 

} catch (e$$4) {

    value = value;

}

 

and use loop code

loopOut(type = "cycle", numKeyframes = 0)

expression problem with CC 17

$
0
0

Hi guys,

I found an error in After effect expression. Actually I built a project using some expressions and I surprised that the project is not working with AE CC 2017 and 2015 but it's work fine with AE CC 2014 for same project.

Any idea about this issue or shall I report that to Adobe?

 

Here the project built in CC14. and you can check with two versions.

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?

Viewing all 47983 articles
Browse latest View live


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