-
Switching between an array of colors
I have a set of 14 different colors stored as RGBA, or Hex values.
I would like to be able to apply those colors to a solid, and switch between them using a slider control.I’ve found a way to do this using Hue angles, but not for RGBA or Hex values. If I name each of the arrays with a number in the name, can I append that number to a string, then call it in the expression somehow?
mycolor1 = [81,45,10,255];
mycolor2 = [38,184,82,255];
mycolor3 = [255,157,150,255];
mycolor4 = [19,23,148,255];
mycolor5 = [119,241,225,255];
mycolor6 = [255,59,212,255];
mycolor7 = [44,134,120,255];
mycolor8 = [255,89,10,255];
mycolor9 = [235,213,8,255];
mycolor10 = [236,39,34,255];
mycolor11 = [228,212,136,255];
mycolor12 = [186,38,138,255];
mycolor13 = [255,142,144,255];
mycolor14 = [48,205,187,255];mynumber = thisComp.layer("Null 3").effect("choosecolor")("Slider");
finalstring = 'mycolor' + mynumber +'[0]/255'; // this doesn't work!
var r = mycolor2[0]/255;
var g = mycolor2[1]/255;
var b = mycolor2[2]/255;
var a = mycolor2[3]/255;[r,g,b,a]