FORUMS: list search recent posts

Control slider with variation

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jack Brown
Control slider with variation
on Aug 30, 2016 at 4:21:15 pm

Hi everyone,

I have a shape layer with 20 shapes, all with a Stroke and a Trim Paths.

The 20 separate shapes' Trim Paths are linked to a Slider Control which animates from 0 to 100.

In order to add some variation in the time it takes for the Trim Paths to animate on, I am trying to add an expression to the individual shapes that takes into account the Slider Control animation, but then adds a random time offset.

Ideally, the random time offset would not let the animation of the Trim Paths start before my first keyframe on the Slider Control.

Can you help?

Thanks - Jack


Return to posts index

Dan Ebberts
Re: Control slider with variation
on Aug 30, 2016 at 5:32:12 pm

Something like this maybe:


maxOffset = .2;
s = effect("Slider Control")("Slider");
if (s.numKeys > 1){
seedRandom(index,true);
offset = random(-maxOffset,maxOffset);
t1 = s.key(1).time;
t2 = s.key(2).time;
t = linear(time,t1,t2+offset,t1,t2);
s.valueAtTime(t);
}else
value


Dan



Return to posts index

Jack Brown
Re: Control slider with variation
on Aug 31, 2016 at 2:47:51 pm

Thanks for getting back to me, Dan.

The script you suggested is throwing up a few errors (namely that the use of 'else' at the end is illegal!).

I'm attaching a screengrab of the composition which I hope will shed light on the issue.

Thanks again,

Jack



Return to posts index


Dan Ebberts
Re: Control slider with variation
on Aug 31, 2016 at 4:25:02 pm

It looks like you didn't quite get the second and third lines copied correctly. The second line is missing a semi-colon at the end, the third is missing an opening curly bracket at the end.

Dan



Return to posts index

Jack Brown
Re: Control slider with variation
on Aug 31, 2016 at 5:00:52 pm

Thanks, Dan!

User error, as always.

Thanks for your time on this.

Jack


Return to posts index

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