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

If Else issues

$
0
0

Hello,

 

Im trying to create an object that moves in the opposite direction and at 95% of the rate of an animated point.

 

I have set up sliders on my point with controls for both the X and Y axis - and am currently struggling to write the expressions for my object.

 

So far, I have:

 

X=thisComp.layer("CONTROLS").effect("Centre [X]")("Slider");

Y=thisComp.layer("CONTROLS").effect("Centre [Y]")("Slider");

if (X < 2500){

(thisComp.layer("CONTROLS").effect("Centre [X]")("Slider")*0.95);

}else if{

(thisComp.layer("CONTROLS").effect("Centre [X]")("Slider")*1.05);

}else{

2500;}

if (Y < 2500){

(thisComp.layer("CONTROLS").effect("Centre [Y]")("Slider")*0.95);

}else if{

(thisComp.layer("CONTROLS").effect("Centre [Y]")("Slider")*1.05);

}else{

2500;}

[X,Y];


Font Size Expression

$
0
0

I need an expression that would automatically change the font size based on how many characters are typed in.

 

The goal is to fit multi-line text into a bounding box as it's read from the external text file.

 

Does anyone know whether it's possible through an expression, or SDK by writing a plugin?  So far I was unable to find any info on this topic.

 

Thanks for any ideas.

3D WARP/3DBEND: geometry expression no show?

$
0
0

"3D warp" as seen on tv.adobe "What's New", does not seem to be available on my version of CS6 AE (from disk). I'm not getting the geometry option even though,I have the 3D box checked and it is a pixel based layer. I do get the other expression options such as transform and material options. Can anyone help me bend stuff?

controlling nulls with expressions

$
0
0

I am having an issue with an expression I'm working with.

 

I am trying to produce a dynamic graph (among other visualisers) that appears to be being controlled by a datastream - the artifical datastream is created by a handfull of sliders and a wiggle expression.

The graph is a simple line graph that works fine. This is created by following a null (MarkPos) that has its y position controlled by the master wiggle expression I mentioned before.

 

This next bit is where I am having problems:

 

I want to mark the lowest and highest points the line has reached on the graph by moving a dotted line, one for the low points and another for the high.

 

Just focusing on the bottom line;

I have the following expression attached to the line, that collects the current position of the null (MarkPos) and compares this with the current position of the line to see if it has moved any further downwards, if it has it moves the line to the new lower y pos. However, all that is happening is the line is following the null.

 

x = thisComp.layer("MarkPos").transform.position.valueAtTime(time)[1];

y = transform.position.valueAtTime(time)[1];

z = transform.position.valueAtTime(time-thisComp.frameDuration)[1];

 

if (x>y) {

[0,x]

} else {

[0,z]

}

 

After alot of debugging I now know the issue is with the else statement - all that its doing is offsetting the upwards movement by 1 frame - so how do you set a command of "keep your current y position" in this instance?

[0,1] just resets it to its start position, and its not possible to just have the "if(x>y){[0,x]}" bit without the "else {}".

 

Any suggestions fo how to fix this, or a better way to do it?

Fill Color Controller to change between colors overtime

$
0
0

Hi All,

 

I'm using CS6 AE..

 

I have created a clapometer style animation that uses a colour controller and value/numbers controller to animate the hand from left to right of a semi circle. As the hand moves (by a value slider) the layer underneath fills and I would like the color to go from yellow to red via multiple colors.

 

So far I have this code on my fill layer

 

l=thisComp.layer("Fill color controllers");

i=1;

colors=[];

try {

while(l.effect(i)) {

if (l.effect(i)(1).name=="Color") {

colors.push(l.effect(i)(1).value);

}

i++;

}

} catch (e) {}

if (colors.length) {

r=Math.floor(random(colors.length));

colors[r];

} else {

}

 

And a fill color controller layer with 5 different color expression controls. At the moment the code cycles through them randomly, but I would like cycle through the list. I know there are other ways I could do this but I am trying to improve my expression knowledge and hope someone can help me!

 

Cheers!

Expressions 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?

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.

How can I load external file .txt in After Effects CC 2014.0 Release / Mavericks OS X 10.9.4 (13E28)?

$
0
0

ello everybody.

 

Someone can help me to load a external file .txt in After Effects CC 2014.0 Release / Mavericks OS X 10.9.4 (13E28)?

 

I tried the code bellow, but doesn't work.

 

try{

myPath = "~/Desktop/source.txt";

$.evalFile(myPath);

eval(thisComp.name)[0];

}catch(err){

"MISSING";

}

 

The source.txt file have the texts bellow:

 

var comp1 = ["Title”, “Subtitle”, “Description”];

var comp2 = ["Text 0", "Text 1", "Text 2"];

var comp3 = ["Text 0", "Text 1", "Text 2"];

 

Thanks.


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

Using Audio Properties for Expressions

$
0
0
I want to use the audio layer's waveform properties to control Expressions. For example, I want the size of the waveform to change the size property of another layer (or rotate etc.). I can't get the pickwick to attach to the wavefrom, so I put the Waveform Spectrum Effect on the layer to see if I can link to the changes inside the effect. But, when I pickwick to height for example, it changes to a new size but doesn't change as the waveform height changes the way I want. Any help would be appreciated. TY

Loop Out Stop expression

$
0
0

I was wondering if it's possible to create a stop/smooth ending to a LoopOut expression on Rotation and Position keyframes.   I am currently using OSX 10.9.3 After Effects CS6 and I have tried a couple of things that haven't worked for me.

 

adding a checkbox expression control to the layer and an expression for loopOut()

 

if (effect("Checkbox Control")("Checkbox")==true){

loopOut();

}else{

value;

}

 

 

loopOutDuration(“cycle”,2)

 

Unfortunately neither of these seems to work.  I was wondering if someone had a solution they have come across.

 

Thanks very much

 

Ira

linking precomped wheel rotation to position in another comp

$
0
0

Hey guys,

 

I suck at expressions, but I think one would really help me here.  I have a car driving, part of a complicated precomp, and i want the wheel rotaion in the precomp to rotate according to the position of the car in the master composition.  I've seen a few link-rotation-to-position scripts but can't find one that i can figure out how to alter in order to make it work. 

 

Hope someone can help, and apologize in advance if this is well worn territory.  I tried a search but could have easily not used the right key words.


Thanks in advance,

Mike

Why does this expression not work as I'd hoped?

$
0
0

I have a Black Solid 3 with a CC Particle World placed within it. I have some particles set up to run at 0.01 velocity outward from the center of my composition. I've put the following expression on the Velocity setting:

 

value = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");

if (value > 50) 20 else 0.01

 

The Audio Amplitude layer it is linked to is a auto-keyframe layer created from a .mp3 file - the values that it hits during the most intense part of the song range from 1 to around 85-90.

 

Why does my velocity setting remain at 0.01 consistently, despite it being clearly evident that the Audio Amplitude layer is going far over 50.

 

P.S.: If I change the > sign to a < sign, it stays at 20. Why?

 

EDIT: Okay, it seems the issue was having the variable named as 'value'. Now that it works, it still doesn't seem to work as intended - I'd wanted the particles to move very slowly outward, and then whenever bass was detected, to speed up, until the bass was no longer detected, in which case it would return to a slow pace again, anyone have any idea how I'd go about doing this?

 

Message was edited by: James Wingate

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

Expressions in different compositions.

$
0
0

I am using pre_composed object in different compositions (A,B,C). Each compositions have their own camera in it (active camera). I am applying the expression bellow to rotate my object with the camera.

 

value+lookAt(comp("A").activeCamera.toWorld([0,0,0]),position)[0]

 

Everything works as I expected, but I can't use the same expression in the same object to work with comp B and C. Is there any way around this problem?


Expression at a specific time

$
0
0

Hi,

 

when I apply an expression it starts from the beginning of the composition, but if I want to start it, for example, after 10 seconds, how can I?

 

Sorry for my english.

Expressions by Accident

$
0
0

So I'm working along on a composition, nothing fancy. NOT using any expressions, at least on purpose. Moving layers around etc. I think I was moving several layers forward or backwards in time.

 

Then I go to change some Transform parameters and they're red and can't be changed. I twirl down and find each Transform parameter has an expression similar to this

 

comp("Demaria_rev1").layer("AA188202.MXF").transform.anchorPoint

 

Question 1, how did this happen? Whatever I did it applied to many layers, I think at one time. It also happened to Effects such as Keylight where parameters such as Screen Gain had this

 

comp("Demaria_rev1").layer("AA188202.MXF").effect("Keylight (1.2)")("Screen Gain")

 

I have no idea what I did to get all these expressions - it doesn't seem like they do anything either but maybe I'm missing something. It just seemed to lock up certain parameters.

 

And question 2, is there a way to globally remove the expressions? Reset doesn't seem to do anything and manually going to each one is time consuming.

 

Any info is appreciated.

 

Thanks

Analog Clock

$
0
0

Hi,

Im making an analog clock with a minute, second and hour handle.

hey shall rotate properly relative to each other. Its my first time using expressions and Im a bit lost. I want the time to speed really fast, for so slowing down and stopping completely.

Right now Im using this on z rotation:

time*5 on the hour handle

time*60 on the minute handle and

time*720 on the seconds.

 

Please, If someone could help me with accomplishing this I would be so grateful.

Varying Speed Of Fractal Noise Ocean Waves With Expressions

$
0
0

Hi,

 

Possible Noob question:

 

I've been following:

  http://allbetsareoff.com/2009/06/ocean-water-effect/

 

The video results are here: http://vimeo.com/5384704

 

He uses the Fractal Noise plug-in to make the water and the sky. Starting at 9:45 or so he talks about using an Expression in the 'Offset Turbulence' to create a certain 'speed' of the water.

 

Programming variables I understand, but I am a total noob when it comes to AE expression variables. The expression he uses is:

 

X = effect("Fractal Noise")("Offset Turbulence")[0];

[X, time*190]

 

So it seems like varying the number 190 increases or decreases the speed of the waves.

 

What I would like to do is have the speed -accelerate- over time. The entire video is going to be prox. 3:25. I was hoping there was something akin to keyframes I could use to make it -very- slow in the beginning, then at a certain point, quicken, then at another point -really- speed up and then finally, slow down again... independent of the sky.

 

If this is not easily done, I suppose I can render the sky and water separately and use keyframes in Premiere to speed up/slow down, but I figured I'd use this as a learning opportunity.

 

SO: Is there a way to assign a variable to that 'constant' value (190) which is based on the time position? Pseudo Code:

 

X = effect("Fractal Noise")("Offset Turbulence")[0];

[X, time* if(CurrentPositionInSeconds<200) ? 190 : 60]

 

Ideas?

 

TIA,

 

---JC

Triggering an opacity pulse from a marker on another layer

$
0
0

Layer 1 has several markers labeled "hit" as the marker comment. The name is important because I might add more markers to do other stuff.

 

Layer 2 is at 0% opacity by default.

 

Whenever the time indicator hits a "hit" marker on Layer 1, I want Layer 2 to go instantly to 100% (no fade-in) and fade back out to 0% over 2 seconds.

 

 

Does anyone have any idea how I would go about doing something like this?

 

 

So far I have something like this, but it only triggers on the first "hit" marker and ignores the rest:

 

 

if (thisComp.layer(1).marker.numKeys > 0 && time > thisComp.layer(1).marker.key("hit").time){
linear(time,0,2,100,0);
}else{
value
}
Viewing all 47983 articles
Browse latest View live