-
Slider controlled position array
Hey friends,
I need some help ironing out a position expression. Essentially, I have a slider that runs 1-5. I have a set yPosition key for each slider number within the object (if the slider is 5, then the position of the object is 2.8 (key 2), for example). I’ve tried to set this up as an array, but I keep getting errors (mostly undefined value used in expression). Just want to know if I am going about this the wrong way, or if I am messing up the code somewhere… I don’t need the object to animate to the new position, just jump to where it needs to be.
Here is my stab at this:
transform.yPosition
var p1 = transform.yPosition.key(1);
var p2 = transform.yPosition.key(2);
var p3 = transform.yPosition.key(3);
var p4 = transform.yPosition.key(4);
var p5 = transform.yPosition.key(5);
var a = Array(p1,p2,p3,p4,p5);
var r = thisComp.layer(“[+] moveAmtE”).effect(“moveAmtE”)(“Slider”);
a[r]
I have gotten something similar to work for changing the path of a shape, though it was set to random instead of a slider, this is below:
var k1 = content(“Rectangle 1”).content(“path1”).path.key(1)
var k1 = content(“Rectangle 1”).content(“path1”).path.key(2)
var a = Array(k1,k2);
var r = Math.floor(random(0,4));
a[r]
I appreciate any help offered!
Cheers,
Connor