Last active
November 16, 2017 23:43
-
-
Save sojack/7c2332e703e0f6b20f2c176513cb5ce4 to your computer and use it in GitHub Desktop.
illustrator script - moves selected anchor points randomly (between max, min values)
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
var idoc = app.activeDocument; | |
var ipath = idoc.pathItems; | |
var offsetval = 300; | |
var roundv = 50; | |
for (var j = 0; j < ipath.length; j++){ | |
var sel = ipath[j].selectedPathPoints; | |
for (var i = 0; i < sel.length; i++) { | |
var max = offsetval; | |
var min = -offsetval; | |
var offset = Math.random() * (max - min) + min; | |
var pp = sel[i]; | |
var aa = pp.anchor[0]; | |
var ab = pp.anchor[1]; | |
var la = pp.leftDirection[0]+offset; | |
var lb = pp.leftDirection[1]+roundv; | |
var ra = pp.rightDirection[0]+offset; | |
var rb = pp.rightDirection[1]-roundv; | |
if (pp.selected == PathPointSelection.ANCHORPOINT) { | |
pp.anchor = Array(aa+offset, ab); | |
// pp.leftDirection[0] = la+offset; | |
// pp.leftDirection[1] = lb+offset; | |
// pp.rightDirection[0] = ra+offset; | |
// pp.rightDirection[1] = rb+offset; | |
pp.leftDirection = Array(la,lb); | |
pp.rightDirection = Array(ra,rb); | |
} | |
} | |
} | |
redraw(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment