Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Wiggle with fixed intermediate values

  • Wiggle with fixed intermediate values

    Posted by Alexey Bobrovsky on August 5, 2016 at 12:21 am

    Hello!

    I need some help in my current project. I’m making a cg semi-realistic eye that has to look from side to side randomly. So I try to use “wiggle” for this purpose. But the actual eye works you know quickly changing its point of view and fixing in the direction for a moment. In the project the eye is actually a sphere where rotation is linked to null object position and an iris animation is done by reshape effect with Percent linked to null’s [x] scale value.

    I’m not that good with expressions… So is there a way to write a script that would perform random life like behavior of the eye? Like “look right, stop, look other direction, stop; iris enlarges and stays this way for a longer time or changes its size depending on the direction like looking up – squeezes on bright light, looking down – enlarges”?

    Thanks 🙂

    Sphere rotation [x]:

    thisComp.layer("Null 1").transform.position[1]*-1

    Null object expression for position:

    wiggle(5, 20)

    Kalleheikki Kannisto replied 9 years, 8 months ago 2 Members · 4 Replies
  • 4 Replies
  • Kalleheikki Kannisto

    August 5, 2016 at 2:09 pm

    Here’s one possibility. With this position expression Null 1 moves randomly to a new position at random intervals.

    seedRandom(index, true);
    x_motion = 100; // maximum motion on x axis
    y_motion = 50; // maximum motion on y axis
    x_pos = value[0] + random(x_motion) - x_motion/2;
    y_pos = value[1] + random(x_motion) - x_motion/2;
    min_hold = 5; // minimum number of frames to hold eye in one place
    max_hold = 25; // maximum number of frames to hold eye in one place
    t = timeToFrames(inPoint);
    while (t

    Rather than trying to fit an ease expression there, I bailed out to using a second null with this expression to slow the motion from one place to another:

    smooth_frames = 2; // how many frames in each direction the motion is smoothed
    smooth_pos = [0,0];
    fps = 1/thisComp.frameDuration;
    for (i = -smooth_frames; i <= smooth_frames; i++){
    smooth_pos += thisComp.layer("Null 1").transform.position.valueAtTime(time+i/fps)}
    smooth_pos = smooth_pos/(smooth_frames*2+1)

    Now you can get your eyeball motions from Null 2's position.

    Not exactly pretty in terms of code, but it will do the trick.

  • Alexey Bobrovsky

    August 5, 2016 at 10:28 pm

    Thank you very much!!!

    As soon as I will finish my project I will share results!

  • Alexey Bobrovsky

    September 8, 2016 at 12:01 am

    Hi and thank you once again! You help had a great value to me.

    I’ve promised to share the results and here they are: https://www.youtube.com/watch?v=5VHpPUx-x3Y

    I think I should make some remarks, technical and artistic.

    Technical: what you see is a concept of statue which is currently assembled in Kiev art center. The eye is actually a led screen one square meter. Random animation supposed to be at least one minute long and should separate four different “emotions”: crazy, tears, love and logos O_o , but the customer (girl who generated the idea of a statue) said that “one minute is so too long, make it quicker”.

    Artistic: “…”

    I wonder what you would say about the statue?

    P.S.: If you ask me I’d say I did a strange video for a strange installation (or I should rather say a big plastic piece of sh@t :-)) )

  • Kalleheikki Kannisto

    September 9, 2016 at 6:58 am

    It’s certainly eye catching…

    Kalleheikki Kannisto
    Senior Graphic Designer

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy