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

Link and animate null object position trough comps with "time offset"

$
0
0

My title is probably not very accurate, because I'm not really sure how to ask this...

 

I have 'particleFactory' composition in which I have bunch of particular layers that simulate the fire effect element. In another composition I have many duplicates of 'particleFactory' that kind of create the full fire effect. I also have a null object in there that is driving the xy position of the particles - a standard linking with pickwhip through comps (particular xy pos > null xy pos). The reason of linking particular xy emitter to null object xy is because I want to drive many 'particleFactory' elements with one null, and I want particles to interact with their internal physics systems (I don't want to just move the whole layer).

This works nicely, but the problem begins when I start to animate the null object. All of those duplicates of 'particleFactory' are offsetted by +- 50 frames, so every element would look kind of different from other duplicates. The problem is that every duplicate of 'particleFactory' is also offsetting the null object keyframes with itself - because of the layer delay that I mentioned. So the whole animation doesn't look accurate. Is there a way to prevent this? To somehow say to particular xy position property to look just the keyframes, and not the layer offset?

 

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?         

AE CS6: Render glitches with timeremap expressions

$
0
0

Version:

11.0

 

OS:

Mac 10.7.4

 

Source Footage:

.ai files

 

Problem:

 

First of all, we've been using this method for character animation since AE 7.0.  We have had minor glitches here and there, but nothing consistent enough to a real problem.  We're currently using CS5.5, and considering the CS6 upgrade.

 

I am filing an official bug report for this, but am curious if anyone else is experiencing this.  I don't want to share my project here as it's for a TV show in production.

 

Starting with CS6, we're experiencing random, arbitary render glitches all over the place.  Our character comps are generally two comps deep.  Meaning in the character comp, we have timeremapped comps for sequences of eyes, eyebrows, mouths, etc.  Inside those comps, there is a lot more going on than just an image sequence.  We have mesh warp keyframes and other stuff.

 

All of this is controlled by various expressions that link everything to some simple master controls.  I'm sure this sounds familiar -- it's very similar to the method used in these tutorials, but not even as complex.

 

As for the glitches, they are hard to pin down.  There are different glitches depending on whether the character is continually reasterized in the scene or not, which comp we're in, etc.  Really random.  The problem is resolved by proxying those precomps (the eyes, mouths, etc) with prerendered sequences.  This is an OK workaround for most cases, but we can't depend on it.

 

Thanks for any help.  In the meantime we'll be sticking with 5.5.

 

Bryan

Expression with delay

$
0
0

Hi,

 

I'm a nooby when it comes to expression, so can anyone please help me with how I can create a certain expression?

 

I think it's quite simple. I've got 2 layers. One layer has an animation (leader) and the other one needs to follow. Only with a delay of 1 frame. The animations happens on "position", "scale" and "rotation".

 

Thanks you very much in advance!

 

Best regards,

 

John

Expression Get Project Path or Name

$
0
0

Hi,

 

I am new to After Effects as in I have just seen it for the first time today!

 

What I'd like to know is, is it possible to write an expression to return either the current project name or file path?

 

I'm assuming no as I cannot find any reference to this in the language reference. How would I go about integrating a script with the project to return the project name?

 

I have tried something basic like:

 

Expression code:

 

var currpath = $.evalFile(filepath);

 

filepath is the path to my script file, the script is like the below:

 

GetPath()

 

function GetPath() {

 

return app.project.name;

}

 

With this I get an error similar to method name 'Global' not found - not at my work computer so can't remember the exact message.

 

Any help would be appreciated.

 

Thanks,

 

Mark

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 automatically "fit to comp" any imported file?

$
0
0

Hello everybody

 

i'm using a plugin to dynamically import video files into some comps i previously configured.

All these comps are 1280x720 and this plugin, when triggered, basically takes hundreds of video files i have in a specific folder on my PC and imports them in AE and puts each one of them in each comp.

For my job i sell hundreds of videos per year during sport events (all videos have the same structure). That's why i use this script, which automates my work and automatically edits each video.

 

THE PROBLEM

The video files are not the same resolution. Some are 1280x720, some others are 1920x1080.

The plugin simply imports them and puts them into the comp, which means the 1920x1080 files will not be properly scaled.

As you can imagine, i can't open each comp and right click on the video and click "fit to comp" because, having hundreds of comps each time, it would be a huge waste of time, and it would be useless to use a script.

 

THE SOLUTIONS I THOUGHT

1) Is it possible to tell AE to automatically fit to comp any video imported into a comp? (something like "default scale to frame size" of PPRO)

2) If 1 is not possible, i came up with a weird but possibly working solution. In each comp i put a null object with an expression that changes the scale of the imported video. Hence, when the video is imported, the expression on the NULL object takes care of resizing the imported video. The question is: how can i tell that expression to change the scale of a video not yet imported (i already have the code of the expression, found somewhere ont the web...i just need to tell the null object to apply the expression to a video file that is not yet imported)?

 

 

Thanks for support!

puppet pins moving in opposite directions

$
0
0

Hello,

I'm new to AE.  I want to create a controller for two puppet pins.  One pin that follows the controller, and the other that follows the y position of the controller but moves in the opposite direction of the x position.  I used the Duik plugin to create bones for the puppet pins and linked their position expressions to a null (controller).  I can get the pins to follow the y position, and the one pin to follow the x.  How do I get the other x pin to move away (in the opposite direction) of the null.  When I try putting a negative, the pin shoots off the screen.

Thanks for your help!


Put Effects in Variables with Loop/Function

$
0
0

I need to create a code that take the following strings:


"Scale"
"Position"
"Side"











 

And put each one, within of a copy of this code:

thisComp.effect(!!!STRING HERE!!!)("Layer").name;

 

And after that, three variables, each one, receive a complete code.


var a;
var b;
var c;











 

The result would be this:


var a = thisComp.effect("Scale")("Layer").name;
var b = thisComp.effect("Position")("Layer").name;
var c = thisComp.effect("Side")("Layer").name;












 

I try made like this:

 

varstrings = ["Scale", "Position", "Side"];

var val = function (a, b, c){

for (var i=0; i<strings.length; i++){

var effect=thisComp.effect(strings[i])("Layer").name;

val(effect);

}

}

 

But no have experience with functions and For Loops.


And no know if this is the correct way of do it.

 

I need to do this because my code is becoming too long for many repetitions.

 

I think for that, will need to use for loop, and function.

 

Thanks.

Offsetting time and position of several layers relative to preceding layer

$
0
0

Hello -

 

Pardon the newbie questions, but I've keyframed 'Black Solid' moving along the x axis and basically would like to duplicate the layer (perhaps with a new color) several times so that each 'new layer' follows the previous layer and offsets itself a certain amount of pixels...say 20px for example.

 

I found a simple expression that I applied to the first dup'd layer and it works fine but I can't figure out where to tell it to offset 20px to the left of the main layer.

 

thisComp.layer("Black Solid 1").transform.position.valueAtTime(time -.1);

 

I suppose I'm trying for a cascading effect + offset.

 

Thanks!

gj

Source Text Generated by Expression - Current Value?

$
0
0

I'm writing an expression to control the sourceText of a text layer based upon the length of another text layer. Part of the functionality is to only update the current layer text if there is a large enough change in length.  Is there a way to access the current value of the text layer that was generated by the expression?  value and sourceText.text point to the text set on the text layer, not the generated layer. 

 

Here's my expression

 

 function calc(prevValue) {  var textLength = thisComp.layer(1).text.sourceText.length;  var perc = thisComp.layer(2).text.animator("Animator 1").selector("Range Selector 1").start;  var newValue = 140 - Math.floor(textLength * perc / 100);  return (parseInt(prevValue) - newValue) < 10 ? prevValue : newValue;
}

//Need to pass the previously generated text value here...how do you access it?
calc(text.sourceText);



 

Couldn't find any way to access it in the expression references.

 

Thoughts?

Calvin

How to delay opacity following another layer

$
0
0

Hello All.

 

I have 100+ layers that I would like to fade on in a delayed fashion following the manual opacity key frames set in a 'master' layer. Thus, each of the 100+ layers will incrementally fade on by half a second — after the 'master' layer has faded in.

 

My research has led me to this expression:

 

thisComp.layer("leader").transform.opacity.valueAtTime(time-thisComp.frameDuration)

 

however the above fades in all 100+ layers simultaneously. I'd like the layers to fade in one after the other.

 

 

Can anyone suggest the script to make this happen please?

Using valueAtTime syntax problem?

$
0
0

Hi guys

 

I want to follow position of current layer "cardio.ai" but with a delay.

 

This code currently works:

 

tempX = transform.position[0];

tempY = thisComp.layer("cardio.ai").transform.position[1];

[tempX, tempY]

 

But if I do this:

tempX = transform.position[0];

tempY = thisComp.layer("cardio.ai").transform.position[1].valueAtTime(time -1);

[tempX, tempY]

 

it will not work.

 

I may be having problems with the API or syntax but I am just learning this and can't figure out what's going on.

 

Thanks

Deriving one position keyframes value from another

$
0
0

Hello AE expression community.

Boy, I hope someone can help me with this, because I can't find the answer to this anywhere. At any rate, here's what I'm trying to do - I have a layer with various position keyframes throughout. One of those keyframes, however, needs to derive its value from the preceding keyframe. In other words, I need to be able to edit the position value of, lets call it keyframe 3, and have that automatically become the value of keyframe 4.

Does ANYONE out there know of a way? Please, please, please - I'm up against a serious wall.

I really appreciate all help. Thanks guys

Copy X or Y Parameter of Scale Value

$
0
0

Hi,

 

I am wondering if there's a way to copy just 1 of the scale values (all of them within a sequence of keyframes) from a Null and paste them onto a "Transform" effect on a different layer. I was able to do this with position values by right clicking and selecting separate values, but I can't do this for scale. Any help appreciated! Thanks!

 

-Nate


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!

Could someone help me with this expression please

$
0
0

Hey folks see below is an expression I have for a counter, However I would like to replace the commas with a space if possible can someone point me in the direction of how to do this, would it be in the commas not requested section.....

Thank you so much.

 

Regards Chossy.

 

 

 

num = thisComp.layer("Controls").effect("number")("Slider")*100000;

amtOfDec = thisComp.layer("Controls").effect("amt_of_decimals")("Slider");

commas = thisComp.layer("Controls").effect("use_commas")("Checkbox");

//--

num = num + 0;

amtOfDec = amtOfDec + 0;

commas = commas == 1;

 

//--

if(!  commas){

 

//commas not requested

  num.toFixed( amtOfDec );

 

}else{

 

//commas requested

 

//This function takes a positive whole number as a string

//and adds commas to it

 

   function addCommas( str ){

      finalResult = "";

      for( i = str.length - 1; i >= 0; i-- ){

        finalResult = str.charAt( i ) + finalResult;

        if( (str.length - i) % 3 == 0  && i != 0 )

            finalResult = "," + finalResult;

      }

  return finalResult; 

  }

 

//--

 

   intPart = Math.floor( Math.abs( num ) );

   decPart = Math.abs(num) - intPart;

   wasNeg = num < 0;

   result = "";

   if( wasNeg )

      result = "–" + result;

   intPartString = intPart + "";

   decPartString = decPart.toFixed( amtOfDec ) + "";

   decPartString = decPartString.substring( 1 );

   result = result + addCommas( intPartString ) + decPartString;

   result

}

Dynamic layer width based on width of text layer

$
0
0

Hello,

 

I'm making a lower third in After Effects. I am planning to use them as templates in Premiere.

What I am trying to reach is: when the text on the bar is longer then the bar itself, the bar should get longer on the right.

 

Does someone know how to do this? First I was thinking to do something with Expressions. But I'm not sure.

 

Any help would be appreciated

 

If you need more info, or if you want to let me explain this in more detail, let me know.

Idea/Help - Dynamic simple 2d shadows

$
0
0

I have been looking for an expression to do the following:


I have a 2D animated character and i would like to add a simple dynamic shadow to the base of the character.


I dont want any realistic shadows per se, as the style is flat vectors.

So basically a clean grey oval as a shadow.


Ideally, i would like it to;


- Contract in scale (Or even fade) when character jumps up and down (but stay static on y axis as if attached to floor)


- Move in x axis according to characters x movements (again no y axis movements)


I have been messing around with pickwhips and expressions but cant seem to get the functionality i need. As keyframing this would take too long to do.


I would appreciate any light you could throw on this.


Cheers

Alex

Difficulty w/ Expression speed and frequency control: Unable to create a smooth value oscillator when changing frequency over time

