Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Progressive, always positive wiggle?

• Progressive, always positive wiggle?

2 Members · 4 Posts
• Navarro Parker

January 28, 2016 at 6:16 pm

I have several shape layers, each with a replicator

I’d like to have each replicator to count from 0~100, but in a wiggly, constantly growing method. That is, it never reduces in value, but increases in variable amounts over variable intervals to a specified maximum (usually 100)

For example: Frame 00-30, grow from 0-16 copies. Frame 31-35 add 9 more copies. Frame 36-54 add 14 more copies, etc… until it reaches 100 copies when it stops.

• Xavier Gomez

January 28, 2016 at 7:53 pm

This should work:

```startVal = 0; endVal = 100; // max copies DTmin = 0.2; // DTmin/max : time interval min/max between changes DTmax = 0.8; DNmin = 2; // DNmin/max : change amount min/max DNmax = 5;```

``` s=t=inPoint; m=n=startVal; while (n ```

`Xavier`

• Navarro Parker

January 28, 2016 at 8:02 pm

Thank you!

Is there a way for this to respect the timing of my existing two keyframes (0 & 100)?

• Xavier Gomez

January 28, 2016 at 11:22 pm

Here is a possibility, not optimal since it calculates the whole every frame.
If your keys are not far apart and the param averageChangesPerSec isnt too big, it should be fine
``` startVal = 0; endVal = 100; // max copies t1 = numKeys>0 ? key(1).time : inPoint; t2 = numKeys>1 ? key(2).time : outPoint; averageChangesPerSec = 1.5; seed1 = index+1000; seed2 = index+2000; a = 3; // controls time variations (close to 1 = small, bigger=more disparity) b = 10; // controls value variations (same)```

``` if (time<=t1){startVal;} else if (t2<=time) {endVal;} else{ numSteps =Math.ceil((t2-t1)*averageChangesPerSec); t=0; times = [0]; v=0; values = [0]; for (n=1; n<=numSteps; n++){seedRandom(t+seed1, true);t+=random(1,a); times[n]=t; seedRandom(t+seed2, true);v+=random(1,b); values[n]=v;}; t = (time-t1)/(t2-t1) * t; x = (endVal-startVal) / v; a=0; b=numSteps; while(b-a>1){j=Math.floor((a+b)*0.5); if (times[j]<=t){a=j;} else{b=j;};}; ```

``` startVal + x*linear(t, times[a], times[b], values[a], values[b]); };```

Xavier

Viewing 1 - 4 of 4 posts