Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How to change Ellipse size to random number within range on second keyframe?

  • How to change Ellipse size to random number within range on second keyframe?

    Posted by Louis Hamwey on July 27, 2018 at 4:17 pm

    I have about 100 ellipses. I need them all to grow or shrink in size randomly all within a 50% range. I also need this to happen starting at 6 secs and ending at 8 secs with ease in and out. Ideally they start and end of the motion would be connected to Keyframes. I have scoured the internet trying to find a solution, but cannot figure it out. Any one have any ideas? Thanks!

    Andreas Brand replied 7 years, 9 months ago 2 Members · 1 Reply
  • 1 Reply
  • Andreas Brand

    July 27, 2018 at 6:08 pm

    Hello Louis

    this code should work.

    Copy it to the scale-property of one of the elipses. Then right-click to the scale-property and chosse “copy expression only”.

    Then select all other elipses and ctrl+v.

    Hope that helps
    Andreas

    //This takes the markers of the comp
    var beginning = thisComp.marker.key(1).time;
    var ending = thisComp.marker.key(2).time;

    var shrinkFrom = 50;
    var shrinkTo = 150;

    seedRandom(index, true);
    randomShrinkSize = random(shrinkFrom, shrinkTo);

    var newScale = linear(time, beginning, ending, 100, randomShrinkSize);

    [newScale, newScale]

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