Last active
August 29, 2015 14:01
-
-
Save kumo/667796a13b6f0aa7629f to your computer and use it in GitHub Desktop.
Duplicate an object into a marching crowd
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
var layer = selection[0]; | |
var layerWidth = [[layer frame] width]; | |
var layerHeight = [[layer frame] height]; | |
var frame = [layer frame]; | |
var parent = [layer parentGroup]; | |
var widthOffset = layerWidth / 100 * 50; | |
var heightOffset = layerHeight / 100 * 60; | |
for (var row=0; row<5; row++) { | |
for (var col=0; col<3; col++) { | |
var clone = [layer duplicate]; | |
var frame2 = [clone frame]; | |
if (row % 2 == 1) { | |
[frame2 setX: col * (layerWidth) + widthOffset]; | |
} else { | |
[frame2 setX: col * (layerWidth) + widthOffset - widthOffset]; | |
} | |
[frame2 setY: -row * (layerHeight - heightOffset)]; | |
} | |
if (row % 2 == 0) { | |
var clone = [layer duplicate]; | |
var frame2 = [clone frame]; | |
[frame2 setX: 3 * (layerWidth) + widthOffset - widthOffset]; | |
[frame2 setY: -row * (layerHeight - heightOffset)]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment