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

Fade out on every keyframe

$
0
0

Another newbie question.

Tried this expression on a layers opacity:

 

d = Math.abs(time -transform.position.nearestKey(time).time);

easeOut(d, 100, 0)

 

The idea was to make the layers opacity go from 100% to 0 on every keyframe.

 

What actually happens is the opacity goes down to 36% in the middle between two keyframes, then goes up to 100 again.


Numbers expression - add letter "B" for billions

$
0
0

I have a question for Dan Ebberts.   Dan, the expression you have for a text layer for  numbers (see below)  I wanted to see if it's possible to add a letter at the end of the expression such as the letter B to represent Billions so that the final number count would be $1.7B.  I appreciate any help you can provide

 

Best Regards

 

Ira

 

numDecimals = 1;

commas = true;

dollarSign = true;

beginCount = 0;

endCount = 1.7;

dur = .5;

 

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

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

  }

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

  }

  prefix + outStr + decimals;

}else{

  prefix + s;

}

Linking expressions to central Controller

$
0
0

I'm trying to link up my expressions to one central Controller layer so that that one expression is shared across all objects in my project which require it.

I have "// Controller" composition with "Expression_Source (tK-logo_anim)" text layer. Its source text expression is set to my desired expression:

 

sourceLayer = comp("Killers logo (test)").layer("tK-logo_anim_mask");

sampleSize = [1,1];

samplePoint = transform.position;

color = sourceLayer.sampleImage(samplePoint,sampleSize);

x=color[0]*100;

[x,x]

 

Now, another composition includes a shape layer with its Transform Expression: Scale set to:

 

eval(comp("// Controller").layer("Expression_Source (tK-logo_anim)").text.sourceText.toString())

 

But when I try to hit enter on this line of code I get error: expression result must be of dimension 2, not 1


What am I doing incorrectly? The expression works when inserted manually into the Scale property but not when I try to link to it...

Thanks

color corrupt now on all Adobe after effects video after editing one video

$
0
0

I was working on a video the title was purple and green and after editing using this theme all of my videos that I have edited in After Effects are all colored green and purple. I don't know how or why but it is not my video card because videos I have saved on DVD or videos on youtube work just fine. I am at a loss. Can any one help???

Comp Markers to Time Remap?

$
0
0


Hello,

I'm in need of an expression  whereby a marker value in one comp will drive/equal the time remap value of another comp.

as an example:

Within a comp (MarkerComp1), I have a layer (MarkerLayer1) in which the comp marker value is set to 20
In my second comp (TremapComp2)  I have a Time remap layer (TrmapLayer2) in which I would like this to equal 20 as well.

 

Can this be done?

Thanks for any help

Jeff

Storing a position value from the previous frame

$
0
0

Hey guys,

 

So, I'm trying to assign the X value a null object had at the previous frame so I can continue to subtract a number from it cumulatively. I'm trying to assign it to a variable (prevframe). I'm not sure where I'm going wrong, but the line I'm trying to do it on is written as follows:

 

prevframe = transform.xPosition.valueAtTime(time-(1/24))

 

So in my mind, this should be taking a look at the value of X on the null, then looking back in time to figure out what it's value was on the previous frame (my frame rate is 24, so I'm dividing 1 second in to 24 pieces and telling it to subtract that much from the current time), and assigning whatever that returns to the variable. But it's just returning a static value, even though I'm subtracting from it. I feel like it's not the correct syntax, but I really have no idea.

 

I want to continue to subtract a value which is based on the velocity of another object from this, which I have worked out, I just can't figure out how to reference what this nulls X position was in the previous frame so it always returns the same value until all motion has stopped. The formula the variable is being run through looks like:

 

finalposition = prevframe - camvelocity

 

Which is then assigned to the final X position of the null object.

 

So, I'm not sure where I'm going wrong. I hope I've provided enough information to help someone wrap their head around this and hopefully help me solve it.

 

Thanks in advance,

 

-Seth

After Effects Expression deactivate layer if in comp

$
0
0

Hi guys,

I am currently working on a huge animation with lots of comps. I have certain animations, that are used several times, but I don't want to duplicate all the comps and I am trying to figure out a more elegant way to use those comps.

 

