Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Percentage to Incremental Degrees?

  • Percentage to Incremental Degrees?

    Posted by Jon Smith on February 24, 2012 at 10:56 pm

    Hi guys,

    I have a circle that is broken up into slices that are evenly sized and distributed (like a pie). The number of slices can change via an expression I have tied to a slider. e.g. 40 – 9 degree slices, 30 – 12 degree slices etc…

    I want to use the radial transition effect to reveal the slices. The transition control is a 0-100 percentage slider. I want it to reveal the slices in whole pieces. e.g. it’ll reveal it in 9 degree chunks if there are 40 slices.

    Any idea of how to accomplish this? I’ve been at it for a couple hours but the math is wrecking my brain.

    Thanks in advance.

    Jon Smith replied 14 years, 2 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    February 24, 2012 at 11:45 pm

    I think it’s going to look something like this:

    n = 40;
    pct = effect(“Slider Control”)(“Slider”);
    degPerSlice = 360/n;
    degPerSlice*Math.round(n*pct/100)/3.6

    Dan

  • Jon Smith

    February 25, 2012 at 12:01 am

    Thanks a bunch Dan, You’ve bailed me out more then once.

    I eventually came upon a solution that seems to work:

    singleSegmentPercent = (singleSegmentDegree/360) * 100;
    segmentsComplete = totalSegments * (slider/100);
    Math.floor (segmentsComplete) * singleSegmentPercent

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