Skip to content

Instantly share code, notes, and snippets.

@moluapple
Created August 1, 2011 10:27
Show Gist options
  • Save moluapple/1117907 to your computer and use it in GitHub Desktop.
Save moluapple/1117907 to your computer and use it in GitHub Desktop.
[Illustrator, Scriptographer] GradientObj Bleeder
/********************************
* Illustrator 中为渐变对象创建出血
* 本脚本在 Scriptographer 环境运行
*******************************/
script.coordinateSystem = "bottom-up";
function bleedMe() {
var a = document.selectedItems[0],
b = a.clone(),
c = elements.itemBleed.value,
d = a.bounds.bottomLeft - new Point(c, c),
e = new Size(a.bounds.width + 2 * c, a.bounds.height + 2 * c);
b.bounds = new Rectangle(d, e)
}
var ptTomm = 2.83465,
values = {
itemBleed: 2 * ptTomm
},
elements = {
itemBleed: {
type: "number",
label: "\u51fa\u8840",
min: 0,
max: 20 * ptTomm,
steppers: !0,
units: "millimeter",
increment: ptTomm
},
bleedMe: {
type: "button",
value: "\u77e9\u5f62\u51fa\u8840",
onClick: bleedMe
},
alignGradient: {
type: "button",
value: "\u8c03\u6574\u6e10\u53d8",
onClick: function () {
var a = document.selectedItems,
b = function (a) {
return new GradientColor(a.gradient, a.origin, a.destination)
};
a[0].bounds.width > a[1].bounds.width ? a[0].fillColor = b(a[1].fillColor) : a[1].fillColor = b(a[0].fillColor)
}
},
menuEntry: {
type: "menu-entry",
value: "\u5173\u4e8e\u4f5c\u8005",
onSelect: function () {
Dialog.alert("-- animalia (\u8df3\u5165\u82f9\u679c), from AiClub\nwww.aiclub.cn/bbs\n\u7279\u522b\u611f\u8c22 Scriptographer \u521b\u4f5c\u8005\nhttp://scriptographer.org")
}
}
},
palette = new Palette("AI \u6e10\u53d8\u51fa\u8840\u5de5\u5177", elements, values)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment