Created
July 2, 2020 08:01
-
-
Save AEnMe/ade02ad2d1ccba04aaedb95f0171930a to your computer and use it in GitHub Desktop.
Trim one side of a rectangle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Rename the Trim Path to the following: | |
left,l,LEFT,L | |
right,r,RIGHT,R | |
top,t,TOP,T | |
bottom,b,BOTTOM,B | |
*/ | |
// TO PLACE ON TRIM.END | |
Rectangle = thisProperty.propertyGroup(3).content("Rectangle Path 1").size; | |
x = Rectangle[0]; | |
y = Rectangle[1]; | |
side = thisProperty.propertyGroup(1).name.toString().toLowerCase().substr(0, 1); | |
p = (x + y) * 2/100; | |
if (p == 0) p = 1; // avoid division by 0 | |
function myTrim(side) { | |
switch (side) { | |
case "l": | |
case "r": | |
return y / p ; | |
case "t": | |
case "b": | |
return x / p ; | |
} | |
} | |
myTrim(side); | |
// TO PLACE ON TRIM.OFFSET | |
side = thisProperty.propertyGroup(1).name.toString().toLowerCase().substr(0, 1); | |
Rectangle = thisProperty.propertyGroup(3).content("Rectangle Path 1").size; | |
x = Rectangle[0]; | |
y = Rectangle[1]; | |
p = (x + y) * 2 / 360; | |
if (p == 0) p = 1; // avoid division by 0 | |
function myTrim(side) { | |
switch (side) { | |
case "r": | |
return 0; | |
case "l": | |
return 180; | |
case "t": | |
return -x / p; | |
case "b": | |
return y / p; | |
} | |
} | |
myTrim(side); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment