白云岛资源网 Design By www.pvray.com

这篇教程像的AI爱好者们介绍用AI脚本建立点到点的连线这个脚本是将对象上能互相连接的点做一个连接。示例如图:

AI脚本建立点到点的连线教程

连接之后类似于曼陀罗的形状。在多边形、星型或者手绘图形上也试试吧。
点最好多一些,这样能得到更好的形状;较少的点可能没有什么变化。

要用“文件-脚本”来使用,以CS3为例应放在"C:\Program Files\Adobe\Adobe Illustrator CS3\预设\脚本"下。
当然,也可以放置在其他文件夹中,通过Ctrl+F12定位到脚本所在处来使用。
复制以下全部文字到记事本中,保存为以.js结尾的脚本文件(如:脚本.js)即可。


复制代码代码如下://///////////////////////////////////////////////////////////////
// All Points v.1.3 -- CS,CS2,CS3,CS4
//>=--------------------------------------
// This script simply draws a line from every point to every other point of your selected pathitem.
// Handy for making Mandalas. Try on polygons, stars or even freehand shapes.
//>=--------------------------------------
// JS code (c) copyright: John Wundes ( john@wundes.com ) www.wundes.com
//copyright full text here: http://www.wundes.com/js4ai/copyright.txt
//////////////////////////////////////////////////////////////////
function Loadbar(x){
this.versionNum= app.version.split(".")[0] ;
if (this.versionNum >= 13){
this.w = new Window('window', "Processing...", undefined, {independent:true});
this.w.frameLocation = [600,400];
this.w.tracker = this.w.add ('statictext' , [15,15,250,35], "processing");
this.w.prog = this.w.add ('progressbar' , [15,15,250,35], 0, x);
//this.w.show();
}
}
Loadbar.prototype.close = function(){
if (this.versionNum >= 13){
this.w.close();
}
}
Loadbar.prototype.hide=function(){
if (this.versionNum >= 13){
this.w.hide();
}
}
Loadbar.prototype.show=function(){
if (this.versionNum >= 13){
this.w.show();
}
}
Loadbar.prototype.update=function(x){
if (this.versionNum >= 13){
this.w.prog.value = x;
}
}
Loadbar.prototype.label=function(x){
if (this.versionNum >= 13){
this.w.tracker.text = x;
}
}
Array.prototype.indexOf = function(i){
var len = this.length;
for (var a=0;a{
if (this[a]==i)
{
return a;
}
return -1;
}
}
Array.prototype.man = function(test, tvars_arr, doThis, dovars_arr) {
var FUN="function";
var OBJ="object";
var UND="undefined";
var a=typeof test;
var b=typeof tvars_arr;
var c=typeof doThis;
var d=typeof dovars_arr;
// if only an array is given, it is assumed we wish to copy to it:
if (a==OBJ && tvars_arr ==undefined && doThis==undefined && dovars_arr==undefined)
{
dovars_arr = test;
test=undefined;
}
//if we just want to process all items without any testing: doThis,[dovars_arr] fun,ob
if (a==FUN && b==OBJ && doThis==undefined && dovars_arr==undefined)
{
//alert("correct");
doThis=test;
test=undefined;
dovars_arr=tvars_arr;
tvars_arr=undefined;
}else if(a==FUN && b==FUN){ // fun,fun OR fun,fun,ob
if (c==OBJ)
{
dovars_arr=doThis;
}
doThis=tvars_arr;
tvars_arr=undefined;
}
// Either case should work as normal: fun,ob,fun OR fun,ob,fun,ob
// Now set defaults if anything is missing:
test= test==undefined?AMT_exists:test;
tvars_arr= tvars_arr==undefined?[0]:tvars_arr;
doThis= doThis==undefined?AMA_exportTo:doThis;
dovars_arr= dovars_arr==undefined?[0]:dovars_arr;
//
var sl = this.length;
for (var ds = 0; ds<(sl-1); ds++) {
//first referenced function call
if (test(this[ds], tvars_arr)) {
// second referenced function call
var ret = doThis(this[ds], dovars_arr);
//change original array item if something is returned
if (ret != undefined) {
this[ds] = ret;
}
}
}
}
//DEFAULT TEST:
function AMT_exists(item, y_arr) {
//filler function for arrayMan
//always true
return 1;
}
//DEFAULT ACTION:
// exports each tested item to exp_arr
function AMA_exportTo(item, exp_arr) {
//alert(item);
exp_arr.unshift(item); //unshift because the array is being processed backwards.
}
function AMA_LinesTo(item, vars_arr) {
var count = vars_arr[0];
var group = vars_arr[1];
var src_arr = vars_arr[2];
var sal = src_arr.length;
// draw a line from this point, to every remaining point in the array
if (count == sal-1)
{
//alert("last one");
return
}
//
for (var p=(count+1);p<sal></sal>{
var myLine = drawLine(item.anchor, src_arr[p].anchor);

/* // uncomment for some fun grayscale action
var col=255/(sal/(count+1));
myLine.strokeColor.red = col;
myLine.strokeColor.green= col;
myLine.strokeColor.blue = col;
*/

b.update(p);
b.label("Item:"+(s+1)+" of "+selLen+". (node "+count+" of "+(sal-1)+")");
//redraw();
//alert("drawing count:"+count+"\nindex of "+item+" in:"+src_arr+":"+src_arr.indexOf(item));
}
vars_arr[0]++; //note: count++ doesnt work
}
function drawLine(anchor1,anchor2) {
//alert(anchor1+" and "+anchor2);
//draw a single line from point a to point b
var linePath = shapeGroup.pathItems.add();
var offset=0; // [anchor1[0]-offset,anchor1[1]-offset]
linePath.setEntirePath( Array(anchor1,anchor2) );
linePath.closed = false;
linePath.stroked = true;
linePath.filled = false;
linePath.strokeWidth = 1;
return linePath;
}
//----------------main
alert0="请打开一个文档";
alert1="只能对单一对象生效!\n不能是剪切蒙版、复合路径、复合形状、群组等!";
if ( app.documents.length == 0 ) {
alert(alert0);
}else if (app.activeDocument.selection.length == 0){
alert(alert1);
}else if (app.activeDocument.selection[0].typename != "PathItem"){
alert(alert1);
}else{
doc=activeDocument;
sel=doc.selection;
selLen=sel.length;
// walk through each selected item
for (var s=0;s<sellen></sellen>{
if (sel[s].typename == "PathItem")
{
var b = new Loadbar(sel[s].selectedPathPoints.length);
b.show();
var obj = sel[s];
var src_arr = obj.selectedPathPoints;
var count = 0;
var shapeGroup = app.activeDocument.groupItems.add();
src_arr.man(AMA_LinesTo,[count,shapeGroup,src_arr]);
b.close();
}
}
}

白云岛资源网 Design By www.pvray.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
白云岛资源网 Design By www.pvray.com

RTX 5090要首发 性能要翻倍!三星展示GDDR7显存

三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。

首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。

据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。