Skip navigation
Currently Being Moderated

Snappier Wiggle?

Jun 27, 2012 1:06 PM

Tags: #ae #expression #wiggle

How would you make a wiggle expression that radically reduced the time between values?  Like Wiggle that uses Exponential interpolation as inbetween values? So even though the pace would be something like wiggle(1,50), it would take much less than the 1 second wiggle interval to change between values.

 

Kind of like how a hummingbird feeds? It hovers, hovers, hovers... then snap into a new position.... hover, hover, hover... snap into new position.

 

Any ideas about this?

 

(Also, is the Jagged/Smooth option of the ancient Wiggler available in expression form?)

 
Replies
  • Currently Being Moderated
    Jun 27, 2012 1:55 PM   in reply to Navarro Parker

    Interesting idea. I think it might be easier to do it this way than to start with wiggle():

     

    minVal = -100;

    maxVal = 100;

    minDuration = 0.5;

    maxDuration = 1.5;

    transRate = 400;

     

    tEnd = 0;

    n = 0;

    seedRandom(n, true);

    preRun = random(maxDuration);

    while (time + preRun >= tEnd){

      n++;

      seedRandom(n, true);

      dur = random(minDuration, maxDuration);

      tEnd += dur;

    }

    t = time + preRun - (tEnd - dur);

     

    n += 9973;

    seedRandom(n, true);

    endVal = random(minVal, maxVal);

    seedRandom(n - 1, true);

    startVal = random(minVal, maxVal);

    delta = endVal-startVal;

    transTime = Math.abs(delta/transRate);

    ease(t, (dur-transTime)/2,(dur+transTime)/2, startVal, endVal);

     

    You can make wiggle() more jagged by increasing the number of octaves (third parameter of wiggle()).

     

    Dan

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 27, 2012 2:52 PM   in reply to Navarro Parker

    I guess 2D positon would be more like this:

     

    minVal = [0,0];

    maxVal = [thisComp.width,thisComp.height];

    minDuration = 0.5;

    maxDuration = 1.5;

    transRate = 1000;

     

    tEnd = 0;

    n = 0;

    seedRandom(n, true);

    preRun = random(maxDuration);

    while (time + preRun >= tEnd){

      n++;

      seedRandom(n, true);

      dur = random(minDuration, maxDuration);

      tEnd += dur;

    }

    t = time + preRun - (tEnd - dur);

     

    n += 9973;

    seedRandom(n, true);

    endVal = random(minVal, maxVal);

    seedRandom(n - 1, true);

    startVal = random(minVal, maxVal);

    delta = length(endVal,startVal);

    transTime = Math.abs(delta/transRate);

    ease(t, (dur-transTime)/2,(dur+transTime)/2, startVal, endVal);

     

     

    Dan

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points