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

Need help with an expression for unit conversion

$
0
0

Hello, I'm using an expression to have different counters for a display, and two of those numbers are a length measurement, one in feet and another in meters. I want to make it so that when I move the slider to add numbers to the one in meters, it converts automatically to feet.

 

This is the expression I'm using, which I found at CreativeCow.net:

 

numDecimals = 0;

commas = true;

dollarSign = false;

beginCount = effect ("Slider Control") ("Slider");

endCount = effect ("Slider Control") ("Slider");

dur = 0;

 

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

}

prefix + outStr + decimals;

}else{

prefix + s;

}

 

So on the text layer that has the feet value, I tried doing a whip to the Source Text field of the one that has the meters value, and add /3.28084 at the end, but it gave me an error. I added a = at the beginning, but it still gave me an error.

 

What would be the correct syntax here?

 

Thanks


Exponential Scale and Linear Move

$
0
0

Hello i'm trying to scale 2d layers exponentially. My problem — when I add 2 linear keys to move the layer — scale looks like bouncing. The expo scale code I found on adobe is <a href="https://forums.adobe.com/message/1899077">here</a>. My result comapred here: Project <a href="https://www.dropbox.com/s/41typw3o2zgsugw/Expo%20Scale.aep?dl=0">(CC)</a> or <a href="https://www.dropbox.com/s/gp0edzq00for54l/Expo%20Scale%20copy%20%28CS6%29.aep?dl=0">(CS6)</a> Please anyone help!<br> <img src="http://i1331.photobucket.com/albums/w586/amberija/Exponential-Scale-Half_zpsu5qfc4sd.gif" />

Time Remap expression not working when targeting parent.parent comp.

$
0
0

I created a character rig and I'm trying to set it up so most of the keyframing is done on the main comp instead of the sub comps. Most of the body is set up in the main comp except the head which is in its own sub comp. In this Head_Comp, i have two more sub comps, SideHead_Comp, and FrontHead_Comp. In both of these comp i have the head base, eyes, eyebrows, mouth, etc.   The mouth is in its own comp set to time remap from the head comps.

 

Quick Breakdown:

Body_Comp

          > Head Comp

                         >FrontHead_Comp

                         >SideHead_Comp

                                        >Mouth_Comp

 

What I'm trying to do is be able to animate the mouth comp from the main body comp. I've done this with the eyes and eyebrows using dummy objects on the main comp, but when I try to "parent" the time remap of the mouth comp from each of the head comps to a slider in the body comp, nothing happens. The mouth comp will take the current position of the of the slider value and that's it, it won't change if I move the slider around. I'm doing it this way to avoid having a bunch of different copies of the head comps when I'm animating different scenes. I'm not exactly sure what I'm doing wrong.

 

Here is the expression I used.

a=comp("Diane - AE Rig").layer("Body_CTL").effect("Mouth_Control")("Slider")

framesToTime(a)

 

I've tried different expressions, but all it does is change to the current value and thats it. It won't move when I move the slider.

 

Thanks for any help.

Math.sin(Math.PI) strange result

$
0
0

Hi,

 

In my AE expression Math.sin(Math.PI) gives a result of 1.22E-16, in stead of the expected zero.

Does anyone know why?

Can I Animate Individual Characters in a Text Block Using the Wiggle Expression?

$
0
0

I'm new to After Express and just diving in to expressions. I was trying to figure out if there was a simple way to use the wiggle expression in a way that it would wiggle individual characters in a text block independently of each other.

 

Definitely appreciate any help.

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

The expression "sampleImage" is making my comp unusable if the comp duration is over 2.5 minutes long

$
0
0

I am using sampleImage to extract the data from music and convert it to AE number values (captures the RGBA values from the area inside of a null on top of an audio spectrum). This allows me to automatically animate particles from Trapcode particular to any song. If you are wondering why I am not just using the Trapcode sound keys plugin... well it's just not as good in my opinion. Here's how I set up my expressions:

 

This is in the stopwatch of a slider on a null called "Final Output"-

 

p1 = toComp(effect("Point Control")("Point"));

p2 = toComp(effect("Point Control 2")("Point"));

w = Math.abs(p1[0]-p2[0]);

h = Math.abs(p1[1]-p2[1]);

a = toComp(transform.anchorPoint);

l = effect("Layer Control")("Layer");

m = effect("Mulitplication amount")("Slider");

s = l.sampleImage(a, [w/2, h/2]);

s[3]*m; ------------The final values is only between 0-1, so I have a multiplication slider to increase the values accordingly

 

From there you can pick-whip anything you want to these "Final Output" values, and it will be animated to the music. To keep the range of the values proportionate to the parameter I am animating, this expression is used on the parameter-

 

x = thisComp.layer("Range 1").effect("Final Output")("Slider");

linear(x,0,45,0.05,2);  ----- The parameter in the circumstance here can only be between 0 and 2

 

This setup works BEAUTIFULLY for roughly the first minute of the comp. Render times are extremely quick... but as soon as I change my work area to start a ram preview past a certain time (usually after the first minute), it is like my computer chokes and each frame takes about 5 seconds to render. Here is a short video of me demonstrating the problem. You can see the first 3 attempts are flawless, but the 4th at the 1:30 mark in the comp takes incredibly long to render. Also, the further down the comp I go, the longer it takes to render.

 

Note: There is nothing changing in the comp past that certain point. If I simply remove the expression and let the particles fly randomly, the ram preview remains lightning quick throughout 5 minute comp. Changing rendering engines doesn't seem to help anything.

 

Here is my specs:

Latest version of CC

Windows 8.1 pro x64

i7 4770k

12gb ram

EVGA GTX 760 SC 2gb

256gb SSD for Windows and apps

1tb SSHD for projects and cache

 

Thanks in advance!

Trigger sound from Expression

$
0
0

Hi, is it possible to trigger a sound in the project folder using expressions?

 

eg:

 

PlaySound('ding.wav');

 

Thanks


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.

Very long time remapping : Memory leak

$
0
0

Hi,

 

I want to submit what looks like a bug to me, publishing it here might help other who encounter the same issue.
If you have a very long composition in which you apply a time expression expression (scripting), depending on what is inside your expression, After Effects might try to fill the memory until you can't do anything and have to restart AE .

 

I have to precise my expression is quite weird but not very long to compute.

 

Antoine.

Expression to select all active audio layers?

$
0
0

I'm trying to get an Array of all audio layers in the current comp that are currently ON and in frame (ie. In point < CTI < Out point).

 

Any tips on how to do this with expressions?

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!

ease() vs eased keyframes

$
0
0

Trying to figure out the difference in values between the standard ease() and eased keyframes with default values of 33% influence. They're very close to being exactly similar, but aren't!

 

ease(time, 0, 4, 0, 1000) -- this seems to be a perfect cubic bezier curve, with handles of (0.33, 0, 0.66, 1) as defined by cubic-bezier.com. Have adapted existing cubic bezier functions to work as expressions, and the match is perfect. However, two keyframes, bezier interpolation, 33% influence out & in (on first and second, respectively) doesn't match above.

 

Exaggerating & displaying the difference between the values gives this:

ease-vs-keys-24fps.png

 

However! I have no idea what to do with this information. As you can see, the difference is miniscule, but it's certainly present. Can any light be shed on this?         

How Do I create a text selector effect with individual character starting from the center.

$
0
0

I have created text selectors with characters, but they always start from the left.   I have a link to a file which shows text forming from the center with a decay bounce that moves out towards both the left and right.  Is there an easy way to accomplish this?  The text in question is called "Danny Winokur" in the video.

Thank you,


Ira

 

http://www.mediafire.com/watch/x6exk3aqa9qtaoe/danny_winokur.mp4

AfterEffects Expression Text Row

$
0
0

Hello could some please help.

I have a single text layer with a row of numbers. I would like each number in the row to change after a set time. I would like each string to be different length as well.

 

Eample

(Row 1) 348920

(Row 2) 934

(Row 3) 9

(Row 4)4324

 

I would like to be able to change the number of rows and how long each sting can be (Set a Max & Min)

 

So in every 4 secs a new row would appear and the length of each row would be different.

 

I hope its clear, if not please let me know. I will try to explain it better if I can

 

Thanks for any help


Unfolding Effect

$
0
0

I came across an animation that depicts a series of diagonal lines unfolding like a fan. The artwork is simple enough but I wasn't sure how to build this in after effects and I wondered if there might be an expression to create this type of effect.  I appreciate any suggestions.  Here is the link below to the animation.

 

Ira

 

http://www.mediafire.com/file/36y0yi88mnh42vk/unfold%20effect.mov

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.

3D Corner Pin w/ Precomps

$
0
0

Hi everyone,

 

I've been using Dan's expression for getting the corner pin in 3D. But it's getting tough with the following setup:

 

  1. Main Comp
    1. Camera
    2. Precomp
      1. Camera (pick whipped position and POI with main comp camera and with the same settings)
      2. 3D Null
      3. 3D Null
      4. 3D Null
      5. 3D Null
      6. Solid w/ Corner Pin (using Dan's expression w/ nulls)

 

It all works perfect when:

  1. Both the main comp and precomp are of the same dimension
  2. The precomp's position stays centered

 

Now I can simply fix the first by calculating the offset and adding this to the expression, but the second is the problem. The calculation doesn't work, because of z-space. And by offsetting the toComp (toComp( [0,0,1500] )) it's hard to get right and leaves an apparent offset.


Any ideas for getting it spot on?

inertial bounce expression

$
0
0

hello everyone i have after effects cc and windows 8.

 

when i was on ae cs6 i used this expression and it worked perfectly

 

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

freq = 1.0;

decay = 5.0;

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

}else{

value;

}

 

now on ae cc it works for 1 minute and then this error pops up:    (in this case i applied the expression on the position of a null object with linear velocity)

 

 

After Effects warning: an expression was disabled as a result of an error.

 

Error at line 19 'Position' of layer 2 ('Null 7') in comp 'Comp 4'.

invalid numeric result (divide by zero?)

 

 

how can i fix this error? that expression was very very helpful!

 

thx!

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.

Viewing all 47983 articles
Browse latest View live


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