FORUMS: list search recent posts

# IF expression smooth transition - Random color

FAQ   •   VIEW ALL
 IF expression smooth transition - Random color on Jun 10, 2016 at 6:46:08 pm

Hello! This is my first post :) I'm new in After effects (and also in English, so please be comprehensive).
I'm trying to make a shape that will change color randomly at a random time. Between each color, I want a smooth transition.
Where my problem comes, it's when I want to change the colors that can be randomly adopted by the shape in a certain moment of the timeline (for example at the second 17).
What happens now, is that at second 17 the color switches to a new color but without the smooth transition.
Please if anyone knows how to do that, i'll be very grateful.
Thank you!

```if (time &lt; 17) { colors = [[129,200,213,255]/255, [222,078,060,255]/255, [235,205,081,255]/255, [241,231,209,255]/255, [134,109,206,255]/255, [227,085,098,255]/255, [217,141,153,255]/255, [000,175,101,255]/255]; } if (time >= 17) { colors = [[129,200,213,255]/255, [241,231,209,255]/255, [227,085,098,255]/255, [217,141,153,255]/255, [000,175,101,255]/255]; } easeTime = .6; segMin = .5; segMax = 2; seedRandom(index,true); segDur = random(segMin,segMax); curSeg = Math.floor(time/segDur); t = time%segDur; seedRandom(curSeg,true); idx1 = Math.floor(random(colors.length)); seedRandom(curSeg-1,true); idx0 = Math.floor(random(colors.length)); ease(t,0,easeTime,colors[idx0],colors[idx1])```

 Re: IF expression smooth transition - Random coloron Jun 10, 2016 at 11:07:31 pm

Like this maybe:

``` colors1 = [[129,200,213,255]/255, [222,078,060,255]/255, [235,205,081,255]/255, [241,231,209,255]/255, [134,109,206,255]/255, [227,085,098,255]/255, [217,141,153,255]/255, [000,175,101,255]/255]; colors2 = [[129,200,213,255]/255, [241,231,209,255]/255, [227,085,098,255]/255, [217,141,153,255]/255, [000,175,101,255]/255]; easeTime = .6; segMin = .5; segMax = 2; seedRandom(index,true); segDur = random(segMin,segMax); curSeg = Math.floor(time/segDur); t = time%segDur; seedRandom(curSeg,true); if (curSeg*segDur < 17){ idx1 = Math.floor(random(colors1.length)); c1 = colors1[idx1]; }else{ idx1 = Math.floor(random(colors2.length)); c1 = colors2[idx1]; } seedRandom(curSeg-1,true); if ((curSeg-1)*segDur < 17){ idx0 = Math.floor(random(colors1.length)); c0 = colors1[idx0]; }else{ idx0 = Math.floor(random(colors2.length)); c0 = colors2[idx0]; } ease(t,0,easeTime,c0,c1) ```

Dan