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

JSON - unicode characters (hållo world!)

$
0
0

Hi community,

 

I'm trying to load external data via the new JSON data-driven animation feature in CC17.

While this seems to work like a charm, more exotic data such as the string : "hällø" won't import correctly.

 

Do I need to convert all of those unicode characters to their Javascript string equivalents, or is there a better way?

 

Thanks so much!

Filip

 

eg.

 

JSON file:

{

"test": "hållo",

}

 

AE text source expression:

var data = footage("sample1.json").sourceData;

data.test;

 

Result:

HÃ¥LLO


How to enable/disable an audio track

$
0
0

Hi.

I have a sequence in AE with several audio tracks, and I want to be able to choose one of them and enable it, disabling the others. Is it possible? How would you guys do it?

 

Thanks!!

Comp name to TEXT?

$
0
0

Hi Guys, any way to extract the name of a comp and put it in a text layer?

Can you make an object follow a text length?

$
0
0

Can you make an object follow the end of a text? I need to make the green dot (look at picture) follow the end of the text. I want it to work, so no matter how long or short the text is, the green dot will continue to be the same distance from the text.

 

It sounds a lot like some kind of expression. But is it possible?

 

I use this template daily at work and would love to make an essential graphic. But right now I have to move the dot manually every time i write a new text or change the text.

The reason why it's not just a normal dot, is because the dot is animating.

 

Hope someone can help.
Thanks in advance!

 

PICTURE:

punktum.PNG

Randomly rotate layer in specific increments

$
0
0

The random(x) expression is simple enough to randomly rotate a layer to any angle, but what if I want that angle to be to the nearest 45 degrees? So my layer would randomly rotate to any of the following angles: 0, 45, 90, 135, 180, 225, 270, 315, or 360 degrees.  Thanks, Jim

Path point linked to null position

$
0
0

Untitled-1.jpg

 

i have a simple expression that links the first point of the shape lazer to a null.

 

createPath(points = [thisComp.layer("Null 20").transform.position-[960,540], [100,0], [100,100]], inTangents = [], outTangents = [], is_closed = false)

 

this works untill i move the position of the shape layer. is there a way to tweek this simple expression to make it work even if i move the shape layer?

i am thinking about a toComp command but i dont know how to put it in.

i am also aware of the "Create Nulls From Path.jsx" but i dont want to use it now, i want to keep it simple.

 

thanks!

Essential Graphics: Mute Audio with Checkbox

$
0
0

Heyja,

 

working on a Lower-Third-Essential Graphic in AE (14.2.1) with Audio for the transition.

I want to easily mute the sound later with a checkbox (On/Off) in the Essential Graphic Panel in Premiere Pro.

 

Is there a Expression to get this working?

Thats the current script:

temp = thisComp.layer("Control Layer").effect("Transition Sound")("Checkbox"); [temp, temp]

 

Thanks in advance!

scale up and down expression

$
0
0

Hi,

 

I'm looking to create an expression that does the same as this opacity expression, which fades in and out, but for scale

 

fadeInTime = .15; // fade in time (seconds)

 

fadeOutTime = .15;

 

Math.min(linear(time,inPoint,inPoint +

fadeInTime,0,100),linear(time,outPoint -

fadeOutTime,outPoint,100,0))

 

I've tried this but it doesn't work.

 

fadeInTime = .15;// fade in time (seconds)

 

fadeOutTime = .15;

 

Math.min(linear(time,inPoint,inPoint +

fadeInTime,[0,0],[100,100]),linear(time,outPoint -

fadeOutTime,outPoint,[100,100],[0,0]))

 

this works on it's own for the in but i can't make it work for the out!!

 

fadeInTime = .15;// fade in time (seconds)

 

fadeOutTime = .15;

 

linear(time,inPoint,inPoint +

fadeInTime,[0,0],[100,100])

 

Can you help?

 

Thanks

 

Chris


Expression Get Project Path or Name

$
0
0

Hi,

 

I am new to After Effects as in I have just seen it for the first time today!

 

What I'd like to know is, is it possible to write an expression to return either the current project name or file path?

 

I'm assuming no as I cannot find any reference to this in the language reference. How would I go about integrating a script with the project to return the project name?

 

I have tried something basic like:

 

Expression code:

 

var currpath = $.evalFile(filepath);

 

filepath is the path to my script file, the script is like the below:

 

GetPath()

 

function GetPath() {

 

return app.project.name;

}

 

With this I get an error similar to method name 'Global' not found - not at my work computer so can't remember the exact message.

 

Any help would be appreciated.

 

Thanks,

 

Mark

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?

seedRandom( index, true) generates each frame a new number. Why?

$
0
0

Hi, I would like to understand why this code here:

 

j = 0;

accum = 0;

seedRandom(index,true);

 

while ( j < time ) {

accum += random(10);

j += thisComp.frameDuration;

}

 

random(100)

 

generates a different number each frame. But this one:

 

seedRandom(index,true);

random(100)

 

doesn't. Can anybody explain me this please?

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

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.

Parent layer with expressions like Normal parent

$
0
0

Hi there,

How to parent a layer to other layer using expressions so that it acts like normal parent child.i.e

1.Rotate parent moves child etc...

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


Decimal numbers in expression

$
0
0

Hi! I have created a counter on a text layer that counts length in increments om 40 cm controlled by a slider, I added this expression to the source text property and it works great except for the decimals. 

 

t = effect("Slider Control")("Slider")

x = Math.round(t/.4)*.4+0.0001

 

 

x = x + " Meter"

 

 

x.toString().replace(".", ",");

 

 

It now counts 0,001 Meter.... 0,4001 Meter... 0,8001 Meter.... 1,2001 Meter..... but i want it to only show 2 decimals: 0,40..0,80..1,20..1,60...

 

I added the +0.0001 in Math.round to get decimals at the whole numbers. I.e. 4 Meter is now 4,0001 Meter... But how do I remove the last two digits? Or is there another way to always show 2 decimals? I need the counter speed to be controlled over time and masking is a problem since the font I use is not monospaced.

 

Thank you.

Reading length of a motion path

$
0
0

My end goal is to determine the length or total distance traveled of a layer's motion path. Before I abandon my current approach, I wanted to find out if I'm missing anything that I may be able to leverage given the new Path properties and functions introduced in CC18.

 

So far it doesn't look like there is a method in place for this because the motion path itself does not appear to be exposed to expressions - unlike an actual shape path, which can be referenced as a property of that Shape layer or Mask. The methods for referencing "Points" along those paths seams pretty well documented.

 

Figured I'd ask, thanks!

Stephen

stroke width with expression

$
0
0

Hi, iam trying to set stroke width based on shape scale, (to maintain fixed stroke size) so ive used "(1/transform.scale[0])*500;" for stroke width expression, but this only works for either stroke width, or stroke height. What am i doing wrong? Or how can i apply ths to both stroke width and stroke height at the same time?

Anchor point expression [static]

$
0
0

Please help me I'm stuck with a small problem that is my anchor point of the shape layer. I have an animated Shape layer that if you adjust the animation it gets all messed up because the anchor point changes with it. I want the anchor point to be stuck on the left center of the shape. Is there an expression for that? If so please explain how...

 

See print screen 1 and 2 the anchor point is changing to a different position when typing something different. I want it to be stuck to its first position. At least for know at the left center.

 

1.png

2.png

 

Thanks in advance.

valueAtTime from parent Comp

$
0
0

Hello,

I have a nested comp which is time-remapped.

I need from within this nested comp to animate a parameter (trim path end of a circle shape) using a slider value in my main comp.

My problem is that this animation is done according to the remapped timeline and not the main comp timeline.

 

I thought something like this could work :

comp("Comp 1").layer("Settings").effect("Speed")("Slider").valueAtTime(comp("Comp 1").time)

 

... but I can't retrieve comp("Comp 1").time

 

Can someone help please ?

 

Thnx

Viewing all 47983 articles
Browse latest View live


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