$
0
0

Hi there. I have a somewhat advanced question about speed and frequency control expressions, and I'm hoping some expression gurus out there may be able to help.

 

I'm trying to create an expression to animate an oscillating diameter of a circle that smoothly responds to changes in frequency value over time. Using slider controls, I've assigned the values of the initial circle diameter, its oscillation amplitude, and oscillation frequency. I can keyframe changing frequency values over time, but when I do this, an uneven animation results. Please refer to my attached screenshot for reference:

AESS_1.jpg

 

The green graph represents the circle diameter size (to be completely specific, this is the 'Starting Thickness' value of the 'Beam' effect made to look like a circular glowing eye). The pink graph represents the slider value of the frequency value control. It starts at .5 and increases to 1.4 over about a second, but as you can see from the graph output when this occurs the frequency of the diameter size oscillation abruptly jumps to a rate faster than the intended target rate before arriving at the target frequency - not gradual at all. I realize I could convert my expression to keyframes and smooth things out this way, but I'd prefer to find a solution w/ the expression itself. Can someone please advise me how to create an expression that will result in a smooth, gradual change in frequency?

 

Below is my current expression. I use sliders to define the maximum sphere diameter size and it oscillates to a smaller diameter size and back again depending on the value of "amp" and "freq". I also have it designed to only begin the animation after a specific keyframe is reached in the composition to ensure a smooth animation (w/ out this :

 

initEyeSize = effect("Sldr-EyeDiameter")("Slider");

freq = effect("Sldr-EyeSizeFreq")("Slider");

amp = effect("Sldr-EyeSizeAmp")("Slider");

FXstartFrame = effect("Sldr-FXStartFrame")("Slider");

currentTime = timeToFrames();

t = currentTime - FXstartFrame;

 

if (t >= 0)

  {thisProcTime = currentTime - FXstartFrame;

  finalEyeSize = initEyeSize - Math.abs(amp*Math.sin(freq*framesToTime(thisProcTime)*2*Math.PI));}

else {initEyeSize;}

 

I am familiar with Dan Ebberts' expertise in the area of motion scripting and have consulted this article extensively, which is about achieving smooth frequency transitions over time w/ his linear keyframe integration technique. Specifically, I think this expression holds the key to my solution, but I'm having a hard time wrapping my head around how to integrate it w/ my current expression:

 

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

amp = 100;

n = freq.numKeys;

if (n > 0 && freq.key(1).time < time){

  accum = freq.key(1).value*(freq.key(1).time - inPoint);

  for (i = 2; i <= n; i++){

  if (freq.key(i).time > time) break;

  k1 = freq.key(i-1);

  k2 = freq.key(i);

  accum += (k1.value + k2.value)*(k2.time - k1.time)/2;

  }

  accum += (freq.value + freq.key(i-1).value)*(time - freq.key(i-1).time)/2;

}else{

  accum = freq.value*(time - inPoint);

}

value + amp*Math.sin(accum*Math.PI*2)

 

My current expression allows me to generate sine wave oscillations starting from a specific keyframe of my choosing vs. the start of the composition as I understand is standard expression behavior -resulting in a smoother animation of my oscillating sphere diameter. I'd like to preserve the functionality of my current expression while integrating Dan's expression, but my previous attempts have been unsuccessful b/c Dan's expression seems to work off of the inPoint time of a layer, whereas mine is working off of time in frames as measured from a specific keyframe starting point ('FXstartFrame') not at the start of a layer. Plus I'm having a difficult time comprehending the inner workings of Dan's expression.

 

Are there any expression wizards out there who know how I can integrate Dan's expression into mine so that the value oscillation begins after a specific keyframe is reached AND the oscillation frequency gradually changes when the frequency value changes over time?

 

To help clarify all this, I'm attaching a video clip of what I'm working that reflects the animation going on indicated in my screen shot above. It features the animated circle (a glowing eye) static before the target keyframe is reached, then oscillating at the initial frequency, then oscillating wildly during the transition from frequency one to two, then oscillating at the final target frequency.

 

 

 

Please let me know if you need further clarifications, I realize this is somewhat of a complicated series of questions.  Thanks in advance for any help you can provide!

Viewing all 47983 articles
Browse latest View live


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