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

How do text layer expression selectors operate on character value?

$
0
0

I'm banging my head against my desk here.  Every other attribute I try to animate using expressions selectors works by multiplying the value returned by the selector by the value of the property in question.  But I can't make heads or tails of what an expression selector does to either Character Value or Character Offset properties.

 

Has anyone had any luck with these?

 

I'm just trying to transcribe the characters from one text layer into another using the expression:

 

 

MT = thisComp.layer("Master Text").text.sourceText;
if(textIndex < MT.length) MT.charCodeAt(textIndex) else 32

 

 

I set my character value to 1, and left the Amount property set to [100,100,100] thinking the value coming out of my expression would be multiplied by 1.  Instead, the results I get are nonsensical.  Is there something obvious that I'm missing?


Numbers expression - add letter "B" for billions

$
0
0

I have a question for Dan Ebberts.   Dan, the expression you have for a text layer for  numbers (see below)  I wanted to see if it's possible to add a letter at the end of the expression such as the letter B to represent Billions so that the final number count would be $1.7B.  I appreciate any help you can provide

 

Best Regards

 

Ira

 

numDecimals = 1;

commas = true;

dollarSign = true;

beginCount = 0;

endCount = 1.7;

dur = .5;

 

t = time - inPoint;

s = linear (t, 0, dur, beginCount, endCount).toFixed(numDecimals);

 

prefix = "";

if (s[0] == "-"){

  prefix = "-";

  s = s.substr(1);

}

if(dollarSign) prefix += "$";

 

if (commas){

  decimals = "";

  if (numDecimals > 0){

    decimals = s.substr(-(numDecimals + 0));

    s = s.substr(0,s.length - (numDecimals + 0));

  }

  outStr = s.substr(-s.length, (s.length-1)%3 +1);

  for (i = Math.floor((s.length-1)/3); i > 0; i--){

    outStr += "," + s.substr(-i*3,3);

  }

  prefix + outStr + decimals;

}else{

  prefix + s;

}

Source Text slider apparition

$
0
0

Hi,

 

I would like to use a slider to display a text (when the slider value is 0, the source text display nothing, when it is 10, the source text display the 10 first letters etc...). Like the Typewriter animation effect (but I need it with a Source Text expression)

 

 

I created a slider named "TextSlicer"

Wrote a text layer

And this expression in Source Text :

 

try

{

text.sourceText.split("")[Math.round(effect("TextSlicer")("Slider"))] 

}

catch(err)

{text.sourceText }

 

 

With this expression, I can display one letter at time.

 

My goal would be to display N letters, based on the slider value :

text.sourceText.split("")[0] + text.sourceText.split("")[1] + text.sourceText.split("")[2] + text.sourceText.split("")[n] ............

 

 

 

 

 

Thanks !

After Effects Universal Expressions

$
0
0

1. What are universal expressions?

  • I want examples of applications of universal expressions and how to identify non-universal expressions.


  • When my project use non-universal expressions, I can use a plugin called "ExpressionUniversalizer 2" to support all languages.

2. But there's another way to get the result of transforming the non-universal expressions in universal without use the plugin?

 

Please provide me all possible details.

 

I need to create a template that uses expressions and need that the template supports all languages.

 

Thanks!

Visualising audio as analog VU meter

$
0
0

Hey,

 

So I'm kinda new to AE, but I know enough to get around so that's clear now.

So I'm starting up a YouTube music channel and I'm trying to find out how to represent audio as an analog VU meter.

The image I am working with is below, and as you can see, it has 7 empty VU meters which I want to represent each track I have (7).

Does anyone know of how such thing would be done?

 

Thanks,

James.

 

background-VU.png

Help Combining two expressions

$
0
0

Hi everyone.  I have two expressions which im trying to combine to work on the scale property of a shape layer. The first one is a bounce expression and the second is an expression to use a slider to control the scale of a layer (on the second keyframe). It might help to check out the original thread (Controlling the scale of a shape layer using slider control and expressions. ) where I was given the second expression to get an better idea. If anyone can help that would be greatly appreciated.

 

 

Bounce expression

 

amp = .1;

freq = 2.0;

decay = 4.0;

 

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}

 

 

Expression to control scale of the layer

 

x2 = thisComp.layer("Null 1").effect("Slider Control")("Slider");

x = ease(time,key(1).time,key(2).time,key(1).value[0],x2);

[x,x]

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

Rectangle path expression

$
0
0

Hi,

I want the path of Rectangle 2 to copy the path of Rectangle 1, only to be 30px smaller on each axis.

For some reason it's only shortening the path by 30px on the x-axis.

Any ideas how I can get it to shorten on the y-axis as well?

 

The reason I'm doing it is so I can adjust the size of one rectangle rather than them both.

 

Thanks,

Ryan

 

Screen Shot 2017-06-11 at 20.35.39.png


Moving an Object Relative to Others

$
0
0

Hi!

I have a cloud of layers spread across 3D space. They are 2D. The front layer is the controller. I used this tutorial to code this with position instead of scale. What I want instead is the layers to move relative to the objects around them. Does that make sense? If an object in the top left of the cloud moves toward the center object, all objects between them shift proportionally.

Make 2nd keyframe of a property the value of a different property

$
0
0

Hey hey,

 

Was wondering if there is a way you can tie a specific keyframe to the value of another layers property?

 

I have this flat map of earth, with 3D position on, and I want make a simple camera move going from total world view and zoom in on a specific city. This city gets it's location from a 3D null (where other precomps, text and info is attached). And this map is something I need to version 50+ times. So i figured, if I know I want the cam position to end (= the 2nd keyframe) on the city's 3D position, is there an expression to tie that second keyframe to the city's 3D position (which does not have any keyframes).

 

Of course I could just copy paste it in manually, but I have finally reached a poitn where it's almost fully automated, based on expressions and a few expression controls. So my requests is also just out of general curiosity and further learning.

 

Any ideas?     

Randomising opacity value (between 60% and 90%) across large numbers of shapes. please help

$
0
0

Hi,

 

I'm creating an animated background for a large format display (30m x 3m, 11520 x 1152) for an event. I was hoping to do this with Trapcode Mir but the client wants perfect triangles as shown below.

Artboard 3.png

 

I have this as an Ai file so I can scale it to the correct size but is there a way i can randomise the opacity value of each individual triangle over time in AE?

 

I was considering building this in Cinema 4D, extruding and animating the height to make it more dynamic but the Lite version doesn't seem to be capable of this and the budget is too tight to justify a short term license for the full version.

 

Any help with this would be greatly appreciated.

 

I'd rather do it without plugins but I have the RG Trapcode Suite and would consider buying a plugin up to $100 if it can save me a headache.

 

Thanks

 

Edit - I forgot to add, this needs to be a seamless loop although I can always duplicate the first comp and reverse it to allow it to loop.

 

Message was edited by: Chris Whitehouse

AE expression for "length of text layer" for lower thirds nameplate

$
0
0
Hello everyone,

Is there a way to measure the total width (and height) of a text layer, to automatically update the length (and height) of a shape layer? I produce web news segments with 7-15 lower thirds displays for each video. I'm looking for a more efficient way to re-size each nameplate. Currently I manually re-size each shape layer to fit the name. Is there an expression that will update the shape layer, based on the length (in pixels) of the text layer?

See an example video of what I'm talking about:
http://dallasvoice.com/dvtv_track.php?s=345
(look for the nameplates that animate in at the beginning of each interview)

I've read everything I can get my hands on, but nothing has helped. Any help would be appreciated!
-RY

Multiple Expressions -- how to?

$
0
0
I have both keyframes and a wiggle expression on the position property of a layer.

Can I stack expressions like wiggle(n1,n2) and loop_out("cycle",0) on the same property?

Center Anchor Point at a Layer

$
0
0

How can i center Anchor Point to a Layer center? Are there commands to align a center point?

Storing a position value from the previous frame

$
0
0

Hey guys,

 

So, I'm trying to assign the X value a null object had at the previous frame so I can continue to subtract a number from it cumulatively. I'm trying to assign it to a variable (prevframe). I'm not sure where I'm going wrong, but the line I'm trying to do it on is written as follows:

 

prevframe = transform.xPosition.valueAtTime(time-(1/24))

 

So in my mind, this should be taking a look at the value of X on the null, then looking back in time to figure out what it's value was on the previous frame (my frame rate is 24, so I'm dividing 1 second in to 24 pieces and telling it to subtract that much from the current time), and assigning whatever that returns to the variable. But it's just returning a static value, even though I'm subtracting from it. I feel like it's not the correct syntax, but I really have no idea.

 

I want to continue to subtract a value which is based on the velocity of another object from this, which I have worked out, I just can't figure out how to reference what this nulls X position was in the previous frame so it always returns the same value until all motion has stopped. The formula the variable is being run through looks like:

 

finalposition = prevframe - camvelocity

 

Which is then assigned to the final X position of the null object.

 

So, I'm not sure where I'm going wrong. I hope I've provided enough information to help someone wrap their head around this and hopefully help me solve it.

 

Thanks in advance,

 

-Seth


Math.pow(Math.E, time)

$
0
0

Hi folks!

 

The expression

 

"Math.pow( Math.E, time )" keeps giving me a "divide by zero" error.

 

This seems to be similar to problems others have had, but the other solutions don't quite work in my case, since Math.E isn't negative.  "time" of course is a non-integer, but the expression doesn't even work for me if I replace it with "Math.ceil(time)." 

 

Can anybody tell me what I'm missing?  Thanks in advance!

 

--S

Audio triggering footage based on values

$
0
0

Hello,

 

I've come across a video that I've come interested in understanding how it works...

 

I'm pretty sure it has been done manually, and not with a template that you can drag a song and it would output something like that.

 

However the idea of "triggering" footage (stock fire, logotype rotation on x-axis, etc) is bugging my mind.

 

Given values based on (a certain freq that we want to trigger the reaction) of the song, whether using some third party plugins like Trapcode Sound Keys, or by simple Convert Audio to Keyframes, I can't think of any idea on how a high value could trigger an animation on any given frame (since we have no idea when those values would be, imagine it should work for any given song). I imagine it's a possibility to have the animation of a few frame shorts, constantly looping, and easily playing with opacity could make a decent effect, but still I'm sure there must be a way to do something similar to what they've done.

 

Take for example the fire, except you have a plug-in generating it that you can control with a slider (if this would be the case, if would be really simple to do the song reaction), you can't really properly switch from footage A (fire being really low) to footage B (fire being way more crazy) without it flickering or producing some undesired effect, can you? Same question applies for footage C (3d logotype facing front) to footage D (3d logotype rotating horizontally), and even for certain freq making some stock fire appear and play just once.

 

Just wanted to show you in case someone had an idea or perhaps shared my enthusiasm on finding out how it works.

 

Thank you for taking the time to read this post.

 

Kind regards,

 

- Juan

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


expression for 23.98fps smooth credit roll

$
0
0

Hi,

can anyone tell me the expression for a smooth credit roll in 23.98? I can only find the one for 29.97

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

Viewing all 47983 articles
Browse latest View live


Latest Images

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