ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

What's wrong with this non random color array picking expression?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
maximilian yuen
What's wrong with this non random color array picking expression?
on Jul 10, 2018 at 4:37:30 am

I am getting syntax error and I am pretty sure it's either the double bracket or the slider value didn't get translated when putting into options?

Thanks.

R1=thisComp.layer("color").effect("R1")("Slider");
G1=thisComp.layer("color").effect("G1")("Slider");
B1=thisComp.layer("color").effect("B1")("Slider");
options = [[R1],[G1],[B1], 255], [0, 255, 0, 255], [0, 0, 255, 255]];
seedRandom(index, true);
r = Math.floor(random(3));
options[r]/255;


Return to posts index

Kalleheikki Kannisto
Re: What's wrong with this non random color array picking expression?
on Jul 10, 2018 at 7:14:03 am
Last Edited By Kalleheikki Kannisto on Jul 10, 2018 at 7:15:47 am

No need to put the individual slider values in brackets (Plus you were missing one opening bracket for the first set of colors).

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

maximilian yuen
Re: What's wrong with this non random color array picking expression?
on Jul 10, 2018 at 7:18:27 am

you mean like this? that's the first I try but it don't work either :(


R1=thisComp.layer("color").effect("R1")("Slider");
G1=thisComp.layer("color").effect("G1")("Slider");
B1=thisComp.layer("color").effect("B1")("Slider");
options = [[R1,G1,B1, 255], [0, 255, 0, 255], [0, 0, 255, 255]];
seedRandom(index, true);
r = Math.floor(random(3));
options[r]/255;


Return to posts index


Kalleheikki Kannisto
Re: What's wrong with this non random color array picking expression?
on Jul 10, 2018 at 5:58:28 pm

Yes, it works just fine like that. Perhaps it just does something different from what you expect? It picks one of those three color values at random. It just does that once per layer, so if you duplicate the layer a number of times, the property will result in different colors wjhere this expression is used.

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

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