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

Getting global coordinates from parented local coords.

$
0
0

I have a mocha tracked null. I child another null thats slightly offset in XY. Now the child's coordinates are relative to the parent. But how can I get the child's true position in the comp?

 

This seems too easy:

 

thisComp.layer("parentNULL").transform.position + thisComp.layer("childNULL").transform.position

 

Am I missing something?


Layer Space Transforms and Size

$
0
0

Hi,

 

I have a 2D layer following a 3D layer using toComp in an expression, and its working really well. However, when the 3D layer gets closer to the camera, it appears as if its bigger, and I'd like the 2D layer's actual size to match the 3D layer's apparant size. Is it posible to do this in an expression? Thanks,

 

--Saib

Accurate Timer For Sports

$
0
0

Hi all. I'm trying to make an expression you apply to a text layer to time sports videos accurately. So far, I have the minutes and seconds figured out, but can't seem to get the milliseconds to work. They keep adding extra values past 100 which is what i dont want. Whenever it reaches 100 it should start over.

 

milli = Math.floor(time*100);

sek = Math.floor(time%60);

min = Math.floor(time/60);



if(sek<10)

{

   "0" + min +":0" + sek + ":" + milli;

}

else

{

   "0" + min +":" + sek + ":" + milli;

}

Help with 3D Layer Position Expression

$
0
0

Hi All,

 

I do hope some one can help me – I have been looking and trying to solve this expression problem I have run in to - I only have limited expression knowledge.

 

I need to move a layer in 3D space, only the Z axis: from lets say -50 to 0 (based on the start of the layer) and then stop and then move 0 to 50 (again based on the end of the layer)

 

I have multiple layers of different lengths that I want to add this to…then just adjust the layer to the time to be displayed on the screen.

 

I have used some code from Harry Frank, his AUTO FADE code (which is a god sent) and have tried to make the above movement possible, with sections of the code, its close but no cigar – the code:

 

//Auto Move Z

x = 0;

y = 0;

z = 50;

transition = 20;       // transition time in frames

if (marker.numKeys<2){

tSecs = transition / ( 1 / thisComp.frameDuration); // convert to seconds

linear(time, inPoint, inPoint + tSecs, thisLayer.position + [x,y,z],0) - linear(time, outPoint - tSecs, outPoint, thisLayer.position +  [x,y,z],0)

}else{

linear(time, inPoint, marker.key(1).time, thisLayer.position + [x,y,z],0) - linear(time, marker.key(2).time, thisLayer.position + [x,y,z],0)

}

 

It is moving but it’s moving on all axis and the OUT is moving backwards instead for forwards. Plus is has moved from the centre position.

 

Any help would be most appreciated, thank you in advance for any help!

 

Cheers Breon

 

Message was edited by: breonsnow - spelling

controlling nulls with expressions

$
0
0

I am having an issue with an expression I'm working with.

 

I am trying to produce a dynamic graph (among other visualisers) that appears to be being controlled by a datastream - the artifical datastream is created by a handfull of sliders and a wiggle expression.

The graph is a simple line graph that works fine. This is created by following a null (MarkPos) that has its y position controlled by the master wiggle expression I mentioned before.

 

This next bit is where I am having problems:

 

I want to mark the lowest and highest points the line has reached on the graph by moving a dotted line, one for the low points and another for the high.

 

Just focusing on the bottom line;

I have the following expression attached to the line, that collects the current position of the null (MarkPos) and compares this with the current position of the line to see if it has moved any further downwards, if it has it moves the line to the new lower y pos. However, all that is happening is the line is following the null.

 

x = thisComp.layer("MarkPos").transform.position.valueAtTime(time)[1];

y = transform.position.valueAtTime(time)[1];

z = transform.position.valueAtTime(time-thisComp.frameDuration)[1];

 

if (x>y) {

[0,x]

} else {

[0,z]

}

 

After alot of debugging I now know the issue is with the else statement - all that its doing is offsetting the upwards movement by 1 frame - so how do you set a command of "keep your current y position" in this instance?

[0,1] just resets it to its start position, and its not possible to just have the "if(x>y){[0,x]}" bit without the "else {}".

 

Any suggestions fo how to fix this, or a better way to do it?

Who else would find a global Expressions object useful?

$
0
0

I often find myself working with multiple layers which all have the same set of expressions applied - eg, one for position, one for rotation, etc. Sometimes there might be one expression that I have to paste between layers in multiple different comps, and then if I need to add extra functions to that expression I've got to copy and paste it on all the layers again. What would be useful is a global "Expressions" object - basically a panel where you could define functions, then refer to them from anywhere:

 

[in the Expressions panel]

function calculatePosition(p, i, dx) {  // p is the object's current position, i is its index, dx is x-spacing  x = p[0] + (i * dx);  y = p[1];  return [x, y];
}

 

[in a layer's Position property]

Expressions.calculatePosition(transform.position, index, 200)

 

Then if you decide you want to space things, say, vertically rather than horizontally, you just need to change one thing.

 

I've submitted this as a feature request, but I don't know if it'd be useful to anyone else - it's not in the list of possible upcoming features as far as I know.

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 ?

controlling Key-Value by Point Controller

$
0
0

Hey guys,

I have multiple layers, each one has three position keyframes with keyA, keyB and keyC.

 

 

Now I want to have a small "helper": the value of frame B should be changed by a "Point Control" (which is on an other layer)

(due to the high amount of layers - with have the same keyframes but are delayed in time - it would fasten my workflow a lot!)

 

can`t be that diffucult to achieve?

I`ve already played around with key(index).value and pickwiped it etc. With no result.

 

Maybe someone can give me a hint?

Thanks!


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?

using ActionScript to specify settings in the Hue/Saturation Effect

$
0
0

Hi there,

 

 

I have been trying to write a little action script that sets up a bunch of defaults in the Hue Saturation plug-in but can only get so far.

 

The syntax either falls over or I am missing something here because the same code will work when in After Affects but if I try to run a script from the script UI directory. I get a "property undefined" returned. Uusally you just call the property by name and all is well. In this particularl case though. The only way to access say the "Red channel Saturation" is to have the plug-in in the Red channel pop-up. Ok so it works but not when running an external script.

 

The following does work from within AE but not from the UI scripts directory via the Window menu.

 

currProj = app.project(index).layer(index):

currEffect = currProj.Effects.addProperty("Hue/Saturation");

currEffectProp = currProj.effect("Hue/Saturation");

currEffectProp.masterSaturation.setValue(20);//this call works

currEffectProp.channelControl.setValue(2);//this call works changing the plug-in pane to the Red Channel

 

currEffectProp.redSaturation.setValue(-5); //this returns: "TypeError: undefined is not an object" – yet when run within AE as an expression it works fine???

 

 

Any help would be great – thank you

Is there a way of grabbing the name of a shape layer without referring to it specifically?

$
0
0

similar to 'thisLayer.name', is there a way of being able to grab the name of a shape layer without referring to it specifically?

 

I'm wanting something like 'thisShape.name' rather than having to define it as content("this shape name")

 

Any help with this would be greatly appreciated!

 

thanks

global array variables? , transfer data from one layer expression to another

$
0
0

hi i have arrays in expression, but i have a problem, every time when i move effect point control(i need move it for my task)  array update and erasing, but i need to save data from previous array state

 

 

i add this expression to text layer on Source text

//create array

var arrayX = [];

var arrayY = [];

//add data to array

arrayX.push(12);

arrayX.push(232);

arrayX.push(2424);

arrayY.push(0);

arrayY.push(322);

arrayY.push(122);

text_cur_layer = text.sourceText;

//final result

text_cur_layer ="Array_X= "+arrayX.join( ', ' )+"\r"+"      Array_Y= "+arrayY.join( ', ' );

 

 

expression return 

in array x must be (12 232 2424)

in arrayY  must be (0 322 122)

 

 

so every time when i change state on effect "point control"(slider control and etc) this expression updates and give me always same numbers, from this commands^

arrayX.push(12);

arrayX.push(232);

arrayX.push(2424);

arrayY.push(0);

arrayY.push(322);

arrayY.push(122);

 

 

it happened because i create array every time with

var arrayX = [];

var arrayY = [];

i think this commands erasing all data from array and create new clean array, so i need some how save previous data...., in AE script i can do that with creation array

globally for all functions, but don't know how  do this in expression

 

 

 

 

also i think it can be done with transfer data from array to string and save this string in another layer and then get this data after array creation, but i don't know how i can save array string data and export this string back?

 

 

example

 

 

var arrayX = [];

var arrayY = [];

//try import previous data back(i don't know how do that, just using standard java code..)

//and now i need get data from strX strY from save place and chekc it later

if(strX!=null && strY!=null)

{

arrayX=strX.split(',');

arrayX=strX.split(',');

}

//add data to array

arrayX.push(12);

arrayX.push(232);

arrayX.push(2424);

arrayY.push(0);

arrayY.push(322);

arrayY.push(122);

text_cur_layer = text.sourceText;

//final result

text_cur_layer ="Array_X= "+arrayX.join( ', ' )+"\r"+"      Array_Y= "+arrayY.join( ', ' );

//get data to save

var strX = arrayX.join(',')

var strY = arrayY.join(', ');

 

 

and then i need some how save this strX and  strY  to save place

 

 

 

 

Sorry for bad English

(Simple?) expression request

$
0
0

I think this is "simple" but I'm very new to expressions, and any help appreciated.

 

I have a group of subcomps that have an adjustment layer with an effect applied (DigiEffect's Damage, but the specifics I don't think matter). I want to control the adjustment layer effect with a "control layer" Adjustment Layer found in the Main Composition. So it looks like this: Main Comp w/ Adjustment Layer w/ DE_Interference, and I want to link all of the tweaks I make to that Adjustment Layer to an Adjustment Layer I created in each sub comp with the same DE_Interference effect on it. I see I can't pickwhip the whole effect to another whole effect, JUST the individual subgroup of parameters, like "Source_Blend" or "Random Seed", etc. Is it possible to parent those sub comp adjustment layer effects with the control adjustment layer effect? Thanks.

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

3D WARP/3DBEND: geometry expression no show?

$
0
0

"3D warp" as seen on tv.adobe "What's New", does not seem to be available on my version of CS6 AE (from disk). I'm not getting the geometry option even though,I have the 3D box checked and it is a pixel based layer. I do get the other expression options such as transform and material options. Can anyone help me bend stuff?


How to resize the text field through the expression?

$
0
0

It is necessary that another layer was at 150 pixels to the right of the right side of the text field.

Full auto-orient via expression

$
0
0

Hi!

 

I'd like a 3D Null to get the orientation of 3D a layer. (without parenting, it would be too easy )

 

I've tried a lot of solutions, through orientation, rotations, both combined... some results are close, but never perfect.

 

If I'm right, orientation is computed before rotations...

I think the simplest way would be with auto-orientation, or the lookAt() expression on orientation, wich gives me correct X and Y orientations, and then get an expression on zRotation to get a "full" orientation.

 

But what would it be?

How can I get the Z orientation in layer space?

 

Any idea will be appreciated!

 

François

after effect IK controlers

$
0
0

Hi every body

Sorry for my english.

 

how to controle easly alls IK controlers or null controlers of puppet in the final comp. To animate every characters in the final comp (every characters are in its comp)

 

Comment manipuler les controleurs (nulls) d'une marionnette situées dans la composition du personnage à l'extérieur de cette composition, c'est à dire, dans la compostition final.

Les copies de valeurs via expression nécessitent d'avoir des comps de la même taille. Les liens de parentages ne sont pas possible d'une comp à l'autre.

Existe t'il un script pour gérer les offsets de position de 2 nulls dont l'un est situé dans une comp et l'autre dans la comp supérieur ?

 

merci de votre aide.

 

2J.

linking precomped wheel rotation to position in another comp

$
0
0

Hey guys,

 

I suck at expressions, but I think one would really help me here.  I have a car driving, part of a complicated precomp, and i want the wheel rotaion in the precomp to rotate according to the position of the car in the master composition.  I've seen a few link-rotation-to-position scripts but can't find one that i can figure out how to alter in order to make it work. 

 

Hope someone can help, and apologize in advance if this is well worn territory.  I tried a search but could have easily not used the right key words.


Thanks in advance,

Mike

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

Viewing all 47983 articles
Browse latest View live


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