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

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!


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

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.

how to edit keyframe values through expressions using global values

$
0
0

hello,

 

I would like to make the values of keyframes dependent on "point controls" that I generated.

 

Is it possible to give values of the point controls to a specific keyframe?

 

different point control values would change different keyframes of the same parameter and same layer.

 

thank you!

erg

I have a number expression from Dan Ebberts that I would like to add a plus sign to the end of the number. Can anyone help me out? Thanks very much Ira

$
0
0

numDecimals = 0;

commas = true;

dollarSign = false;

beginCount = 0;

endCount = 50000;

dur = 1;

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;

}

How to read metadata out of EXRs or other file-formats?

$
0
0

My EXRs out of my 3d animation package contains the camera postion/rotation/focal length in the meta data. Is there a possibility to read it out and create a AE 3D camera out of it?

I'm don't know how to access meta data in AE in the first place. I know and use other external ways for exporting and importing 3D cameras or nodes transform but would like to have a simpler solution based on the EXRs alone.

In Nuke there are easy ways to read the meta data and a relatively simple Python script can create a 3D camera out it.

substring() not a function?

$
0
0

Hi!

 

trying to do the simple task of separating 6 characters (numbers) and adding a space after the first 3.


My script reads:

 

 

siffror = parseFloat(Math.round(thisComp.layer("Räknare Slider").effect("Slider Control")("Slider")));

s1 = siffror.substring(0, 3);

s2 = siffror.substring(3, 6);

"Co2 saved: " + s1 + " " + s2 + " ton";

 

it says siffror.substring is not a function.

 

What am I doing wrong here?

Making the wheels of a car roll right

$
0
0

I have a photo of a car with the wheels separated, and I want to find an expression or something that will help make the wheels look like they are rotating at the right speed.  Any suggestions?

 

I have used AE for a while but expressions are still pretty foreign to me.

 

Thanks for any help!


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

How do I add a 3D wiggle expression to a seamless loop expression in After Effects?

$
0
0

I am using this xyz wiggle expression for several layer (each layer having slightly different integers to have different movement.

 

 

a =wiggle(0.2,150);

b =wiggle(0.15,160);

c = wiggle(0.2,500);

[a[0],b[1],c[2]]

 

But I want to make it a seamless loop. I found another expression that does this, but it is not in 3d space.

 

freq = 1;
amp = 110;
loopTime = 3;
//this will be changed to 6 seconds
t = time % loopTime;
wiggle1 = wiggle(freq, amp, 1, 0.5, t);
wiggle2 = wiggle(freq, amp, 1, 0.5, t - loopTime);
linear(t, 0, loopTime, wiggle1, wiggle2)

 

How can I merge the expression?

if else i dont get it

$
0
0

Hi and hello.

Here is my tricky problem.

 

I have 5 boxes red_1, green_2, blue_3, black_4 and yellow_5.

All boxes lined up, when i move blue_3 20 pixels to the y position, green_2 and black_4 should move 10 pixels to the y position.

When i move blue_3 back to 0 all others should move back.

So every time i move one of these Boxes the neighbors should move too.

 

Sounds easy but seems to be really hard.

 

Thanks for any tip.

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!

Random Frame Time Remap Expression

$
0
0

I work with a lot of hand-drawn loops and I'm curious about expressions that can randomize the frame playback of image sequences using the time-remapping property. 

 

For example, in traditional hand-drawn animation when you wanted to hold a pose without the animation looking static you would create what's called a traceback, which means you would physically trace at least 8 frames of the same drawing and then shoot them over and over again in a random order for however long you needed to hold the pose.  That way you don't get the exact same pattern of frames cycling over and over like you would if you just looped it.

 

Of course you can manually reorder frames in After Effects, but it's very time-consuming and I'm wondering if an expression could be written that could easily be modified for different sequences at different timings and different lengths.  For instance, I found this expression by Filip Vandueren on the Creative Cow website http://forums.creativecow.net/thread/227/12413  It was intended to randomize a 5 frame sequence, however the sequence and the comp have to be at the same frame-rate in order for it to work.  Therefore, I have to work at a 12fps sequence in a 12fps comp if I want the animation to look like it was shot on 2s.  Usually a 12fps sequence with no time remap expressions will play back on 2s if it's in a 24fps comp and as far as I can tell using time stretch or posterize time doesn't work.  Time stretch does nothing and posterize time crashes after effects when I add it to the image squence with the expression applied to the time-remapping property.  This probably has something to do with an expressions conflict that happens once time remapping is applied to the image sequence.  Anyhow, I'm asking if there's a way to modify this expression so that I could put my footage into a comp at another frame rate and use the expression itself to tell it to play at either 8fps, 12fps or any other frame rate.

 

This is Filip Vandueren's expression

 

seedRandom(1,true);

var t=timeToFrames();

var r1=-3;

var r2=-2;

var r3=-1;

for (var i=0;t>=i; i++) {

   var r3=Math.floor(random(5));

   if (r1==r3 || r2==r3) {

      t++;

      continue;

   }

   r1=r2;

   r2=r3;

}

framesToTime(r3);


This is an expression based on Vandueren's that I tried to modify for an 8 frame image sequence.  It sort of worked but it didn't really achieve what I was looking for.

 

timeRemap

seedRandom(2,true);

var t=timeToFrames();

var r1=-6;

var r2=-5;

var r3=-4;

var r4=-3;

var r5=-2;

var r6=-1;

for (var i=0;t>=i; i++) {

   var r3=Math.floor(random(8));

   if (r1==r3 || r2==r3) {

      t++;

      continue;

   }

   r1=r2;

   r2=r3;

}

framesToTime(r3);

 

The image sequence played all 8 frames randomly without duplicating them, but I still couldn't figure out how to make it play at 8fps or 12fps without conforming the comp frame rate to the frame rate of the image sequence.  Ideally I'd like the expression to determine the frame rate so that I can have it in a comp with other frame rates and not have to worry about disturbing the expression.

 

Reordering random frames is a common thing for 2D animators to do so I'll also file a feature request asking After Effects to add this feature to an existing plug-in or create a standalone plug-in.

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

AE expression for "length of text layer" for lower thirds nameplate

$
0
0
Hello everyone,

Is there a way to measure the total width (and height) of a text layer, to automatically update the length (and height) of a shape layer? I produce web news segments with 7-15 lower thirds displays for each video. I'm looking for a more efficient way to re-size each nameplate. Currently I manually re-size each shape layer to fit the name. Is there an expression that will update the shape layer, based on the length (in pixels) of the text layer?

See an example video of what I'm talking about:
http://dallasvoice.com/dvtv_track.php?s=345
(look for the nameplates that animate in at the beginning of each interview)

I've read everything I can get my hands on, but nothing has helped. Any help would be appreciated!
-RY

Create sphere on keyframes with expression

$
0
0

Hi,

 

I've just begun to learn after effects and could use a little help.

 

I have a small solid wich is moving around on the comp. This is done using expressions.

 

What I would like to do is first to replace it with a 3d sphere.

And secondly, instead of moving it, create a new sphere on each keyframe.

 

First I imagined using trapcode particular, setting the particles count to 1. But that is per second, not per keyframe.

 

Any ideas are appreciated.

 

/Lars

Opacity random motion, ok! and loops?

$
0
0

Hi there!

I'm using an expression by Dan Ebberts, thanks Dan!

This expression works great, but the problem is that It's not a loop.

I need to do a loop to 4500 f. I try to use time % loopTime, but it doesn't work.

Does anyone have any idea how to do this?

Thanks!


Expressionbelow:
segMin = .3; //minimum segment duration
segMax = .7; //maximum segment duration
minVal = 10;
maxVal = 100;

end = 0;
j = 0;
while ( time >= end){
  j += 1;
  seedRandom(j,true);
  start = end;
  end += random(segMin,segMax);
}
endVal =  random(minVal,maxVal);
seedRandom(j-1,true);
dummy=random(); //this is a throw-away value
startVal =  random(minVal,maxVal);
ease(time,start,end,startVal,endVal)

delay scale parameter from the shape layer repeater

$
0
0

Hi,

 

 

I want to animate the scale parameter of the repeater effect and delay it on several shapes.

 

 

I've tried with this expression using 2 expressions sliders but without success

 

 

thisIndex=thisProperty.propertyGroup(3).propertyIndex;

effet=effect("repetition echelle")("Curseur");

delai=effect("delai")("Curseur")*thisComp.frameDuration*(thisIndex - 1);

[effet.valueAtTime(time - d),effet.valueAtTime(time - d)]

 

 

I've searched through the web but didn't find anything about it and I'm wondering if it's even possible

 

 

Any clue ?

Track nested child layer's position

$
0
0

Hi,

 

I have a Main Comp with a layer named 'Controller'.I have several 2d layers parented to this controller.

Now,i need to precompose two of them.let's say this precomposition of these two layers is named 'precomp 1'.

How can i parent these two layers in the 'precomp1' to the 'Controller' in the Main Comp again via Expression?

 

Dan,any ideas?

Access property of a subcomp through expressions.

$
0
0

I got a main composition. It got a subcomposition and a null-object(with a control checkbox).

How can I access a layers opacity in the subcomposition throught an expression in the main composition?

The goal would be to reuse the subcomp. Once with a layer visible and another time without.

 

So far I wrote this in the control checkbox:

if(value == 1)

{

comp("subcomp").layer("xy").opacity =100 ;

 

}

else

{

comp("subcomp").layer("xy").opacity =0 ;

}

 

 

I tried also to write an expression directly in the going to be hidden layers opacity:

 

var control  = comp("maincomp").layer("control");

100*control.effect(1).param("SliderControl").valueAtTime(control.time);

 

This actually worked when I toggled the control checkbox manually, but as soon I keyed it, it didnt work anymore.

It was kind of a time conversion problem: It takes the time of the parent but applies it to the subcomp……

 

Thanks for help

Viewing all 47983 articles
Browse latest View live


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