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

Keeping linked 3D null orientation straight

$
0
0

When using Cinema 4D, I routinely attach AE layers to exported 3D nulls.  And everything works as expected.

 

However, I have a project where camera and object are at angles and I need the AE layer to keep its orientation always pointing up, but still rotating around as normal.

 

(click to watch animation)

cube-rotate.gif

 

 

 

For this example below, the layer was linked normally to XYZ rotation and XYZ position of the null. But I manually keyframed the orientation  (which I know is usually a no-no). Any expressions that  would keep a layer level no matter the 3D rotation or 3D position? "Orient to Camera" doesn't work. I don't need the layer to always face the camera because it needs to rotate with the null

 

(click to watch animation)

cube-orient-up.gif


Access Properties of a Layer Inside a Precomp

$
0
0

First time visiting these forums but they look like a super helpful place so any response is awesome.

 

I'm trying to save myself some headache by creating one animation ("CircleIcon") and then using it over and over again. I'm accessing a property of the precomp by using the following expression:

 

comp("CircleIcon").layer("Parent_Icon_To_This").transform.opacity

 

Here's what I'm creating: A series of circles that animate on, with a different icon in each circle. I want them all to animate on with the same animation but staggered slightly in time. The "CircleIcon" comp has a null object ("Parent_Icon_To_This") which I am hoping I can animate however I want, and then parent each icon to in the main comp.

 

Only problem with this is that when I parent each icon to a different instance of the "CircleIcon" comp in my main timeline, the icons don't get parented to the timing of the instances of the "CircleIcon" comp, they get parented to the original "CircleIcon" comp timing and then the timings for the fade-ins are simultaneous instead of staggered.

 

Basically, I just need help figuring out the syntax to reference the properties of an instance of a precomp, rather than the precomp itself, that way I can have the timing stagger. I found a snippet of code on these forums that looked close to correct, but it's not working for what I'm trying to do:

 

L = thisComp.layer("CircleIcon_01");

L.toComp(L.content("Parent_Icon_To_This").transform.opacity)

 

the basic structure I think I need is like this:

 

thisComp.layer.layerOfThePrecomp.transform.opacity

 

Any help is greatly appreciated. Or if there's another way to do this, I'm open to suggestions. Thanks in advance!

 

-Jeremy

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

Linear wipe through multiple layers

$
0
0

Hi, I am trying to set up a project where by i can drop multiple stills images into a comp and have a linear wipe go through them one by one, all controlled by expressions.

similar to vfx breakdown's you get on Youtube

MPC Prometheus VFX breakdown! - YouTube

Being an intrepid novice to expressions I though "I can do that, no problem!"

So I have a comp with the images in it and another comp with the wipe effect in it. Inside the wipe effect comp I have 2 layers, a null with two sliders and a solid with a linear wipe effect.

wipeEffectComp.png

The first slider (called pause) controls the length of time before the wipe effect begins and 2nd (called wipeSpeed) controls speed of the wipe:

 

if (time < thisComp.layer("Controls Wipe").effect("pause")("Slider")){

0

}else{

((time - thisComp.layer("Controls Wipe").effect("pause")("Slider")) * thisComp.layer("Controls Wipe").effect("wipeSpeed")("Slider"))

}

 

This works great I can apply a set channels effect to each image layer that takes its alpha channel from the comp with the wipe effect.

footageComp.png

But this is just the first step after this I have become stumped, searching the web unsuccessfully for information, I hope I can get some advice here.

What I think needs to happen next is once the transition % for the wipe has reached 100 the time (play head for the comp) needs to go back to frame 0 and the whole process begins again.

Each time the cycle has run the upper most layer in the stack, that is visible, needs to be made invisible, that way each new layer below can be revealed and the whole layer stack is played through sequentially.

I hope that makes sense and there is someone out there that can help. Thanks for your time.

Felix

Random Number per comp

$
0
0

Hi,

 

I have a comp with a random number being generated,

 

This is what I have on the rotation keyframe:

 

seedRandom(index,true);

myValue = random(50) ;

time*myValue;

 

When i duplicate this comp, they all produce the same results.

 

Is it possible for each comp to generate it's own random number?

 

Thanks

Add a 0 in front of a number

$
0
0

Hello,

 

I am using a simple expression to make a calendar, going from 1 to 31

Until the number 10 i would like to display a 0 in front of the number.

Unfortunately everything I am trying doesn't work.

 

Here is the expression:

 

v=time/thisComp.frameDuration;

t = (v%31)+1;

if (t >0 && t < 10){

value=""+"0"+t;

}else{

value=t;}

 

I am on AE CC with Mac maverick.

 

Thanks

NIco

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!

Property links vs Relative property links

$
0
0

Now that "copy with relative property links" is available, in what case would you find using just "copy with property links" beneficial. Wouldn't the relative copy work just the same in all cases?


sourceRectAtTime options confusion

$
0
0

sourceRectAtTime method has an includeExtents parameter, that includes the shape layer bounds. This must be the stroke.

 

I've put this parameter to test and got mixed results. Check this 2 images. Stroke width is 10 (I guess px) in both cases. With includeExtents set to false, width is is 499px. But if set to TRUE, then the width becomes 549px. That is 5x the amount of stroke. What is going on here? Numbers just don't add up. Also I've drawn 2 rulers that prove that width of the stroke is in fact, 10px.

 

Screen Shot 2017-08-23 at 12.52.13.png

 

Screen Shot 2017-08-23 at 12.52.02.png

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!

Expression Control / Slider Control work with percentage?

$
0
0

For example, I want to make one expression with keyframes, so opted to use "slide control," but the expression is now defined by the "slide control ", if I put the expression wiggle(2,5) and place the 2 on the slide control, know that the value will be replaced by the value of "slide control" if in case the slide control was "10", would look like this: wiggle(10,5)

 

 

But what I want to know is if have how to control the original expression through a percentage and not a replaced, for the slider control value.

 

Thanks!

Expressions depending on program language? WTF??

$
0
0

How insanely stupid is this? I am working on After Effects in English. Now i got an AEP from a collegue who uses AE in german. The particular project uses a lot of expressions connecting to "Controls for Expressions". An when i open that project in my AE, i get dozens of error messages because all the controls and properties are beeing translated into english while the handlers of the expressions aren't.

 

Is there any possibility for me to fix this without changing almost 50 expressions in 15 comps and without changing my AE to german (because this would mean to reinstall the complete Creative Suite -- another fact that makes no sense)

 

thany you very much

u

"global" function in expressions

$
0
0

Hi guys,

 

I'm looking for something very basic with expressions but can't seem to find it. I want to define a function and use that function inside ~100 or so layers. At the moment I'm typing a couple of lines of code inside each expression layer to drive the position of each layer which is insane of course. I just want to define one function (and define it only once):

 

function getPosition(null1,null2,offset){

     ...stuff..

     return position

}

 

And in my comp, use that function everywhere to drive the position attribute for example:

 

getPosition("null5",null6",0)

 

Writing that function inside each expression is a bit daft of course but I can't seem to find a way to define such a function to use throughout my comp. Could anyone point me in the right direction? Thanks!

Reference current layer as array index when loading external text file

$
0
0

I've a series of text animations, and I want to be able to load the text content for the layer from an eternal file.

This is referenced in many places (I saw it here Pro Video Coalition - Expression Shorts - Read External Text Document by David Torno) , and the script is usually as follows:

 

try{

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

$.evalFile(myPath);

eval(thisComp.name)[0];

}catch(err){

"MISSING";

}

 

In this case the layer is always the array index - so I'd like to be able to replace the specific reference to the array index by a reference to the current layer number. This allows easy duplication of the expression rather then having to edit each expression individually for each layer. I think the property I require is index - but it doesn't work! Or not the way I'm using it anyway.

 

This is (one) of the expressions I've tried

 

eval(thisComp.name)[thisComp.index];

 

On layer 9 the error says the property ! or method named 9 in Class Array is missing etc. - so 9 index is interpreted correctly but I'm using it incorrectly.

thisProperty expression

$
0
0

I understand I can use thisProperty to get the index of a property, but is there a way to get the index of the shape group my opacity is inside? Sort of like an thisProperty.parent.index or something


add layer marker with expression

$
0
0

Hi All,

 

Does anybody know how to add markers to layer (or comps) through expressions?

 

I have hundreds of clips that I have to loop 3 times, but I want to add layer markers at the loop points.

 

So something like (in english!)....

 

divide the duration of comp by 3 and add a marker at those times.

 

Any helpful pointers would be hugely appreciated.

 

Pete

Counting up in Multiples

$
0
0

How do i set an expression to my slider to count in Multiples of 10s, 20s.... to my very last key@@frame?

Thanks

Change opacity precomp layer expression

$
0
0

Hi,

 

I want to control my precomp layers opacity within my maincomp by changing the layername.

For example: If my layer name(in the maincomp) is "A" only the layer called "A" in the precomp will show.

 

I allready wrote an expression:

 

if (comp("Main Comp").layer("A").name == ('A'))

{temp_opacity = 100};

else

{temp_opacity = 0};

temp_opacity

 

But the problem is, there need to be multiple precomps controlled in the main comp. And if both precomps are called "A" the script fails.

So maybe I need to have a control in the expression that will check which precomp it needs to use. (the sourse.layer.)

 

I'm trying the figgure it out last two weeks without succes, so if anyone can help me I'll be very thankfull!

 

JW

Noob Question: Move a layer in the opposite direction of a different animated layer

$
0
0

So say that I have an icon that I animate on the Y-axis +40px, but instead of trying to hand key the other layer each time, is there an expression I can write to have the other layer move in the opposite Y direction the same amount of units (ex: -40px)?

 

Thanks!

seedRandom( index, true) generates each frame a new number. Why?

$
0
0

Hi, I would like to understand why this code here:

 

j = 0;

accum = 0;

seedRandom(index,true);

 

while ( j < time ) {

accum += random(10);

j += thisComp.frameDuration;

}

 

random(100)

 

generates a different number each frame. But this one:

 

seedRandom(index,true);

random(100)

 

doesn't. Can anybody explain me this please?

Viewing all 47983 articles
Browse latest View live


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