Skip to content

Instantly share code, notes, and snippets.

@norio
Created October 5, 2011 11:53
Show Gist options
  • Save norio/1264277 to your computer and use it in GitHub Desktop.
Save norio/1264277 to your computer and use it in GitHub Desktop.
Image Rounder (Scriptographer script)
var rounder = {
values: {
radius: 10
},
components: {
radius: {
label: 'Corner Radius',
type : 'number',
units: 'point'
},
apply: {
type : 'button',
value : 'Apply',
onClick: applyRounder
}
}
};
function applyRounder() {
var images = document.selectedItems;
var radius = rounder.values.radius;
for (var i = 0, image; image = images[i]; ++i) {
var mask = new Path.RoundRectangle(image.bounds, new Size(radius, radius));
var group = new Group();
group.appendChild(image);
group.appendChild(mask);
group.clipped = true;
image.clipMask = true;
}
document.redraw();
}
var palette = new Palette('Image Rounder', rounder.components, rounder.values);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment