FORUMS: list search recent posts

Combining 2 expressions on a slider control

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Buki Bodunrin
Combining 2 expressions on a slider control
on Jan 18, 2016 at 6:12:23 am

Hi I'm having trouble getting 2 expression to work together on a slider control. Thanks to the wonderful Dan Ebberts, I'm using this expression to randomize a bunch of stills in a composition (http://motionscript.com/expressions-lab-ae65/random-stills.html). My trouble is whenever the slider hits a value on 1, no stills are shown. I'd like to add to the expression so that the minimum value never goes below 2. Dan's expression looks like this:

duration = .125; //length of each cut (seconds)

seed = Math.floor(time/duration) + 1;
seedRandom(seed,true);
Math.floor(random(1,index));


I tried adding this line of code after:

clamp(value, min=2, max=255)

But it doesn't work. What am I doing wrong? Or is there a better way to do this?
Thanks!

duration = .125; //length of each cut (seconds)

seed = Math.floor(time/duration) + 1;
seedRandom(seed,true);
Math.floor(random(1,index));

clamp(value, min=2, max=255)


Return to posts index

Miguel de Mendoza
Re: Combining 2 expressions on a slider control
on Jan 18, 2016 at 3:31:26 pm

You can change the random() min parameter to 2 like this:
Math.floor(random(2,index));

Or you can check the value with an if statement:
duration = .125; //length of each cut (seconds)

seed = Math.floor(time/duration) + 1;
seedRandom(seed,true);
randomValue = Math.floor(random(1,index));

val = (randomValue < 2) 2: randomValue;


Return to posts index

Buki Bodunrin
Re: Combining 2 expressions on a slider control
on Jan 18, 2016 at 6:41:08 pm

Ah...

It worked changing

Math.floor(random(2,index));


Thanks again!!!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]