| **Expression to pick one of six values based on slider**
by James Archibald on Nov 11, 2014 at 11:34:54 am Last Edited By James Archibald on Nov 11, 2014 at 11:37:17 am |

Hey everyone, this feels like it should be a simple one, and it's definitely something I've achieved before but I've sort of tangled myself up and can't quite see where to go.

I have a slider that is outputting a value between 1 and 6 based on a wiggle:

**w = wiggle(6,4);**

Math.max(1,Math.min(6,w)).toFixed(0)

I have 6 nulls in 3D space.

I then have my effect which I want to wiggle between these nulls based on the slider's "dice roll". So far I have defined my variables, but I can't think how to format the expression in order to achieve this.

This is how far I've gotten:

**dice = effect("Zap Roll")("Slider");**

t1 = thisComp.layer("Edge Zap Target 1").transform.position;

t2 = thisComp.layer("Edge Zap Target 2").transform.position;

t3 = thisComp.layer("Edge Zap Target 3").transform.position;

t4 = thisComp.layer("Edge Zap Target 4").transform.position;

t5 = thisComp.layer("Pylon 1 - Top").transform.position;

t6 = thisComp.layer("Pylon 1 - Bot").transform.position;

if (dice=1) t1

So if dice=2, the effect value should be t2, etc.

Any help would be greatly appreciated.

• Archie •

| **Re: Expression to pick one of six values based on slider** by James Archibald on Nov 11, 2014 at 11:48:31 am |

Derp, sorted it. Knew it was simple, sorry, folks.

**dice = effect("Zap Target")("Slider");**

t1 = thisComp.layer("Edge Zap Target 1").transform.position;

t2 = thisComp.layer("Edge Zap Target 2").transform.position;

t3 = thisComp.layer("Edge Zap Target 3").transform.position;

t4 = thisComp.layer("Edge Zap Target 4").transform.position;

t5 = thisComp.layer("Pylon 1 - Top").transform.position;

t6 = thisComp.layer("Pylon 1 - Bot").transform.position;

if (dice==1) t1

else if (dice==2) t2

else if (dice==3) t3

else if (dice==4) t4

else if (dice==5) t5

else if (dice==6) t6

• Archie •