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

Extract only true degrees from rotation

$
0
0

Hi Guys,

 

I need to find a way to extract true degrees from the rotation transform. So instead of reading 1x-90 or 2x270, It just needs to read the 270 degrees part.

 

So if somethings continuously rotates, if you go beyond 360, it goes to 1x1 on the display or 361 if you read it out in expressions. But I only need to now if something is beyond 180 degrees or not, everytime it rotates.

 

So if it says 1x179, then it needs to understand that it is 179 and therefore not greater then 180 or not beyond the half of the circle, but it reads this of course at (1x360+179) 539, which IS greater then 180. So my if-then doesn't detect when its in the second half of the circle past one rotation.

 

Is there anyone who has discovered a function or some sort that does that?

 

Kind regards,

Marten.


Controlling tangents of a shape layer (cc 2018)

$
0
0

Figured it would be a lot of discussion re: the new scripting functionality of paths, but I can't find anything on this topic.

 

Is it possible to control the in and out tangents of an existing object by reference say the width of a shape layer? In other words: can I control the shape layer objects tangents other than just using the values on other objects.

 

I'm trying to define the tangent value this way:

myPath = thisComp.layer("Shape Layer 1").content("Shape 1").content("Path 1").path

myPath.inTangents()[2] = [120,50]

(the values are not referencing anything, I know!)

I get the 'object of type array found where a Property is needed' warning.

 

What is the correct way of doing this? Can't find any example in the expression reference help.

Expression to duplicate whole layer several times.

$
0
0

Hi everyone,

 

I am pretty new with AE, I want to ask if there is an expression, which would let me duplicate selected layer?

I want to use expression, because I have to use like, 30 layers of same object, only with some position and rotation offsets.

 

THank you.

"This project contains a expression error: error 1 of 1" in After Effect. Help.

$
0
0

"This project contains a expression error: error 1 of 1" in After Effect. Help.

 

rateOfSpeed=1;

clockStartTime = thisComp.layer(“slider”).effect(“Slider Control”)(“Slider”)*60;

 

 

clockTimeNumber = Math.floor(clockStartTime – rateOfSpeed*time);

 

 

function addZero(n) {

if (n<10) return “0” + n else return n;

}

 

 

minutes = Math.floor(clockTimeNumber/60);

seconds = clockTimeNumber%60;

 

 

if (clockStartTime > 0 && time < clockStartTime) {

addZero(minutes) + “:” + addZero(seconds);

} else {“00:00”}

 

 

 

This is the code I'm using to create a timer but there is an error and it dosen't work.

 

 

[This post moved to After Effects Scripting by Moderator]

I want Expression to follow Layer time NOT comp time

$
0
0

Hi! I have a simple Expression on the rotation value of a layer. How do I write it so it's triggerd by the layer itself and not the comp it is in.

 

veloc = 5;

amplitude = 20;

decay = 3;

 

amplitude*Math.sin(veloc*time)/Math.exp(decay*time)  

 

Thanx!

Finn, Sweden

Random motion from a certain position to random position

$
0
0

Hello, i saw lot of random motion expressions but they were looped, and starting, finishing positions were random, I need help with making an expression that will allow me to make a certain starting position and then make random ending position without looping

 

 

for example: from (600,600) to (X,X)with limit 120%, so the layers will go out of composition and will not come back

 

 

I wanted to make it for one animation, where one robot shots the other, and from him will explode many parts to random positions.

 

 

Can someone help me to make this expression please?

 

 

Thank you very much

Parenting Layer Positions - Can Variations Be Added?

$
0
0

If I parent one layer to a child layer, then the child layer will move exactly the same as the parent layer. If the parent layer moves 200 pixels to the right, then the child layer will move 200 pixels to the right.

 

Is there a way to vary the way the child layer moves? Say, a lesser percentage of pixels?

 

See below. The parent layer is the right pupil, and the child layer is the left pupil. Both pupils are centered, and look like they're in the right place.

Screen Shot 2015-01-05 at 10.45.10 PM.png

The right pupil parent layer moves to the right, and the child layer left pupil moves the same distance. It's starting to look wrong.

Screen Shot 2015-01-05 at 10.45.37 PM.png

The right pupil parent layer moves all the way to the edge of the eyeball. Now the child layer pupil has left the eye socket, and seems kind of other-worldly.

Screen Shot 2015-01-05 at 10.46.06 PM.png

 

Is there a way to tell the child layer to somehow move less than the parent layer? Say, 70% or 80% of the distance of the parent?

Expression to randomly change position of layer on grid.

$
0
0

Hello,


I would like an expression to randomly affect the position of a layer on a grid, like the example on Dan Ebberts website (Mastering Expressions, Pushing The Limits: Random Motion). However, instead of moving along a path from point A to point B, I would like the layer to jump from point A to point B (with no path in between) over 1 frame. The layer would then hold on that grid space for 5-10 frames before jumping to another grid space, and so on.

 

Having the ability to control the number of layers on the grid by way of a slider would also be very useful.

 

Please help, very stressed!


Time expression : slow down, then stop

$
0
0

Hi everyone,

 

I've been looking for a solution for hours and I couldn't find any. Basically, I'm using this expression to make a layer rotate :

 

timeToStart = 4;

timeToStop = 14.60;

if ((time > timeToStart) && (time < timeToStop))

{

  time*400;

}

else

{

  value;

}

 

I would like the speed to decrease a little before the layer stops, so that the motion looks more natural. Does anybody know how I could do this?

 

Thanks a lot !

time code and expressions HELP

$
0
0

Hello,

My name is Dalal and I need help in my project, in my project there is a hologram control panel and in that panel is a clock from sec to hours, I followed a tutorial on youtube of how to animate and code sec and mins but not hours I need help in coding hours the time starts from 7:30 AM to 5 PM.

 

Here is what I coded:

 

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

sec = slider%60;

min = Math.floor(slider/60);

 

function addZero(n){

if(n<10) return"0"+n else return n;

}

if(slider>0) {

addZero(min)+":"+ addZero(sec)

}else{

"00:00"

}

Decimal numbers in expression

$
0
0

Hi! I have created a counter on a text layer that counts length in increments om 40 cm controlled by a slider, I added this expression to the source text property and it works great except for the decimals. 

 

t = effect("Slider Control")("Slider")

x = Math.round(t/.4)*.4+0.0001

 

 

x = x + " Meter"

 

 

x.toString().replace(".", ",");

 

 

It now counts 0,001 Meter.... 0,4001 Meter... 0,8001 Meter.... 1,2001 Meter..... but i want it to only show 2 decimals: 0,40..0,80..1,20..1,60...

 

I added the +0.0001 in Math.round to get decimals at the whole numbers. I.e. 4 Meter is now 4,0001 Meter... But how do I remove the last two digits? Or is there another way to always show 2 decimals? I need the counter speed to be controlled over time and masking is a problem since the font I use is not monospaced.

 

Thank you.

After Effects Font Expression

$
0
0

Dear AE expressionators,

 

Concrete: I am making a template whereas the user can change the text font and that it will automatically update this to the hole template.

 

For example, see the picture.

So everything I change in the above text layer the under text layer transforms with it. But if I change the font it doesn't.

Does after effects use a different expression for automatically changing a font?

 

I would really appreciate your help!!!

 

I'm using after effects CS6

Move in x every [10] frames?

$
0
0

Hi!

 

Trying to figure out how out how to script this:

• Move an object forward in x every [45] frames the whole time of the comp. And no movement at all.


I tried doing this setup:

----------

length = Math.floor(thisComp.duration);

lengthFrames= timeToFrames(length);

cycle = lengthFrames/thisComp.layer("Null 2").effect("Value")("Slider");

tid = Math.floor(timeToFrames(time));

 

 

if (tid % cycle == 0) {

transform.xPosition +10;

}

----------

(I used a null layer with a slider for easier debugging and so I can change the value on the fly later.)
The equation results in 0 every 45th frame – which is good but the movement happens every frame. I can't figure out how to trigger a certain movement just on that occasion and nothing else!

 

Somebody in here that has a suggestion how to solve this?

 

 

 

 

Best

Linking x and y position to null sliders separately

$
0
0

Hello,

 

I have a Null Object called "Position Null" with 2 sliders on it called: "Left/Right" and "Up/Down". I would like to link the x position of a text layer below it to the "Left/Right" slider, and the y position with the "Up/Down" slider. How would I go about doing that?

 

Thanks!

Text Anchor Point / Alignment

$
0
0

I Have a Shape and a Text;

 

  • Put "sourceRectAtTime()" expression in Shape size, to be equal Real Text size in pixels. That is, not the size in pixels shown in Chacterer box (nominal size in pixles).
  • Need keep Text, always, on top of Shape aligned.
  • I assured that Text and Shape properties were:
  • Comp = 1280x720
  • Text and Shape:
  1. Achor Point [0,0]
  2. Position [640,360] (middle Comp size)

 

  • I expected to see the text on the shape, perfectly aligned.

forum.PNG

But the value of Anchor Point to Shape is not equal to Text.

"0" for text is = middle in width and low in height.

"0" for shape is  = middle in width and middle in height.

 

Yes, i can drag text to the alignment of Shape.

In reality, the problem is not Height. Not even in Anchor Point. But in Width Position. Why, when I change the text, there variations in the position. Look:

forum2.PNG

When I change text, with Anchor Point is okay, always in center, but the position becomes misaligned.The text leaves the Shape position, going to the right.

This should happen because of variations in the width of the letters, the "sourceRectAtTime()" expression is extremely sensitive to the letters.

 

When I drag to the correct location looks like this:

forum 3.PNG

Except that I can not be dragging, I need everything lines up forever, automatically. Even though I change the text.

 

How to solve this problem?

 

Update: Please, note that if I put some "symbol", larger in height It is also impaired:

forum 5.PNG


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() expression to change key-framed position of solid based on text layer width

$
0
0

Hello,

 

I am making a series of fully-customizable lower-thirds, that automatically scale / change based on the width of any given text layer. I have had success with linking the width of a shape layer to the width of a text layer using the following expression:

 

s=thisComp.layer("FIRST NAME")

x=s.sourceRectAtTime(time-s.inPoint,true).width;

[x, value[1]]

 

I also have a position expression linked to the size.

 

content("Rectangle 1").content("Rectangle Path 1").size/2

 

 

Here is my question:

 

If I want to link a key-framed "end position" of a shape layer to the width of a text layer, how would I go about that? Below is a video of my current animation. A square rolls in then splits in two to reveal text. I want the right half of the square to automatically animate further away based on the width of the text layer. My goal is to make this as user-friendly as possible, so even an 'After Effects Novice' can edit and export!

 

 

The shape layer in question has key-framed animation on both the x-scale, and the x-position. The keyframes are eased and velocity adjusted as below.

 

keyframe velocity.JPG

 

I do realize that I'll also have to write an expression to scale the Alpha Matte in relation to the width of the text layer (which should be similar to my first expression at the top), but that's nothing I can't handle.

 

Please Help!!!

Expression that references fill color and adds or subtracts brightness?

$
0
0

Hey,

 

I'm looking to create an expression that I can add to my bevel "highlight color" and "shadow color" that will reference the fill of a layer and automatically make it brighter by a bit (for highlight) and a version to make it a bit darker (for shadow).

 

I'm assuming I can pickwhip the fill, and then add to that or subtract from it (I'm presuming some sort of array that references the color value?), but I'm not trained enough in expressions to do that.

 

Thanks!

wiggle expression with stepped (not smooth) interpolation?

$
0
0

hi

 

not sure if it's even a wiggle expression I'm after,

 

but I'm wondering how to go about getting a series of random values that an object or parameter will jump to (rather than smoothly transition to, as in the basic wiggle expression).

 

thanks

 

ML

Paragraph align text with Expressions

$
0
0

Under paragraph menu, there is an option to align text to the left, center or right. There is also an option to justify text.

 

How can this me done with expressions or Extendscript?

 

 

I noticed that if I set Anchor point to the top left, additional text added on the same line is left aligned. If I set anchor point to the left-center, all the lines added in the future are left justified, but current text remains as it is. Align options under paragraph don't move anchor point and also work for the text already typed.

 

I guess you could save the text, delete it, move anchor point, paste the text back and move anchor point back where it was to achieve the same effect. But there is probably a better way?

Viewing all 47983 articles
Browse latest View live


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