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

Expression to constantly change color of a spectrum

$
0
0

Hi,

I'm running a music channel where I upload music regularly, and I need an expression for the color effects on my audio spectrum layer (Inside Color/Outside color)

Basically, I need a way to keep this spectrum constantly changing in a rainbow form, if not I can put in my own colors if needed, if you don't understand what I mean look at the spectrum at the back of the black spectrum, I need an expression that can do that.

Bag Raiders - Shooting Stars (Onderkoffer Remix) - YouTube

Thanks In advance! Also it would be great if it smoothly blended into each color

 


Random scale with equal values for xScale and yScale

$
0
0

Hi there,

 

professional scripters might not think of this to be a problem, but I cannot solve it on my own after hours of trying.

 

I found a random script on www.motionscript.com (thank you so much Dan, for this great resource, you're awesome!).

 

The sample for "random motion - more chaotic" is exactly what I need, but for the scale property with same random values for xScale and yScale (so that the random scaling is proportionally). I cannot figure out how to do this. I know I need another variable, but I don't know where.

 

Actually, I want to have a matrix of dots, each scaling up and down again randomly and independently in size and timing...

 

This is what I got so far:

 

segMin = .3;
segMax = .7;

minValX = 100;
maxValX = 200;
minValY = minValX;
maxValY = maxValX;

minVal = [minValX, minValY];
maxVal = [maxValX, maxValY];

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);
easeOut (time, segStart, segStart + segDur, startVal, endVal);

 

I'd appreciate someone's help without being to demanding :-)

 

Thanks a lot for reading this.

 

Chris

substring() not a function?

$
0
0

Hi!

 

trying to do the simple task of separating 6 characters (numbers) and adding a space after the first 3.


My script reads:

 

 

siffror = parseFloat(Math.round(thisComp.layer("Räknare Slider").effect("Slider Control")("Slider")));

s1 = siffror.substring(0, 3);

s2 = siffror.substring(3, 6);

"Co2 saved: " + s1 + " " + s2 + " ton";

 

it says siffror.substring is not a function.

 

What am I doing wrong here?

Adding functions to expressions - source text not displaying

$
0
0

I am very new to after effects and writing expressions, however I do code in other languages so I have a basic understanding of code structure and I understand what After effects coding is trying to do when I read a sample.

 

My problem is that any expression containing a function call stops appearing on screen. The layer is still there, it's just not evaluating the function and thus the output is null and thus nothing is presented on screen.

 

If I remove the function declaration and the call to the function from the code, the remainder of the code executes without issue, so I can definitely say the issue is with functions in general or the specific code. I have copied and pasted code from verified working projects into my code, but still same result.

 

This makes me think the problem is at the system level. Is there a project setting that needs to be enabled for functions to work properly? Just updated AE to CC2019 (Version 16.0.0, build #235) I have not tried coding in AE before this version so cant specifically tag this to an upgrade...

 

Code I am specifically using for this (countdown timer). Problem is not isolated to this code. I can write simpler functions and none of them work either.

 

duration=thisComp.layer("InputDuration").effect("Slider Control")("Slider");

countdown = Math.floor(duration-time);

minutes = Math.floor(countdown/60);

seconds = countdown%60;

 

function addZero(n) {

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

 

if(duration > 0 && time < duration){
"Time Remaining: " + minutes + ":" + addZero(seconds);
} else {"Time Remaining: 0:00"}

Integers and decimals / Slider Control

$
0
0

I am trying to count up from 00.0 to 27.3, using where each number is made up of 2 digits and 1 decimal place - so for the single digit numbers, there will still be a 0 ahead of it (ex: 3 would be listed at 03.0 when counting up). I found the expression to keep 1 decimal point at all time, even for integers:

 

effect("Slider Control")("Slider").value.toFixed(1);

 

But can't figure out how to have the single digit numbers have a zero in front of them. Does anyone know how to do this?

Change Opacity of a Layer in a Pre-Comp

$
0
0

Hello. I am very new to after effects expressions and I was hoping to get some help.

 

In my project, I am using an instance of 1 pre comp several times in my main composition. I would like to be able to turn the opacity of a single layer off in one of the instances of my main composition. I went to the Opacity property and added:

 

comp("NAMEOFPRECOMP").layer("NAMEOFLAYERWITHINPRECOMP").opacity=0

 

Either the entire precomposition turns off or on with this expression, and also tells me that the name of the layer I am trying to identify in the precomp doesn't exist.

 

Thank you for the help.

How to delay opacity following another layer

$
0
0

Hello All.

 

I have 100+ layers that I would like to fade on in a delayed fashion following the manual opacity key frames set in a 'master' layer. Thus, each of the 100+ layers will incrementally fade on by half a second — after the 'master' layer has faded in.

 

My research has led me to this expression:

 

thisComp.layer("leader").transform.opacity.valueAtTime(time-thisComp.frameDuration)

 

however the above fades in all 100+ layers simultaneously. I'd like the layers to fade in one after the other.

 

 

Can anyone suggest the script to make this happen please?

AE CC 2014 - Wiggle Expression not assigning similar values on scale

$
0
0

So I've just noticed that the wiggle expression no longer works how it used to. I found a released article explaining changes in the Noise Algorithm used for the wiggle expression what’s new and changed in the 2014 update to After Effects CC  |  After Effects region of interest and am referring to the "fixed bug in implementation of Perlin noise algorithm" section.

 

I'm not sure if this is what's causing the issue but let me explain.

 

I'm just adding a wiggle expression on to an object's scale.

wiggle(5,50);

 

This would normally scale the object's parameters with the same value. so it would be (100,100) to (125,125) and so on.

Now however with CC2014 the expression is assigning different values to each value so getting (125, 115) or something even if the 'constrain proportions' button is enabled.

 

So I tried to trick it:

 

temp=wiggle(5,50);

[temp[0],temp[1]];

 

Still got different values even though i'm telling it to insert the same variable?

 

temp=wiggle(5,50);

temp;

 

Still got different values... I don't get it can anyone help?


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

Multiple checkbox related to each other with expressions Enquiry

$
0
0

Hello Guys,

Basically I need to do three colour options only one of them must be selected at a time so for example if I select Red colour then the other two options (Blue & Green) will be deselected automatically.

I've been trying quite hard to get this to work but I can't seems to figure it out alone.
Here's what I did.  3 checkbox controls, all in one layer (R, B, G) to control three colour or anything. And the rule for that is "if R checked in the box then the others un-checked at a time and vice versa".

The idea is a three way checkbox selection which coordinates with each other in the following way:

  • checkbox 1 - if ( (B ==1) || (G == 1)) false; else true;
  • checkbox 2 - if ( (R ==1) || (G == 1)) false; else true;
  • checkbox 3 - if ( (R ==1) || (B == 1)) false; else true;

It's seems like all work fine but when I checked the boxes nothing would change on the effected layer that I linked it with all checkboxes.
If you managed to understand what I'm trying to do, I'd love to hear your thoughts about this and what I am doing wrong.



I use this expression for each checkbox
R checkbox:

R = effect("R")("Checkbox"); T = effect("B")("Checkbox"); C = effect("G")("Checkbox");  if ((T == 1) || (C == 1)) {false} else  true;

B checkbox:

R = effect("R")("Checkbox"); T = effect("B")("Checkbox"); C = effect("G")("Checkbox");  if ((R == 1) || (C == 1)) {false} elsetrue;

G checkbox:

R = effect("R")("Checkbox"); T = effect("B")("Checkbox"); C = effect("G")("Checkbox");  if ((T == 1) || (R == 1)) {false} elsetrue;

The effected layer I did this rule:
Red = thisComp.layer("Red").effect("Fill")("Color"); Blue = thisComp.layer("blue").effect("Fill")("Color"); Green = thisComp.layer("Green").effect("Fill")("Color");  R = thisComp.layer("Controler").effect("R")("Checkbox"); B = thisComp.layer("Controler").effect("B")("Checkbox"); G = thisComp.layer("Controler").effect("G")("Checkbox");  if (R==1)  Red; else if (B==1) Blue; else if (G==1) Green; else value;

 

The project file in this link Project checkbox test


 

Text animation, with frame offset expression

$
0
0

I'm using a few text animators, so that words will appear a letter at a time, but have a subtle fly in from top.. i've got about 400 minutes of dialogue to animate, so being able to add this expression would help greatly!

frame 1 - letter appear frame 2 - moves down

is there a way to set an expression on the moving down keyframes, that will reference the letter appearing, but delay the start by 1 keyframe? (by adding to the: "text.animator("WORDS APPEAR").selector("WORDS APPEAR").start") expression when i pick whip.

hopefully the linked image makes more sense of it!

As an extra note/confusion, the text doesn't always come in on frame 1 - so perhaps like a 'current frame +1' kind of thing!

thanks for the help!

 

help, please-01.jpg

Why do I need an expression to Scale X/Y independently?

$
0
0

Scale is what... the 2nd or 3rd most used form of motion?

 

So why do I need an expression (and a **** tonne of googling) to find out how to link the X or Y scale of an object independently to a slider?

 

Why doesn't each of the two scales (X/Y) have the ability to simply be pickWhipped to a Slider or any other form of controller?

 

Would make sense, surely. And save newcomers a world of time.

 

UPDATE: Part 2 of this question:

 

If this works:

[temp, temp]

 

then why can't this work?

[temp, value]

 

Would this also make too much sense?


Surely it would be far more logical than this nonsense:

[temp[0], value[1]]


opacity of an image 0 or 100 tied to voice volume keyframes?

$
0
0

This is probably going to be stupidly easy, but I'm relatively new to AE, and I'm stumped.

 

So what I'm trying to do is make a little speaker symbol (similar to what you see in your taskbar) that reacts to audio.
For the quieter stuff, only one bar becomes visible, and for the louder/max stuff two/all three become visible.

 

And I mostly have it. But the different bars have a range of opacity. I just want them on/off within that range.

 

For example, the opacity of this .png is pick-whipped to a slider on the audio track. The slider has this expression on it: linear(value,2.6,4.9,0,100)

 

Works pretty good, but the opacity needs to be an on/off kind of thing, and not a 0-100% kind of thing.

 

Here's a screenshot:

Imgur: The most awesome images on the Internet

 

I've been trying to learn some if/then expressions, some checkbox stuff, and some 0 else 100 stuff... but correctly implementing any of them for this specific task has, so far, been unsuccessful.

 

Thank you for your help.

 

Message was edited by: derick white, typos

expression error:property or method named in class array is missing or does not exist.

$
0
0

biaodashicuowu.PNG

hi,my friends,

I from china,

it is unfortunately,my english is poor.

so,there are many mistake in this post.

like this,words or grammar is wrong.

I am sorry.

I meet an expression error:property or method named in class array is missing or does not exist.

It saids:

=================================

after effects warning:

expression disabled.

error at line 35 in porperty 'source text' of layer 1(bfs) in comp 'biaodashibenfen 2'.

property or method named '0' in class 'array' is missing or does not exist.

it may have been renamed,moved,deleted,or the name may have been mistyped.

==================================

please look the picture.

expression is below the==============

==============

l=thisComp.layer("peilai");

ain=0;

bout=100;

p=l.transform.position;

c=bout-ain;

dqz=time/thisComp.frameDuration;

ps=[];

mzjls=[];

dqjls=[];

bfs=[];

    if(dqz<ain){

    idq=0;

}

if(dqz>bout){

    idq=0;

}

else{

idq=dqz-ain;

for (i=0; i<=c; i++) {

    d=(ain+i)*thisComp.frameDuration;

    ps[i]=p.valueAtTime(d);

    if(i>=1){

    mzjls[i]=length(ps[i-1], ps[i]);

    dqjls[i]=dqjls[i-1]+mzjls[i];

}

else{

    mzjls[i]=0;

    dqjls[i]=0;

}

}

for (i=0; i<=c; i++) {

    bfs[i]=100*(dqjls[i]/dqjls[c]);

}

}

bfs[idq].toString();

===========================

the line 35 :

bfs[idq]

maybe is wrong.

But I dont know why is wrong?

How can I fix it?

Thanks a lot!

Expression to change text in precomposed comp from main timeline

$
0
0

If I have a pre-composed animated comp for some lower thirds, is it possible to set it in a way that the text inside it can be changed from the main timeline?

 

I would like to be able to place the the lower thirds comp on the timeline, then change an expression on it for the string used for source text, without having to modify the precomp's contents.

 

Will need to use the precomp multiple times, so I would like to avoid having to duplicate it each time I need to change the text in it.


How to move another shape layer with SourceReactAtTime expression

$
0
0

Hi there!

 

I am having a bit of an issue with expression in After Effects. I have added a image attachment to make my explanation more clear.

 

I made an shape layer (B in the image attachment) with a sourceReactAtTime expression. So that the shape will react to the input of the text. Now I want the quotations (A in the image attachment) always moves to the upperleft corner of the shape layer. What is the easiest way to do this?

 

Thanks!

 

Cheers,
Paul

Help.jpg

counting numbers expression with commas

$
0
0

I am using the following expression to create a number countdown but I need it to recognize or insert commas in eight digit numbers. Can anyone tell me how to alter it:

 

 

startT = 0;

endT = .5;

beginVal = 12400000;

endVal = 10700000;

t = linear(time,startT,endT,beginVal,endVal);

Math.floor(t) + ''

 

 

P.S. there are also times that I'd like to add dollar signs or percent signs.

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!

Scale Shape & Text Expression

$
0
0
  • It has an expression on the (Rectangle Path 1) property "size" of a shape that follows the size of a text. Every time I change the text (his name changed), the expression automatically changes the text name of the reference to the expression continue working. So far so good.

 

  • The problem happens on the (Transform: Rectangle 1) property "scale" of the shape, which also has an expression and is following the "scale" of the text as well. When I change the text characters, the expression does not change the reference automatically, resulting in an error. Why does this happen on the property "scale" of shape?

 

  • Do not made auto updates in expression and generates error. I have to keep correcting all times, which is tiring.

 

See the image, I changed the text "Because I'm happy" to "Clap along". The property "size" of the shape automatically changed to "Clap along", but the property "scale" of the shape was like before with reference to layer "Because I'm happy" which resulted in an error.

 

to see.PNG

Windows 8.1

After Effects CC 2014 updated

 

Thanks.

 

Update:

 

It has something to do with the expression of the shape in the above property, "size" in, I think the After read the expressions in order, from top to bottom, expression in "size":

 

x2 = effect("x2")("Slider")

y2 = effect("y2")("Slider")

x = thisComp.layer("Clap along").sourceRectAtTime().width + x2 / content("Rectangle 1").transform.scale[0]*100;

y = thisComp.layer("Clap along").sourceRectAtTime().height + y2 / content("Rectangle 1").transform.scale[1]*100;

[x,y]

 

It makes a reference to expression of the property that comes after ("scale"), as follows:

 

content("Rectangle 1").transform.scale[0]

content("Rectangle 1").transform.scale[1]


What it must be causing the error because when I turn off the expression above in "size" the expression in "scale" works correctly.


(I mean, when the text is changed, the expression changes also without I'm having to edit within the expression to work.)

wiggle between parameters

$
0
0

I want to wiggle between 2 values. So that my glow stays bright enough to see and still flickers.

 

why would this not work?

 

x= (50-75)

wiggle(4,x)

Viewing all 47983 articles
Browse latest View live


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