ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Can't get rid off decimals at a certain number

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
oktay atalay
Can't get rid off decimals at a certain number
on Sep 16, 2019 at 7:52:30 am

Hello everyone,

I'm trying to create a categorized slideshow template, briefly there are categories let's say A,B,C,D etc. and all categories have their unique footage. My flowchart goes like "Main Comp --> 1/2/3 etc --> Footage 1/2/3 etc. --> Images". To fasten things up I'm just adding new footage inside Footage 1/2/3 etc. precomps. Then I'm using the inPoint and the names of the 1/2/3 precomps to say AE which image it should show. In Main comp I've a Point Control effect with the expression :

a = thisLayer.index;
b = thisComp.numLayers;
for(i = a+1; i <= b; i++){
curLay = thisComp.layer(i);
if(curLay.inPoint <= time && curLay.outPoint > time){;


x gives me the name of the active layer, which goes like 1-2-3-4... so I could use

if(comp("Main").layer("Footage Control").effect("Point Control")("Point")[0]==index){

to make sure which image will show at a certain time.

It works just fine until I came up to 7th comp. For the 7th comp my 'x' value is 7,000000000000001 while for the 1st comp 1, 2nd comp 2. I tried Math.floor, Math.Round and toFixed() but none of them worked.

What is the reason behind it and how can I solve it?

Thanks in advance.

Return to posts index

Dan Ebberts
Re: Can't get rid off decimals at a certain number
on Sep 16, 2019 at 4:29:28 pm

You're applying this to the Source Text of a text layer, is that correct? Just providing an array in the last line seems a little sketchy to me. Maybe try:

x + "," + y



also, you could probably replace this:

if(curLay.inPoint <= time && curLay.outPoint > time){

with this:

if ({


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 All Rights Reserved