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

Limit Rotation Expression

$
0
0

Hi all. A (hopefully) quick question. Can anybody please advise on a basic expression to limit the rotation of an object when rotated manually. For example, so it can only move between 0-360, and no further in either direction?

Thanks in advance or any help!


change color according to value

$
0
0

Hey.

 

I want to make an expression for a randomly changing number, (so far so good), but each time it will change a value, I want it to change color relatively to the previous value it had. MEANING... if it will goes up, then it will change to blue and if down then to orange (for example).

 

one more thing. I want it to change value every few seconds and do it with a "hold interpolation" so it will jump to the next value instead of working it's way toward it...

 

 

now.. so far I got this: (for the first part anyway)

------------------------------------------------------------------------------------------ -----------------------------------

 

upColor = thisComp.layer("Ctrl").effect("Up Color")("Color");

downColor = thisComp.layer("Ctrl").effect("Down Color")("Color");

value = thisComp.layer("Ctrl").effect("Slider Control")("Slider");

prevframe = thisComp.layer("Ctrl").effect("Slider Control")("Slider").valueAtTime(time - thisComp.frameDuration);

 

if(prevframe.valueAtTime < ((time * 25) % 2 == 0).valueAtTime))downColor else upColor;

 

value;

 

------------------------------------------------------------------------------------------ -----------------------------------

Capture.JPG

any ideas?

 

thanks!

Ido.

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

Unterminated String Constant...

$
0
0

I'm trying to create an expression for the X position of a layer containing an image that hooks it to a slider control in a Null.

I keep getting an "Unterminated String Constant" error for anything that uses a name.

 

thisComp.layer("Carousel Controls").effect("Slider Control")("Slider"); —Gives the error

thisComp.layer(1).effect("Slider Control")("Slider"); —Works, but isn't preferable

 

If I change the name of the slider control to Expand:

thisComp.layer(1).effect("Expand")("Slider"); —Gives the error

 

I've done this in the past and it's a pretty straightforward thing I'm attempting.

Opacity expression question

$
0
0

Hello I`m looking for an expression that randomly (within parameters)  switches a layers opacity on or off, but crucially does so by fading up and down ( X seconds) rather than just on or off ( which I have an expression for). Can anyone help, thanks  John McGeoch

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

set scale in pixels in After Effects using Expressions

$
0
0

Hey everyone!

 

I often set the scale in pixels, using right click on a scale, hitting Edit, and then enter scale in Pixels. How can set the scale using expressions? And generally, how do you set the units using expressions?

 

returning ["200px","200px"] results in error

 

Thanks for help!

animating a slider control where only last keyframe is the result of an expression

$
0
0

I apologize if this is an exceedingly obvious thing, but I'm having a hard time wrapping my head around how to do this. I'm importing data from a JSON file to drive a slider control animation. I want to choose the time on the time slider (with a keyframe?) where the slider control for a layer is set to 0.0, and then I want to choose a time on the time slider (another keyframe?) where my slider control will be set to a value pulled in from my JSON file.

 

So I want to manually set the first keyframe of an animation, but I want the last keyframe to be a value that is determined by an expression. I've had success pulling in JSON file data using expressions for other layers (changing "sourceText," for example), but the way to bring in the data so it defines a keyframe value is eluding me. I've searched the forum and looked at several different expression tutorials found through internet searches, but I'm not finding anything that addresses this particular question. Your help will be greatly appreciated.

 

Thank you!


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.

How to control only the WIDTH of a rectangle with slider control using expression

$
0
0

I have a simple rectangle shape layer that I want to control (only the width) with slider control using expression. How do I do that?

 

Thanks in advance.

How do I offset only the Y position?

$
0
0

I am creating a scrolling background using CC RepeTile and Offset. When I apply the expression below to the Shift Center To setting of Offset, the background scrolls diagonally down and to the right continuously. I want the scroll to move along only the X axis. How is this accomplished?


effect("Offset")(1)*time

 

Thanks!

Slider control for shape layer fill colour

$
0
0

Hello, I'm trying to make a motion graphics template with colour as one of the options. Instead of the colour picker, I'd like to make it so it's on a slider and each number value is associated with a different colour. As of right now, I have a shape layer that is "parented" to a null object with the slider control effect on it.

 

Right now my expression code is:

slider = thisComp.layer("CONTROLS").effect("Slider Control")("Slider").value;

if (slider == 0)

  [48,26,23,0]

else if (slider == 1)

  [30,157,139,1]

else if (slider == 2)

  [0,122,135,1]

else if (slider == 3)

  [149,82,20,1]

 

But when I change the slider to each of the values (0-3). the shape layer isn't changing to the colour I want. It's changing between white and a bright blue and yellow, which aren't the values I've put in. I am using RGBA values.

 

Not sure what I'm doing wrong, can anybody help?

Scale over time expression

$
0
0

I'm trying to have an element scale up and do so through an expression:

 

startScale = 100;

endScale = 300;

scaleUpTime = 5;

 

s = ease(time, inPoint, inPoint + scaleUpTime, startScale, endScale);

[s,s]

 

 

This works but I'd like to modify this is that the endScale is actually a random number between 100 and 300.

I'd also like the whole thing to trigger at a specific time (or frame).

 

I tried random(100,300) but it gives a jittery result not a constant scale up to a random value

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!

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.


AE: Expressions - Animate position change of each layer from top to bottom?

$
0
0

So I just started using AE this week. I'm a super newbie. Any assistance you give me is appreciated, but should also be dumbed down so I can follow it.

 

I'm making these dungeon tutorial videos for Final Fantasy XV and I started working on the first project.
I spent about an hour making 1 table and animating it, and I will obviously be using this same table for every dungeon tutorial, but rather than copying and pasting every layer and making new compositions and yadda yadda, I started looking into expressions today to achieve this (I'm assuming simple) effect that I'm going for.

 

So essentially, picture this in your brain.
The dungeon tutorial is something you'd see in a strategy guide. The first 30 seconds of the video feature: The Treasure you will find in the Dungeon, the Monsters you will fight in the Dungeon, the name of the Dungeon, the Dungeon Level, etc. And each of these things I will need to be able to customize for future dungeon tutorials, so naturally I don't want to spend 8 years editing these things keyframe by keyframe, that's just madness. I'd rather play the game.


I have 1 Composition named "Treasure Overview"
And this Composition is made up of 14 Pre-Comps.
Each Pre-Comp is basically a row in a table.

 

So picture the table as such:

(Pre-Comp 1) TREASURESALE VALUE
(PC2) Earth Gemstone1500
(PC3) Beautiful Bottle120
(PC4) Strong Bone200
(PC5) Rough Scales250


etc...

Each Pre-Comp is comprised of 4 layers:
- text: TREASURE
- text: SALE VALUE
- background for Treasure
- background for Sale Value

 

Super easy, nothing fancy

 

For simplicity sake, let's say that the first row of the table is at position (0,0)
That would put row 2 at (0,1)
row 3 at (0,2)
row 4 at (0,3) etc

 

I want to animate the rows in the table using expressions. So that the rows basically unfold vertically.
They all start at (0,0) and end up in their final position (0,1) (0,2) (0,3), etc

 

SO FAR, the only thing I've managed to do is create an expression on each layer so that the Y position is offset by 38 (the height of each pre-comp)

 

y = thisComp.layer(index-1).transform.position[1];

[0, y+38];

 

this sets the y value for each row in the final position that it's supposed to be in, but I can't get it to animate in succession.
I've tried looking up tutorials using valueAtTime()

 

and that works... but not really. I'm clearly missing something, because I can't seem to specify both the POSITION AND THE "DELAY in animation"
every time i follow these tutorials I get errors upon errors when I try to adjust the tutorials to fit what im trying to do

 


I need something like (pseduo-code incoming)

 

thisLayer.transform.position[0, y+38].valueAtTime(time + 5);

 

Something that will let me specify the start and end position and the delay in animation
using an expression

AE 2018 Math function

$
0
0

Hi All,

 

Appreciate some help for a newbie.

 

I am using the text slider function on Comp 1.

in the source text I have the expression effect("Slider Control")("Slider").value.toFixed(0,)

 

this works no problem.

What I am trying to do is have the number displayed only increase in increments of 10. so example if its 15 then its 20 but if its 14 its 10.

 

I have found many expressions, however I cannot make any work, either I'm using the wrong syntax or the wrong location.

 

Appreciate if someone can tell me exactly where the expression is put and what it says.

 

thanks

Text tracking amount contoled by source text via expressions

$
0
0

Hi all,

I've spent a pretty stupid amount of time trying to figure this out, and I'm guessing someone here knows exactly how to do this:

 

I need to setup a bunch of Live Text Templates in AE, to be used by editors in Premiere.

I need to provide extra controls that do not exist off the bat, and I plan to do so via non-visible text layers that drive numeric data linked to the properties I want to control.

 

The basics of what I'd need:

 

Text Tracking that can support negative and positive values. '0' is pre-entered

Text Scale- which could be the layer scale

Layer Position in X,Y

 

These are the current minimum controls I'm looking for, and I know they are pretty humble goals. But I can't figure out the syntax of how to get my typed "0" to be read as the value needed to drive the Text tracking, specifically. I have never learned JS, and have sub-rudimentary expression skills.

 

I'd love to see a set of these type of Live Text Template specific expression controls (Driven solely by text entry in Premiere) posted somewhere online, as I have NOT been able to find them.

 

Many thanks!

D

PS after deliberation and tests, I have made the decision not use Essential Graphics .MOGRT workflow (as disappointing as that is), as the current implementation of EG is not suitable for administering graphics templates on a facility scale.

This was put most concisely and constructively in this thread Motion Graphics - Limits & Frustrations when put to actual use.

How to delay an animation

$
0
0

Sorry for my bad english: i'll try to be clear.

Once a layer has some animation (position, scale etc),

how can i link another layer to this first one (or the animated property of the first one to the another equivalent one)

and make the second layer animation delay some number of frames?

 

Another situation:

same start point above, but, after duplicate that layer,

how to delay the animation time some frames?

 

Thanks for the attention

Is it possible to confine expressions to specific keyframes?

$
0
0

I am definitely a beginner when it comes to expressions.

I am currently using a "bounce" expression on the position parameter of some objects as they come on screen. However, the next time they change positions, I don't want them to bounce. Every time a motion tween ends in a static position, the position expression gets applied and the stuff is moving around.

I'd like to be able to keyframe the expression so that it worked only when on the keyframes that it makes sense to affect.

 

amp = .05;

freq = 1;

decay = 7;


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

     value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);

}

else

{

value

}

 

I got this script from somewhere online. The only thing I know how to manipulate are the initial values of amp, freq, and decay.

Viewing all 47983 articles
Browse latest View live


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