Created
September 7, 2011 14:50
-
-
Save moluapple/1200769 to your computer and use it in GitHub Desktop.
[Illustrator, Scriptographer] Arrange Objects On Path
This file contains hidden or 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
// yet another Scriptographer script | |
var oPath = document.selectedItems[0], | |
// u = oPath.reverse(), | |
len = oPath.length, | |
segments = oPath.segments, | |
parts = 20, | |
i = 0; | |
for (; i <= parts; i++) { | |
var point = oPath.getLocation(len / parts * i).point, | |
pointB = i > 0 ? oPath.getLocation(len / parts * i - 1).point : segments[0].point, | |
pointA = i < parts ? oPath.getLocation(len / parts * i + 1).point : segments[segments.length - 1].point, | |
path = new Path.Line(point, point + new Point(5, 0)), | |
text = new PointText({ | |
content: i, | |
paragraphStyle: { | |
justification: 'center' | |
}, | |
characterStyle: { | |
baselineShift: 4 | |
} | |
}), | |
angle = (pointA - pointB).angle; | |
path.rotate(angle + 90, point); | |
text.rotate(angle); | |
text.point = point; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Result:
