Some old plug-ins like Linear Wipe have a simple percentage slider to control the amount of wipe. However, I'd like to align a linear wipe with a motion tracked point.
How can I convert XY data into a 0~100% slider value? Would the expression assume the dimensions of the comp or the layer to ensure proper alignment?
I'm not exactly sure that I follow what you're trying to do. If you want to take the x position value and use that to vary a value between 0 and 100 you might try something like this:
x = transform.position[0]; p = linear(x, 0, thisComp.width, 0, 100); p
What I've done is to take the x position value of the layer and use the linear interpolation method to interpret the total width of the comp to 100. You could also perform the task by using x position/width*100. This would return the X position as a percentage of the comp width but would not limit the value to 100%.
L = thisComp.layer("Null 1"); controlPoint = fromComp(L.toComp(L.transform.anchorPoint)); //sub in target point here theta = degreesToRadians(effect("Linear Wipe")("Wipe Angle")); //get angle m = Math.tan(theta)*source.pixelAspect; //get slope of line defined by wipe
L = thisComp.layer("Null 1"); controlPoint = fromComp(L.toComp(L.transform.anchorPoint)); //sub in target point here theta = (effect("Linear Wipe")("Wipe Angle")+100000*360)%360; //get angle m = Math.tan(degreesToRadians(theta))*source.pixelAspect; //get slope of line defined by wipe
//get determinates for anchor line if(theta < 90) {
a1 = [0, height];
a2 = [width, 0];
} else if(theta < 180) { a1 = [0, 0];
a2= [width, height];
} else if(theta < 270){
a2 = [0, height];
a1 = [width, 0];
} else {
a2 = [0, 0];
a1= [width, height];
}
//get determinates for wipe line b1 = controlPoint; b2 = b1+[1/m, 1]