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

Baking Parented Motion into Keyframes

$
0
0

Hey guys!  I'm trying to stabilize a piece of extremely tricky footage.   The stabilization needs to be reversible.  Ordinarily this is easy... you just apply the tracking and rotation data inverted to a layer, and then you precomp the stabilized comp, and apply the non-inverted data to the precomp.  Voila!

 

However in this case, due to the trickiness of the stabilization, I've ended up with a chain of parented nulls, each with a combination of position, anchor point, and rotation data (some added manually, some imported from Mocha).  The result works, but reversing it in the traditional way is no longer possible.

 

I've thought of a dumb solution to this problem (more on that below), but what I'm wondering is whether anyone has a smarter solution.  Is there a way of using an expression to read the footage layer's objective position and rotation (taking into account the whole chain of parents)?   If so, then I could simply convert that expression to keyframes, and invert the resulting keyframes to get my "unstabilize" data out of my big mess.

 

I think this is what the toWorld expression is for in a 3D context, but using it is a little beyond me.    Does anyone have a good idea for how to fix this?

 

For the record, here's my dumb solution.  I'm hoping to avoid this:

Replace the footage layer with a grid. 

Render.

Import the rendered file into mocha.

Track the grid.


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

Waveform Expression Help

$
0
0

Hello,

 

I am trying to make the static waveform that is used on Soundcloud in After Effects at the moment and I have run into an error.  I was hoping you all would be able to help me debug (with my limited programming knowledge). I used a method from a website, which can be found here: CreativeCOW

(There is a syntax error which he points out later in the thread which I have fixed)

 

Here is the code that is causing troubles if you don't want to read the forum page:

 

lines = 100;

maxAmp = 18;

target = thisComp.layer("Audio Amplitude");

amp = target.effect("Both Channels")("Slider");

smpl = amp.numKeys / lines;

smplT = framesToTime((index - target.index) * smpl - (smpl / 2));

avg = amp.smooth(framesToTime(smpl)/2, smpl, smplT)

s = Math.min(100,linear(avg,0,maxAmp,0,100));

[100,s]

 

I get the error: "Bad method arguments: numSamples argument to smooth must be between 1 and 100 inclusive" Error at line 7.

 

Also, how do I find the maxAmplitude using "Both Channels" in the keyframe?

 

Any help is greatly appreciated! Let me know if you need any more info.

Ticking Clock

$
0
0

We have all seen the old clock rotation expression where you create a rotation for the second hand and then tie the minute hand to the rotation with an expression so that it moves at 1/60th the speed to simulate minutes and seconds right?

 

I am trying to create something similar but with a 'ticking' clock like a timex watch on the second hand so that it ticks along. tick, tick, tick, tick instead of the smooth rotation. I have worked that out using this expression tied to rotation:

 

var tick = time*6;

Math.floor(tick)

 

 

But what I want to happen is now to have the minute hand ( separate layer ) tick over 6 degrees every minute. In other words, it holds for 59 seconds and then jumps 6 degrees in 1 second.

 

I can't figure that part out. Any ideas?

 

Thanks

 

Jim

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

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!

Scripting /Expressions in AE: Similar to Flash/ActionScript?

$
0
0
I think about learning AE, but I would like to get an overview about the Software, so that I can decide if it's suitable for what I am planning to do.

I have little experience in Flash/ActionScript, but I can't get a picture what Scripting means in AE. Can this be compared to Script-Languages like ActionScript and Lingo?
And what is the difference between "Scripting" and "Expressions" in AE.

Thank's!

Roland

How to create a simple bobbing up and down motion expression?

$
0
0

Hi, I have a 3D object that I want to continuously bob up and down but I'm having trouble finding an expression to do this.

 

I would use wiggle on the Z except wiggle creates random motion and I need consistant up and down oscillations.

 

It seems simple but I can't figure it out... any ideas? Thanks.

 

-Pete


stroke width with expression

$
0
0

Hi, iam trying to set stroke width based on shape scale, (to maintain fixed stroke size) so ive used "(1/transform.scale[0])*500;" for stroke width expression, but this only works for either stroke width, or stroke height. What am i doing wrong? Or how can i apply ths to both stroke width and stroke height at the same time?

3 parameters to one expression

$
0
0

How would i tell 3 parameters to use a single line of code?

In this case the expresson is wiggle(x.x).

Creating a number counter that counts in increments of .05 in After Effects.

$
0
0

I need to create a number counter that counts in increments of .05 in After Effects.  Any advice on how to do this?

 

Many thanks!

walk cycle: how to avoid slipping legs?

$
0
0

hi

 

I wonder if there's an expression which would allow me to synchronize walking character's steps with its horizontal position? I animate two-legged character's legs for walk cycle, but when i animate the whole character's X axis position it's very hard to avoid its legs from skidding across the surface. any free or non-free plugin/expression for this?

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.

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!

Help needed pausing and resuming a wiggle expression

$
0
0

Hi!

 

I would like to create something but I don't know how to do that. Hopefully someone can help me out.

I am animating a kind of northern light effect with particles and a wiggle expression. At a certain point in time, I want to pause the wiggle effect and make some manual position changes (like a path that the light follows). After a couple of seconds I want to resume the wiggle effect again.

I found some posts about starting and stopping the wiggle effect, but not much on pausing and resuming. Any ideas?

 

With kind regards,

Koen


Can I write an expression to get a value from the comp you're looking at, rather than from one particular comp?

$
0
0

I know I can point an expression to a particular layer in a particular comp to get a value, eg. comp("OpeningTitle01").layer("TITLENAME").text.sourceText will get the value from the layer TITLENAME in the comp OpeningTitle01, but I want to make multiple comps (so I can add them all to the render queue at once) where each will change the value of the underlying comp.  Can this be done?  The comp where I will use the expression is nested about 5 levels below the top level, and I want to put the value in a layer in each of the new comps.  Any help is appreciated- thanks guys!

Smooth my wiggle!

$
0
0
Hey all!

I am wiggling a Null position as an emitter for Particular. However, the resulting wiggle is pretty jaggy.

I found Dan's smoothing function:
temp = thisComp.layer("Null 11").transform.position.smooth(1);
[temp[0], temp[1]]

But it only make my streaks smaller, not smoother. They are just as angular as before.

Photobucket

loopOut() script won't loop keyframes. Why?

$
0
0

Hello. I am using AE cs6 win version.

Right now I am trying to loop key frames using loopOut() expression, but it won't loop.

Please see this video.

 

 

Moving of The pale blue square is what I want, but if I use loopOut() expression to make such moving, it makes this green square movement. This green square has only 2 hold interpolation keyf rames on x position, and I just use default loopOut() expression. Seems green square's key frame 2 is ignored after first loop by loop expression.

Do you know why? Thank you in advance.

Is it possible to confine expressions to specific keyframes?

$
0
0

I am definitely a beginner when it comes to expressions.

I am currently using a "bounce" expression on the position parameter of some objects as they come on screen. However, the next time they change positions, I don't want them to bounce. Every time a motion tween ends in a static position, the position expression gets applied and the stuff is moving around.

I'd like to be able to keyframe the expression so that it worked only when on the keyframes that it makes sense to affect.

 

amp = .05;

freq = 1;

decay = 7;


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

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

}

else

{

value

}

 

I got this script from somewhere online. The only thing I know how to manipulate are the initial values of amp, freq, and decay.

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.

Viewing all 47983 articles
Browse latest View live


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