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

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?


Audio Amplitude Range ?

$
0
0

Hello. When make an audio amplitude and make a certain effect react to the audio linear(value,xx,xx,yy,yy) how can you find the xx,xx values using trapcode soundkeys ?

Change value if true, if false keep the value

$
0
0

Hello, I'm using this code:

if(thisComp.layer("tick 10 frames").transform.opacity==100){  if(thisComp.layer("audio").effect("Both Channels")("Slider")>12){  value=100;  }else{  value=0;  }
}

And I would like that is the first "if" is false don't change the value but after a lot of tries I don't know how to do it.

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?

Time Remap with expression slider not frame accurate

$
0
0

Hi all, first of, I hope this hasn't been posted before - I couldn't find anything on this specific issue.

 

I have a simple mockup character rig with 3 compositions.

01_Character is where all the controls would be.

02_Head is the head subcomp.

03_Eyes is for the different eye states. It's only 3 frames long and on each frame is a layer containing a different eye.

 

In 01_Character is a null object with a slider control. This will be used to switch between different eye states. 02_Head has been added to 01_Character as a layer.

03_Eyes has been added to 02_Head as a layer. This 02_Head layer has Time Remap activated. There is an expression on the time remap:

 

control = comp("01_Character").layer("Control").effect("Numbers")(1);
framesToTime (control -1)

 

Now when I animate the slider in 01_Character comp the eye states (in my mockup numbers) appear and disappear as planned. However this only seems to work while the values increase. As soon as I animate decreasing values the number-states always switch one frame too soon.

That's only when I animate the switches with hold keyframes. When I animate with linear keyframes, the highest value - which should appear for one frame - doesn't appear at all, even though the animation curve shows the correct values.

 

In this screenshot the curve shows value "3", however eye #2 is rendered.

 

Here the animation curve shows the value "3" but #2 is rendered instead.

 

Any ideas on why that's happening? I have played around with different Math.floor and Math.round functions, but I can't seem to resolve this.

Or do you have any alternative ideas for switching asset states? I could put expressions on each layers' opacity, but that has an impact on the rig's performance if I have e.g. 5 x 2 eyes. 5x2 eyebrows, 20 mouths, 20x2 hands, etc. each with their own opacity expression.

 

Cheers, Michael

Making the wheels of a car roll right

$
0
0

I have a photo of a car with the wheels separated, and I want to find an expression or something that will help make the wheels look like they are rotating at the right speed.  Any suggestions?

 

I have used AE for a while but expressions are still pretty foreign to me.

 

Thanks for any help!

Set inPoint with expression?

$
0
0

Hi,

 

Is there some way to set the in and out points of a layer in an expression?

 

thisLayer.inPoint seems to be read-only...

 

Thanks,

 

S

"global" function in expressions

$
0
0

Hi guys,

 

I'm looking for something very basic with expressions but can't seem to find it. I want to define a function and use that function inside ~100 or so layers. At the moment I'm typing a couple of lines of code inside each expression layer to drive the position of each layer which is insane of course. I just want to define one function (and define it only once):

 

function getPosition(null1,null2,offset){

     ...stuff..

     return position

}

 

And in my comp, use that function everywhere to drive the position attribute for example:

 

getPosition("null5",null6",0)

 

Writing that function inside each expression is a bit daft of course but I can't seem to find a way to define such a function to use throughout my comp. Could anyone point me in the right direction? Thanks!


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.

Change text colour with an existing slider control

$
0
0

Hi guys, I am making a 9:16 (vertical) graphics template themed with the logo and colours of the 20 teams of the English Premier League.  My expressions knowledge only goes so far as wiggle and a bit of pick whipping!

 

I am trying to make an essential graphics template so that the editors can use the slider to pick the team that they want to have as their on screen graphic in Premiere (rather than having to go into AE).

 

So far I have in my essential graphics tab the four lines of text, the slider, and a comment which tells the user which team is which number. The slider goes from 1 to 23 (20 teams plus three others).

 

 

Here is what that looks like:

Screen Shot 2018-02-05 at 10.27.04 PM.jpg

I have so far been able to use the slider to change the logo (by making all other logos 0% opacity), to change the name of the team (by making all other team names 0% opacity) and to change the background colours of the boxes.

This is the expression I used to do all of this. It is in the opacity setting for each object:

 

 

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

 

 

if (slider == 6) 100 else 0;

 

 

My problem is that I also want to be able to change the colour of the text when the slider is changed. Does anybody have any idea of how I can do this?

 

 

Below is the project file:

 

https://www.dropbox.com/sh/0yrknu66b8fjvcg/AADNJFMAoNLRlT7INQ1yh9rla?dl=0

 

Thank you!

 

David.

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?

Can I Animate Individual Characters in a Text Block Using the Wiggle Expression?

$
0
0

I'm new to After Express and just diving in to expressions. I was trying to figure out if there was a simple way to use the wiggle expression in a way that it would wiggle individual characters in a text block independently of each other.

 

Definitely appreciate any help.

SourceRectAtTime ERROR

Custom easing function start time

$
0
0

Hey everyone, I'm attempting to write an expression to animate values using a custom easing amount, to use as a replacement of the inbuilt "ease(t, tMin, tMax, value1, value2)".

I have everything working, except can't seem to work out how to get the animation to start at a specified time (it currently always starts at 0 rather than startTime.

 

Here's my expression as it is currently:

 

var startVal = value; // Start value
var endVal = value + 500; // End value
var duration = 1; // Duration in seconds
var easing = 5; // Easing amount, 1 is linear
var startTime = 2; // Starting time

easeValues(duration, startVal, endVal, easing, startTime)

function easeValues(dur, startV, endV, ease, startT) {

  normalizedEasing =(Math.ceil(ease/2) * 2)-1;  var easedTime = easeTime(startT + time, startT, startT + dur, dur);  return linear(easedTime, startT, startT + dur, startV, endV);
}

function easeTime(t, b, c, d) {
  if ((t/=d/2) < 1) {    return c/2*Math.pow(t, normalizedEasing) + b;  } else {    return c/2*((t-=2)*Math.pow(t,  normalizedEasing -1) + 2) + b;  }
}

Anyone able to shed some light on why it might always be starting at 0?

 

Thanks,

Tim.

How to use Expression to Mask Path vertices

$
0
0

Hi guys,

In Expression Language Reference(https://helpx.adobe.com/after-effects/using/expression-language-reference.html), I find an method called "points()";

 

and there is an example like:

  • Example 2

The example reads the coordinates of the first vertex of Mask 1 on Dark Gray Solid 1 and converts them to composition coordinates. Apply this to a 2D point control of an effect, such as Write-on or CC Particle Systems II, to make the effect trace or track the first point of an animated mask. Duplicate the effect and change the path points index value ([0]) to trace or track the other points of the mask.

myLayer = thisComp.layer(2);
myLayer.toComp(myLayer.mask("Mask 1").maskPath.points()[0]);

emm...

but when I try this, I get en error message saied:

points() method is undefined.....

So I confused about points() method,

 


Multiple Expression To One Property

$
0
0

Hi everyone,

 

I have wiggle expression on rotation property of the layer with keyframes. I also want to add master Dan Ebberts' pendulum expression on the same property. Is this possible? I tried if else statement with checkbox (if checkbox =true do wiggle thing else do pendulum) but gave me error message "cannot assign value because it is read only". By the way this layer is Duik's controller and parented to zero object. Is there a way to do it?

 

Thanks.

Help with write on text with curser using an expression

$
0
0

Hi There,

 

I have text writing on with a cursor using this TUT: AE Tut'z - How to Create a Type-Text Effect with a Blinking Cursor - YouTube

 

L = text.sourceText.length;
T = time*effect("Speed")("Slider") -effect("Start At")("Slider")* effect("Speed")("Slider");
F = Math.round(time % 1);

if(F == 1 | (T<L & T>0)){Fl = "▇";}else{Fl=" ";}

substr(0,T) + Fl

 

 

Questions:

 

1.

How would I double the speed of the cursor blink?

Have tried 0.5 under time and the if statement (and tried 2) but then the cursor doesn't show at all.

 

2.

How can I make the cursor start on, then blink?

Currently it starts off but it should be on to start. I tried swapping the cursor "▇"in the if/else statement but then the cursor doesn't show while the text types on (as expected).

 

 

Pretty green when it comes to this stuff so any help or pointers in the right direction would be juch appreciated.

 

Cheers

 

Ben

Sawtooth / asymmetrical oscillation expression

$
0
0

How can I make a value translate (linear) from X to Y over Z time, then instantly jump back to X and repeat infinitely?

Difficulty w/ Expression speed and frequency control: Unable to create a smooth value oscillator when changing frequency over time

$
0
0

Hi there. I have a somewhat advanced question about speed and frequency control expressions, and I'm hoping some expression gurus out there may be able to help.

 

I'm trying to create an expression to animate an oscillating diameter of a circle that smoothly responds to changes in frequency value over time. Using slider controls, I've assigned the values of the initial circle diameter, its oscillation amplitude, and oscillation frequency. I can keyframe changing frequency values over time, but when I do this, an uneven animation results. Please refer to my attached screenshot for reference:

AESS_1.jpg

 

The green graph represents the circle diameter size (to be completely specific, this is the 'Starting Thickness' value of the 'Beam' effect made to look like a circular glowing eye). The pink graph represents the slider value of the frequency value control. It starts at .5 and increases to 1.4 over about a second, but as you can see from the graph output when this occurs the frequency of the diameter size oscillation abruptly jumps to a rate faster than the intended target rate before arriving at the target frequency - not gradual at all. I realize I could convert my expression to keyframes and smooth things out this way, but I'd prefer to find a solution w/ the expression itself. Can someone please advise me how to create an expression that will result in a smooth, gradual change in frequency?

 

Below is my current expression. I use sliders to define the maximum sphere diameter size and it oscillates to a smaller diameter size and back again depending on the value of "amp" and "freq". I also have it designed to only begin the animation after a specific keyframe is reached in the composition to ensure a smooth animation (w/ out this :

 

initEyeSize = effect("Sldr-EyeDiameter")("Slider");

freq = effect("Sldr-EyeSizeFreq")("Slider");

amp = effect("Sldr-EyeSizeAmp")("Slider");

FXstartFrame = effect("Sldr-FXStartFrame")("Slider");

currentTime = timeToFrames();

t = currentTime - FXstartFrame;

 

if (t >= 0)

  {thisProcTime = currentTime - FXstartFrame;

  finalEyeSize = initEyeSize - Math.abs(amp*Math.sin(freq*framesToTime(thisProcTime)*2*Math.PI));}

else {initEyeSize;}

 

I am familiar with Dan Ebberts' expertise in the area of motion scripting and have consulted this article extensively, which is about achieving smooth frequency transitions over time w/ his linear keyframe integration technique. Specifically, I think this expression holds the key to my solution, but I'm having a hard time wrapping my head around how to integrate it w/ my current expression:

 

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

amp = 100;

n = freq.numKeys;

if (n > 0 && freq.key(1).time < time){

  accum = freq.key(1).value*(freq.key(1).time - inPoint);

  for (i = 2; i <= n; i++){

  if (freq.key(i).time > time) break;

  k1 = freq.key(i-1);

  k2 = freq.key(i);

  accum += (k1.value + k2.value)*(k2.time - k1.time)/2;

  }

  accum += (freq.value + freq.key(i-1).value)*(time - freq.key(i-1).time)/2;

}else{

  accum = freq.value*(time - inPoint);

}

value + amp*Math.sin(accum*Math.PI*2)

 

My current expression allows me to generate sine wave oscillations starting from a specific keyframe of my choosing vs. the start of the composition as I understand is standard expression behavior -resulting in a smoother animation of my oscillating sphere diameter. I'd like to preserve the functionality of my current expression while integrating Dan's expression, but my previous attempts have been unsuccessful b/c Dan's expression seems to work off of the inPoint time of a layer, whereas mine is working off of time in frames as measured from a specific keyframe starting point ('FXstartFrame') not at the start of a layer. Plus I'm having a difficult time comprehending the inner workings of Dan's expression.

 

Are there any expression wizards out there who know how I can integrate Dan's expression into mine so that the value oscillation begins after a specific keyframe is reached AND the oscillation frequency gradually changes when the frequency value changes over time?

 

To help clarify all this, I'm attaching a video clip of what I'm working that reflects the animation going on indicated in my screen shot above. It features the animated circle (a glowing eye) static before the target keyframe is reached, then oscillating at the initial frequency, then oscillating wildly during the transition from frequency one to two, then oscillating at the final target frequency.

 

 

 

Please let me know if you need further clarifications, I realize this is somewhat of a complicated series of questions.  Thanks in advance for any help you can provide!

Slider only scale X

$
0
0

Hi I got a slidercontrol = xScale

and a shape named = BAR

 

What expression would only scale the X

 

Regards

Flemming

Viewing all 47983 articles
Browse latest View live


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