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

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


Typing on text—getting most recent character

$
0
0

Hi,

 

I feel like the answer to this is probably a resounding "no" but figured i'd ask out there for those who know buckets more than i do.

 

If i have a line of text typing on (say, with the typewriter effect) is there a way to recognize at any given time what the last character typed was?

 

(With the idea that then you could link an object property to a character—e.g. when an A is typed on, an object scale animation is activated.)

 

Thanks for any thoughts anyone has on this!

-tim.

How to automate solids in a shape layer with scripts?

$
0
0

Hello, I'm very new to the forum but I've been looking all around for a solution for this problem and I still haven't found anything that works. I've created a short video of what I want to do:

https://youtu.be/QKCd_S9hPvw

 

I basically have 26 existing rectangles that I want to change the properties of. I need a way to access their Opacity, Color, Size and Position, and also change these over time. How can I achieve this?

 

This is what my shape layer looks like. Any help would be greatly appreciated!

 

s.PNG

Addressing random groups within one shape layer

$
0
0

Hi all,

 

I have a shape layer made out of the digits 2 and 0, filled with smaller letters and numbers.

 

The entire shape layer consists of over 1000 groups (each with path and fills) and the smaller numbers/letters need to make up the the bigger numbers randomly.

 

So, it should work as follows:

 

1. Transparent BG

2. first few small numbers/letters appear with increasing transparency

3. more numbers/letters appear

4. the rest of the numbers/letters appear to finally fill out the entire shape

 

See rough mockup of the resulting shape: Screen Shot 2018-10-25 at 15.53.35.png

 

My problem is that I don't know how to randomly select groups within a shape layer and then address each of their opacity to go from 0 to 100.

I am okish in After Effects but have hardly any experience with using expressions so any pointers would be greatly appreciated!

 

Thanks a lot,

Juliet

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"

}

Layer not respecting opacity setting

$
0
0

I have a list of about 100 layers in a composition. I use this script to create random fading for those layers.

segMin = .3; //minimum segment duration

segMax = .7; //maximum segment duration

minVal = 0;

maxVal = 100;

 

 

seedRandom(index,true);

segDur = random(segMin, segMax);

seed = Math.floor(time/segDur);

segStart = seed*segDur;

seedRandom(seed,true);

startVal =  random(minVal,maxVal);

seedRandom(seed+1,true);

endVal = random(minVal,maxVal);

ease(time,segStart,segStart + segDur, startVal, endVal);

It used to work but I was away from the project for a while and opened the file to make changes for a client. Now they all the layers pulse in unison even though if I expand the layers opacity setting and scroll through the time-line, the values do fluctuate in the opacity field as I would expect. Just the actual render shows the flashing in sync.

This expression statement worked in november of last year and now it doesn't. Did something change? I know AE updated the javascript engine but it was supposed to be compatible with the old engine. Also, I the opacity numbers do what I expect just the render/preview does not.

timer expression

$
0
0

Hi, this is the 1st time i post here & i'm newbie in using expressions i was trying to set out an expression that make my timer follow my progress bar like this

MbbX5Xl.png

sp = thisComp.layer("timer");

ep = thisComp.layer("timer"));

t = comp("Music").marker.key("Music End").time;

val = linear(time, 0, t, sp[0], ep[0]);

[val, sp[1]];

 

but i keep getting

unknown.png

Control a slider with JSON value range

$
0
0

I have a JSON file with a range of values from 416 - 423 which I want to use as the min and max of a slider, but still have the slider run from 0-100%.

 

Basically, I want the slider to read 416 and return 0 and read 423 and return 100.

 

Any ideas welcome. Thanks


Creating a Sports Scoreboard Timer in AE

$
0
0

I have ventured Far and Wide to find the problem with an expression i am using. I am creating a Scoreboard timer for a Soccer game recently recorded. However i have met numerous problems with it. once i get to > 10 mins there is a zero constantly in the minutes column. i see the issues but im not sure what expression i could use to right the wrong. Any help would be greatly appreciated.

 

sec = Math.floor(time%60);

min = Math.floor(time/60);

if(sec<10)

{"0" + min +":0" + sec;}

else

{"0" + min +":" + sec;}

 

Thank you

Using propertyGroup and propertyIndex to automate a grid of square paths using expressions

$
0
0

Hey Everyone,

 