Is there an expression, something like (" if layer in pre-comp1 is nested in comp2, then opacity=0", or something like that),  to deactivate certain layers if they are nested in a certain comp?

 

Thanks in advance!

Parsing number text string to numeric value

$
0
0

If I have the number "5" as a text layer, how can I get another text layer to read that number, and then add another number to it?

 

This gives me "56". I want "11".

 

temp = thisComp.layer("5").text.sourceText.value;

(temp + 6)


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?

aftereffects expression BUG. cannot compare the values of 2 sliders???????

$
0
0

so do this:

make a new comp with a new solid.

add 2 slider effects to the layer.

add an expression to the Opacity of the solid, add this tot he expression:

 

// begin expression

if(effect("slider_01")("Slider") == effect("slider_02")("Slider")){

100

}else{

0

}

// end expression

 

then try setting the values of the sliders to be exactly the same. IF they are exactly the same, the solid should be visible.

they NEVER evaluate as true. Which means this is a bug, no?

how to parent a layer on a negative x,y position value ?

$
0
0

Hey there i have a composition with 2 text layers on it one is scaled -100 on the y  axis to get a reflection effect

and i added a wiggle expression to the the upper layer and i want the reflection layer to have the same moment as the upper layer  but on a negative x,y direction.

expressions - best practice for duplicating layers

$
0
0

Hello,

 

I have a fairly complex set of expressions on multiple layers.  These layers together make up an overall effect for a piece of footage.  For convenience I have these expression linked to a controller null object so I can control them from one place.  Now that I have it set up, I want to duplicate the group of layers (footage item, various effects, and null object controller) multiple times.  I basically have a template for a footage effect that I want to duplicate multiple times so I end up with many pieces of footage with this effect applied.  When I duplicate the group of layers, I'd love to set it up in a way that the  expression variables will now point to the duplicated controller object.  I noticed this behavior happens if the expression is a simple pick whip from one property to another.  Basically a direct connection.  But if I attempt to store this pick whip selection in a variable to be manipulated further, this functionality ceases.  So my question is, how can I create a set up that will permit me to duplicate layers and have the expressions update as if they were a simple direct pick whip from one property to another?  Is this possible?  If not, how can I better set this up to allow me to accomplish my end result?

 

Thanks!

 

-Justin

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

Basic Offset Expression

$
0
0

I pick-whipped the position of a particle to the position of an object. (Particle Playground)

 

Everything works but i need to offset this position -300px x 170px.

Is there something i can add to this expresion that will allow that?

 

Also, Particle Playground does not seem to have a life of particle setting. Is there any other way to extend this?

 

AE cs5

Layer Source Text linking to external text. (no code in doc!)

$
0
0

I've seen linking to text documents with code snippets in it.

So that means the external text document must contain bits of scripting.

 

I would like to link to txt documents (or csv) that do not contain code.

Total noob users must be able to link a text to a After Effects project.

 

I have a website data catcher which exports CSV values.

It would be ideal if After Effects can hoover up the text and put certain pieces into certain source texts.

 

We're talking automated sports cards here.

 

Is this possible without adding code to a text dump?

Or is this just impossible?


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.

Set inPoint with expression?

$
0
0

Hi,

 

Is there some way to set the in and out points of a layer in an expression?

 

thisLayer.inPoint seems to be read-only...

 

Thanks,

 

S

How do I script a certain layer to rotate slightly based on movement?

$
0
0

Hi guys,

So I'm trying to script partial rotation of a vector (a plane) so that as its moving either up or down it rotates slightly (by about + or - 30 degrees) and once it has reached it desired position it goes back to an orientation of 0,0,90 which is the start orientation. Anyone know how to do this or I simply have to keyframe every action?

Scale over time expression

$
0
0

I'm trying to have an element scale up and do so through an expression:

 

startScale = 100;

endScale = 300;

scaleUpTime = 5;

 

s = ease(time, inPoint, inPoint + scaleUpTime, startScale, endScale);

[s,s]

 

 

This works but I'd like to modify this is that the endScale is actually a random number between 100 and 300.

I'd also like the whole thing to trigger at a specific time (or frame).

 

I tried random(100,300) but it gives a jittery result not a constant scale up to a random value

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

Viewing all 47983 articles
Browse latest View live


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