# Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Linear Wipe Transition Completion based on angle/distance of two Point Controls

• # Linear Wipe Transition Completion based on angle/distance of two Point Controls

Posted by on May 18, 2023 at 6:51 pm

Hi there,

I gave myself a problem that I’m unable to solve based on my limited math skills, but here’s the gist of things: I have two point controls that represent the start and end of a shape path (just a line with a stroke). This works. I’ve added another layer as a matte which also has a bunch of effects applied, all of which build off of an intial linear wipe. With some simple trig, I’ve got the wipe angle oriented perpendicular to the slope of the path. Great. What I can’t seem to figure out is how to convert the point controls’ values to percentage values that I can pass to a linear() function (driven by a slider that goes from 0 to 1 or vice versa). My goal is to let the user (pretty much always me, but hey) just assign the point controls and have expressions handle calculating the transition completion percentages, but I’m at a loss.

My first thought was to get the length of the path, find the midpoint by dividing that in two, then figuring out how to correlate 50% transition completion with the middle of the path. I couldn’t figure out how to do that.

My dollar store solution is to just add slider controls to represent the transition completion values and assign them manually, assuming approximating things will work okay. It does, but surely there’s something relatively simple I’m missing? I just wanted to see if anyone here has thoughts about how to make things simpler for the user. Thanks!

• ### Usama Aslam

July 4, 2023 at 8:01 pm

The percentage will be calculated automatically depending on the angle or distance between those points. This will eliminate the requirement of a manual slider.

Start by connecting the position attributes of two null objects to the start and end point controls. You will be able to access their places in expressions as a result.

The desired percentage range can be mapped to the angle range. For instance, if the angle range is 0 to 180 degrees and you want the completion percentage to be 0% at 0 degrees and 100% at 180 degrees:

percentage = (angle – 0) / (180 – 0) * 100;

You can use the following formula if the distance range is 0 to “maxDistance” and you want the completion percentage to be 0% at 0 distance and 100% at “maxDistance”:

percentage = (distance – 0) / (maxDistance – 0) * 100;

The completion % can be driven by an expression control slider, which will be linked to the linear wipe transition property.

We use anonymous cookies to give you the best experience we can.