As my long-winded title might suggest, I'm running into an issue trying to solve a very basic problem. I've been struggling with it for 3 days, so now I'm turning to you for help.

 

I'm trying to create a self-contained shape layer that can expand itself

into a grid of squares fitting a composition of 1920x1080 for a flexible transition preset. The first step in this would be to create the squares. I want them to be 120x120 for now, but I'd like to just create one and duplicate the path to fill the screen. Then I want to use an expression using .sampleImage and a gradient wipe control layer to automate their individual scale properties (is there a better way to achieve that? I feel it might be a cpu hog but I don't know what other method might work better for what I want) I'd ultimately add control sliders to adjust the square size, but havent bothered yet as I just want to figure out how to link a squares position to the previous square's size.

 

The expression I made doesn't work (surprise, surprise...) and I want to understand why.

 

Here's what it currently looks like. I'm new to expressions obviously, but I really want to tackle the ability to reference paths within a shape layer as it would really help my workflow, and seems to be extremely powerful. Attaching a screenshot below to further illustrate my problem. Any help is appreciated! Thank you!

propAbove = thisProperty.propertyGroup(3).propertyIndex-1;
x = thisProperty.propertyGroup(3).propAbove.position[0]*propAbove.size[0];
y = content("Rectangle1").content("Rectangle Path 1").position[1];
[x,y]

Screenshot 2018-01-30 12.01.52.png

Change multiple layers' in-point by modifying master layer's in-point

$
0
0

I'm not sure if this is possible with expressions but here's what I want to do:

 

I have a composition with a length of 30 seconds. Inside this composition I have 5 layers that have the same length of the composition, 30 seconds. I have cut all the layers so that their in-point is at 12 seconds and their out-point is at 18 seconds.

 

What I want to be able to do is to have 1 of these 5 layers be my master layer and whatever I do to it all other 4 layers will update. I want to be able to change the master layer's in-point to something like, say, to start at 18 seconds and its out-point to end at 22 seconds. After I do this to the master layer I would like all other 4 layers to have the same in-point and out-point values as the master layer so that all 5 layers start and end at the same time.

 

Also, can I create a marker and by modifying the marker's position in the timeline it modifies the desired layer's in-points.

 

Thank you for your assistance.

Anchor point moving expression

$
0
0

Hi, is there a way to set the anchor point to the top of the shape?

 

(screenshot explanation)

The "LINE" layer is a shape layer (rectangle) that change sizes in relation of how many text lines there are.

With the scale, I want to replicate the trim path effect of a stroke to a rectangle, so its anchor point has to be on the top of the shape.

So I ask you if there is an expression or an option to set the anchor point in a specific point of the shape (that can change sizes).

 

Thanks a lot

 

Screenshot 2018-12-29 at 11.10.16.png

This is the old animation with a stroke

 

If/Else: Linking to layer at specific x point.

$
0
0

Hello,

     So I am attempting to do a fairly complex graphic, but no matter where I look I can not seem to find an answer. I am wanting to write an expression for a layer so that when its X position hits a point it will then Link with another layer.

 

I am trying to write something along the lines of:

if(transform.position[0]=__) Link To thisComp.layer("Layer 2") Else No Change

 

Obviously "link to" and "No Change" wont work when written in my expression, but it doesn't seem like this should be an impossible expression to write.

 

Just so you can have an idea of what I am trying to do:

I want a piece of dirt(.png) to slide across the screen, then when it touches a towel it links to the towel and matches the REST of its motion in the comp.

 

Is it even possible to do something like this? Any help would be great. Thank You!

Linking source text to layer in master comp but looking for number ref

$
0
0

I know that I can link my source text to a master comp with text layers. ( I am not great with expressions as you will see)

 

What I was wondering was is there was a way to tell it that if this comp is labelled reveal 1 reference layer reveal 1 in master text so that when I duplicate the comp it will know to look for reveal 2 when comp ir reveal 2 etc.

 

Could someone point me in the right direction,

 

many thanks

Expression: Jump to marker, when counter turns zero

$
0
0

I need to achieve a jump in the timeline to a marker when the counter turns 0. I have the following code:

 

rate = -1;

clockStart = parseInt(thisComp.layer(1).text.sourceText.value);

clockTime = Math.max((clockStart-1*(time-inPoint)),0)  

 

//if (clocktime == 0) - jump to marker

 

This is setup in the source text of the text layer. Now when the clockTime hit's 0, I need to jump to the position of the marker. Could you please also suggest navigating timeline will come under which property or can I put it under sourceText.


hair with Inertial Bounce

$
0
0

hi.

i want to make a character with hair like a pony tail that bounce a bit with inertia, but keep its end pointing down while moving with a delay to the rest of the head, is it possible?

Expressions (Linear) doesn't work in Media Encoder

$
0
0

Hello,

 

I have a problem with some expressions that doesn't render when I render the composition in Adobe Media Encoder.

For example, I use the linear expression to move a solid from a side of the comp to the other.

Rendering it in After Effects works fine, but rendring it in AME doesn't produce any movement.

 

2019-01-07 09_45_06-Window.png

And the render => Expressions (Linear) doesn't work in Media Encoder - YouTube

 

- I tested with the expression engine "Legacy" and "Javascript" - same problem

- I have AE in english and Media Encoder in english

- I'm on CC 2019 AE v16.0.0 (build235)

 

I don't konw how to upload the AE file but it's ready for you.

 

Could someone help me ?

About to answer for points Delete..!

$
0
0

Hai, Kankemaager pola bender pola tor maa ke code..code.. cood..

Expression to stop scaling in Child connected to Parent on Scale-Slider?

$
0
0

Hey gang- hope all is well.
I'm doing an After Effects project for a client, and I'm by no means an expert, and I need some help figuring out how to get some expressions working properly in relation to some parenting.
I'll see if I can describe it sans-pictures but I'll be happy to provide them if necessary.
There's three aspects to this particular bit of motion graphics- two parallel vertical lines (one parented to the other), one slider controlling ONLY the height-scale of the line (only attached to one line, but the other is parented to said line so it affects the height of both lines), and two separate little "dangly-bits" that extend and scale out of the bottom of the lines as they finish animating.
My client wants the slider to control the height of the lines for easy adjustment for future projects, without distorting or stretching the little flairs that come off them regardless of the size. Easy enough, as I've said I've got one line set to only scale vertically to the slider with this expression I found:
temp=thisComp.layer("VerticalSlider").effect("Slider Control")("Slider");
[temp,100]
The second line is then parented to this line, and voila, they scale just like I want.

The problem comes with the dangly-bits. I want them to always be at the same position hanging off the bottom of the line no matter the length of the lines they're on. Parenting them to the lines themselves does this, but they scale vertically and squish or extend in accordance with the lines' extending with the slider.
I'm trying to figure out if there's an expression I can put into both the dangly-bits so that they will MOVE with the lines (which are not actually moving position, but scaling to become longer), but not SCALE. I've found several expressions from google results and YT videos that seem like they should work based off descriptions, but they only make the distorting problem worse.
Would love some help on this- project's not technically due until saturday but the client would love me to show a close-to-finished project today.
Thank you so much for your help- let me know if anyone needs any more information.

Slider Range Expression Error?

$
0
0

I'm new to expressions and trying to find a way to simplify a slider I have for a client.

 

There's a scaling/stretching animation I have on a null layer called VerticalSlider that starts from 0 on the slider (obviously), goes to 18, and then increases to 83 for a little "bounce" before settling in at its final position at 78.

The point is to have it so the slider is easily customizable for my client in that the opening animation of 0-18 is always the same, but the animation from 18-78 is adjustable so that the animation can stretch less or more.

To tackle this, I've figured a way to simplify things (but also help with some math stuff I'm going to have to do for other expressions that have to be tied to this slider), I want to edit it so that the value of "18" is "0" and the value of "78" is "1." So 0-17 will be negative and 79-83 will be over 1, but the basic scale will be 0-1.

 

As someone who doesn't really understand the language of expressions yet but can deduce a few things through googling, I've found an expression that I think SHOULD work:

temp = thisComp.layer("VerticalSlider").effect("Slider Control")("Slider");
x = linear(temp,0,1,18,78);
[x, value[0]];

 

However, it's giving me an error:

Screen Shot 2019-01-18 at 9.48.39 AM.png

I had a friend put it in their system and they said they did not receive an error.

I'm sure the answer is super simple and I'm just a dunce, but any help would be appreciated. Thank you!!

Viewing all 668 articles
Browse latest View live