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

Time Remap Expression

$
0
0

I'm trying to do trigger a keyframe for a timeremap using an expression as follows, but after I put in the expression the output goes black:

 

 

  • Did a timeremap on the precomp.
  • Put in two keyframes. One where I need the comp to start, second where it ends.
  • Then I used the following expression:

        clockStart = parseInt(comp("main").layer(5).text.sourceText.value); 

 

        t = linear(time,0,clockStart+1,0,key(1).value+time);
        valueAtTime(t);

 

clockStart here is basically where I want the composition to trigger In. So my first keyframe.value is 14, Second keyframe.value is 20. If my clockStart is 10. At the start of the play the value of the timeRemap for this layer/comp is set to 14 (first keyframe value). Then when it plays, and clockStart reaches 10 then the timeremap start's counting in from 14 onwards until the second key frame (value is 20). This seems to work as I want but the issue is the output goes black I don't have any output while the expression is enabled on the time Remap. I tried looking for other properties like opacity but all are set properly and opacity is 100per. THe moment I remove the expression I have output on it. What can be wrong with this expression ?


Expressions which were working fine are now crashing AE CC every single time.

$
0
0

Hi,

 

Last week I was working on a showreel template for my company and I incorporated a few expressions and sliders to try and minimise the amount of work required to add new content.

 

These expressions were working perfectly together and now after the weekend the file seems to be broken. Every time the file crashes I get this message:


"A copy of your project was saved at: XXX.aep

Last log message was: <140735177282320> <ae.blitpipe> <2> Making New Context

Generating crash log, which may take a few minutes."

 

It crashes on startup with the original file. The duplicate that AE created only crashes when I re-enable 1 of 2 of the expressions which it automatically disabled. The expression that seems to be the problem is:

 

startX = transform.anchorPoint[0];

startY = transform.anchorPoint[1];

endX = transform.xPosition;

endY = transform.yPosition;

differenceX = startX - endX;

differenceY = startY - endY;

sliderVal = thisComp.layer("Guide").effect("Blackout, Blur etc")("Slider");

currentValX = startX - differenceX*(sliderVal/100);

currentValY = startY - differenceY*(sliderVal/100);

[currentValX, currentValY, 0]

 

I hate to just copy and paste everything in here but I am completely baffled by this and After Effects offers no clue as to what the problem is. If anyone can shed some light on what the issue may be it would be much appreciated.

 

Thanks,

 

Liam

 

---------

 

Hardware Overview:

 

  Model Name: MacBook Pro

  Model Identifier: MacBookPro11,3

  Processor Name: Intel Core i7

  Processor Speed: 2.5 GHz

  Number of Processors: 1

  Total Number of Cores: 4

  L2 Cache (per Core): 256 KB

  L3 Cache: 6 MB

  Memory: 16 GB

  Boot ROM Version: MBP112.0138.B07

  SMC Version (system): 2.19f7

  Serial Number (system): C02N6C3GG3QD

  Hardware UUID: 241E1179-D911-50CA-96DB-618E6F815FEE

 

 

System Software Overview:

 

  System Version: OS X 10.9.4 (13E28)

  Kernel Version: Darwin 13.3.0

  Boot Volume: Macintosh HD

  Boot Mode: Normal

  Computer Name: Liam’s MacBook Pro

  User Name: Liam Owen (liam)

  Secure Virtual Memory: Enabled

  Time since boot: 5 minutes

loopOut() Cycling/ping pong expression driven effect

$
0
0

Hi!

I like to loop this expression so it ping pong back and fort thru the timeline.

Is it possible to combine these two expressions? If, what's the correct sythax?

effect("Radial Wipe")(1) and loopOut("pingpong")

Fade audio with expressions

$
0
0

Ok, I've taken an epxression for automactically fading opacity (which worked wonderfully) and tried to modify it to fade audio the same way.  Now, I get an error that says "After Effects warning: Expression Disabled. Error at line 0 in property....  expression result must be of dimension 2 not 1."

 

Here is the tweaked expression:

 

fadeTime = 30;

audio.audioLevelsMin = -50;

audio.audioLevelsMax = 0;

layerDuration = outPoint - inPoint;

singleFrame = thisComp.frameDuration;

 

animateIn = linear(time, inPoint, (inPoint + framesToTime(fadeTime)), audio.audioLevelsMin, audio.audioLevelsMax);

animateOut = linear(time, (outPoint - framesToTime(fadeTime+1)), (outPoint-singleFrame), audio.audioLevelsMax, audio.audioLevelsMin);

 

if(time < (layerDuration/2+inPoint)){

animateIn;

}else{

animateOut;

}

 

Now, opacity is a linear, 1 dimensional characteristic.  Why did that work and the updated expression for audio cause an error?

time offset path driven by nulls

$
0
0

Hi! I would like to make different shapes to be driven by the same nulls using the ".valueAtTime(time-x)" expression.

Where should i use the time offset value in the path expression?

I used it in anchorPoint.value but i get no delay. The shape look the same like the one without it.

Let's say i have this expression on a path driven by 10 nulls:

 

var nullLayerNames = ["Shape Layer 1: Path 1 [1.1.0]","Shape Layer 1: Path 1 [1.1.1]","Shape Layer 1: Path 1 [1.1.2]","Shape Layer 1: Path 1 [1.1.3]","Shape Layer 1: Path 1 [1.1.4]","Shape Layer 1: Path 1 [1.1.5]","Shape Layer 1: Path 1 [1.1.6]","Shape Layer 1: Path 1 [1.1.7]","Shape Layer 1: Path 1 [1.1.8]","Shape Layer 1: Path 1 [1.1.9]","Shape Layer 1: Path 1 [1.1.10]"];

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.valueAtTime(time-. 16))); 

    }}

createPath(origPoints,origInTang,origOutTang,origPath.isClosed());

global array variables? , transfer data from one layer expression to another

$
0
0

hi i have arrays in expression, but i have a problem, every time when i move effect point control(i need move it for my task)  array update and erasing, but i need to save data from previous array state

 

 

i add this expression to text layer on Source text

//create array

var arrayX = [];

var arrayY = [];

//add data to array

arrayX.push(12);

arrayX.push(232);

arrayX.push(2424);

arrayY.push(0);

arrayY.push(322);

arrayY.push(122);

text_cur_layer = text.sourceText;

//final result

text_cur_layer ="Array_X= "+arrayX.join( ', ' )+"\r"+"      Array_Y= "+arrayY.join( ', ' );

 

 

expression return 

in array x must be (12 232 2424)

in arrayY  must be (0 322 122)

 

 

so every time when i change state on effect "point control"(slider control and etc) this expression updates and give me always same numbers, from this commands^

arrayX.push(12);

arrayX.push(232);

arrayX.push(2424);

arrayY.push(0);

arrayY.push(322);

arrayY.push(122);

 

 

it happened because i create array every time with

var arrayX = [];

var arrayY = [];

i think this commands erasing all data from array and create new clean array, so i need some how save previous data...., in AE script i can do that with creation array

globally for all functions, but don't know how  do this in expression

 

 

 

 

also i think it can be done with transfer data from array to string and save this string in another layer and then get this data after array creation, but i don't know how i can save array string data and export this string back?

 

 

example

 

 

var arrayX = [];

var arrayY = [];

//try import previous data back(i don't know how do that, just using standard java code..)

//and now i need get data from strX strY from save place and chekc it later

if(strX!=null && strY!=null)

{

arrayX=strX.split(',');

arrayX=strX.split(',');

}

//add data to array

arrayX.push(12);

arrayX.push(232);

arrayX.push(2424);

arrayY.push(0);

arrayY.push(322);

arrayY.push(122);

text_cur_layer = text.sourceText;

//final result

text_cur_layer ="Array_X= "+arrayX.join( ', ' )+"\r"+"      Array_Y= "+arrayY.join( ', ' );

//get data to save

var strX = arrayX.join(',')

var strY = arrayY.join(', ');

 

 

and then i need some how save this strX and  strY  to save place

 

 

 

 

Sorry for bad English

Wiggle intervals?

$
0
0

Is it possible to set up intervals with expressions?  Such as "use expression for 1 second, then turn it off for 2 seconds, then use it again for 1 second, etc"

Animate a Blur Letter-by-Letter

$
0
0

So I've just learned about creating an expression selector, but I know absolutely nothing about writing code for expressions. What I want to achieve is this: I have a paragraph of text filling the screen; it begins all blurred and then unblurs one letter at a time until it reaches the end of the text.

 

I have the text layer, then I have the blur animation keyframed from (50, 50) to (0, 0) 5 seconds later. By just putting on an expression selector, I seem darned near what I need but the animation doesn't start with letter 1 blurred, it has already set the blur on character 1 to 0, progressing to blur of 50 on the last character. I need all of the characters to start at blur 50 and then start the animation from character 1.

 

The default expression for expression selector is "selectorValue * textIndex/textTotal." I believe I need some kind of offset so that it doesn't start the animation at the beginning of my composition. I'm not sure how to code that or even how to look up the code, though I'm pretty sure it's something ridiculously simple.

 

The next issue is I'd like the letters to go from 50 blur to 0 blur one at a time in the span of a fraction of a second. Is this asking for a lot of code? I looked at a tutorial covering this and it seems like a lot of code may be involved in that and maybe I'm out of my depth. I don't even know how to go about learning what code is needed for this.

 

Thanks for any help. I hope this is clear.


seperate XYZ error / ae_force_english.txt

$
0
0

Hi together, would be nice if anybody can help out.

 

I'm using AE CC with ae_force_english.txt and I'm recieving the error trying so seperate XYZ from an emitter.

 

"Error at line 1 in property 'Position' of layer 8 ('EmitterRadioSFX') in comp 'Main'. Function effect is undefined."

 

This is really confusing me cause normaly/in past I did'nt had trouble with seperate XYZ ...

 

Error_XYZ_trennen.jpg

 

Would be aprecicated if anobody can help me out there! Thanks in advance.

eval expression trouble

$
0
0

Found this cool expression trick reading input from a .txt file.

try{

myPath = "c:/path/to/my/file/testfile.txt";

myTime = Math.round(timeToFrames(time));

$.evalFile(myPath);

eval(thisComp.name)[myTime];

}catch(err){

"MISSING";

}

I would like the expression: eval(thisComp.name)[myTime] to be incremented on each frame.

Works like a charm when i manually enter a array index, but i cannot seem to get timeToFrames(time) to work in this case.

I have tried alot of variations but i can't seem to get it right. Anyone have any tips?

motion path cars to follow leader (null object) and maintain a fixed distance

$
0
0

I am trying to create a model of my local intersection where a car will ease to a stop at a red light and the chain of cars behind will follow and stop at a fixed distance behind the car in front.

 

I'm so close yet so far to the solution to this, I am still fairly new to expressions so I need a bit of help. I previously made a freeway with about a 1,000 cars by using a CG Snake tutorial by Jerzy Drozda Jr at maltaannon.com, but starting this next project I realized this method did not allow the cars to maintain a fixed distance.

 

I then read Dan Ebberts article "Creating Trails" of www.motionscript.com and found that Jerzy Drozda's method, while perfect for small projects, is problematic with a large amount of objects because it uses a "cascading" expression, where the expression in one layer refers to the previous layer which refers to the previous layer, etc. This can enormously increase the amount of work that After Effects has to do at each frame. I had first hand experience with this when I made my freeway. After Effects was nearly impossible to use because there was a 10 second lag after every click.

 

Which brings me to my current problem, getting this expression to work I have attached the file I am working on as a download link from my Google Drive here

 

Here is the original formula from motionscript.com - if you want to see his guide just search "//start time of template motion" in Google and click on this first link.

 

I have tried so many things with this expression but the dam car just refuses to follow the null object!

 

in Position property:

strt = 0; //start time of template motion

end = 4.0; //end time of template motion

 

t = thisComp.layer("template");

offset = (t.effect("offset")("Slider")/100)*(index -1);

travel = linear(t.effect("travel")("Slider")/100,strt,end);

t.position.valueAtTime(travel - offset)

 

in Orientation property:

 

strt = 0; //start time of template motion

end = 4.0; //end time of template motion

 

t = thisComp.layer("template");

offset = (t.effect("offset")("Slider")/100)*(index -1);

travel = linear(t.effect("travel")("Slider")/100,strt,end);

if (travel <= offset){

  vect = t.position.velocityAtTime(0);

}else{

  vect = t.position.velocityAtTime(travel - offset);

}

lookAt(position, position + vect)

Anyone got an expression for looping path keyframes?

$
0
0

Paths seem to be the only things you can't apply a loop expression to. Is there any other expression that will do the same trick?

 

I know you can precomp the layer and loop a time remap.

Or you could loop a slider which plays through the animation.

 

But i'm just looking for an expression to apply to the layer in question, exactly the way we apply loopOut expressions.

 

Thanks

Ross

move from one random position to another?

$
0
0

Hi,

this is probably simple for someone who knows how to write expressions better then I do. (I hardly do).

 

I want a Textobject to move from one keyframe to another. Both keyframes should get a random value. (first keyframe-Position somewhere in the upper part of the comp; second key-position somewhere in the lower part of the komp).


Please help. Thanks!

Limit value range with expression?

$
0
0

Hi there,

 

Is there a way to put a limit on value range when linking it to key-framed audio?

 

My situation is that I want to link the Glow Intensity of one of my objects to the key-framed audio. The issue I'm having is that everything north of 0.4 looks horrific.

 

So was wondering if there was anything I could add to the expression that will only allow the value of the Glow Intensity to vary between 0.0 and 0.4?

 

 

Cheers

Simon

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


AeRender does not recognize expressions in .txt files. How to solve this issue?

$
0
0

Hello. We're experiencing some problems with AE render engine. I searched this across the web but found no solution.

 

We're a large video publishing company and we publish same videos with changed texts on each one. To speed up process we created external .txt file so we can change the texts of AE project using expressions/codes in each text layer.

 

We add this expression into each text layer

 

try{

myPath = "text.txt";

$.evalFile(myPath);

eval(thisComp.name)[0];

}catch(err){

"text error";

}

 

and we add this text into the text file, which is located with AE project

 

VAR compname "text",

VAR compname "text".

 

Everything works great when we render our videos with After Effects, but when we try to render using AERENDER (which is much faster and easier for large number of videos), all expressions are getting disabled and we get videos with wrong text.

 

I wonder if there is a solution to render using AErender but make the expressions to work normally? We use After effects CS6 (this expressions does not work with CC at all)

 

Thanks a lot for your help    

loopOut expression - bug - please confirm

$
0
0

Can somebody try this and confirm I'm not crazy.

 

******BUG******

LoopOut and LoopIn do not cycle properly with Position property.

 

Steps to reproduce bug:

1. Create a composition at 960x540

2. Create a solid that is 50x50

3. On frame 0, keyframe the position of the solid at 540,500.

4. Copy that keyframe to Frame 1

5. On frame 5, keyframe the solid's position to 540,100.

6. Copy that keyframe to frame 6.

7. Add an expression to the Position property: loopOut ("cycle",0)

 

 

Results:  If you watch the position values as you step the frames, you will see the pattern keeps changing and is not a consistent cycle. Sometimes the 500 value is repeated, and sometimes the 100 value is repeated.  It is inconsistent.

 

 

Expected results: The position values should change following a fixed pattern and not vary after the final keyframe.

Text layer bounds expression problem

$
0
0

I was working on something with this, and funky stuff seems to happen when there's any lower case letter with a decender (qypj) the box acts kinda funny.

In this image[2] you can see I'm using it to center the anchor point, but the words on the left with the decenders think the text box is way bigger than it is or something and puts the anchor point up a bunch, also screwing up a beautiful set of expressions I had keeping those words in the boxes and doing all sorts of other exciting stuff.after effects.PNG

The expression: myTextLayer.sourceRectAtTime().height/2; 

(I'm only centering the y axis so pay no attention to the anchor point not being in the middle of the x axis)

This is the first time we've had this feature so maybe I'm missing something or it's a lil funky still? Any help would be appreciated!

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!

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