【问题标题】:Illustrator script for Flip Horizontal水平翻转的 Illustrator 脚本
【发布时间】:2012-07-22 20:16:10
【问题描述】:

加油!我搜索了高低,但不知道如何使用 Extendscript (jsx) 水平翻转单个选定对象。

有人可以帮忙吗?这当然不难!

【问题讨论】:

    标签: javascript transform adobe-illustrator extendscript


    【解决方案1】:

    试试这样的:

    mySelection = activeDocument.selection;
    if (mySelection.length>0){
        var doc = app.activeDocument;                   //current document
        var s    = doc.selection;                              //current slection
        var sl   = s.length;                                     //number of selected objects
        var m  = app.getScaleMatrix(-100,100);       //H flip matrix - feel free to change to (100,-100) for vertical flip, etc.
        for(var i = 0 ; i < sl; i++) s[i].transform(m); //for each selected element apply the flip matrix
        app.redraw();
    }else{
        alert("Nothing selected!")
    }
    

    或者,您可以通过 Reflect X 对您的选择使用变换效果通过效果 > 扭曲和变换 > 变换...) selected,这将单独翻转选择中的每个对象:

    【讨论】:

    • 说,现在 sn-p 很好。那将花费我一两天的时间来弄清楚那件事,因为我没有做那么多扩展脚本。现在,在我运行命令之后,它实际上并没有翻转,直到我单击屏幕上的某个位置。有什么要添加的东西可以更新屏幕吗?我通过 com runscript 命令调用该函数。
    • 如果翻转选择中的每个元素。如果需要,您可以将脚本保存在 Illustrator Presets/{language}/Scripts 文件夹中,这将通过文件 > 脚本使其可用,并且您可以为其分配键盘快捷键。我不知道 com runscript 命令是什么。
    • 不,我明白了:在最后一个“for”语句之后添加这个:app.redraw(); 我在整个内容中添加了一点包装;介意我用最终的工作脚本编辑你的帖子吗?
    • 这真是太好了 - 它翻转了所有选定的对象。太好了!
    【解决方案2】:

    好吧,我仍然不知道如何翻转选定的对象,但是这里有一个页面,其中包含一个脚本来翻转页面上的每个对象。这很接近;但是,它不值得抽雪茄。

    http://js4ai.blogspot.de/2010/11/flip-on-x-axis.html

    好的,Profenza 先生有答案!

    【讨论】:

      【解决方案3】:

      我用 applescript 做这个,“fastscripts”我把它绑定到 command + shift + H (& V)

      tell application "Adobe Illustrator"
          if (count page items in document 1) > 0 then
              set selectedItems to selection
              set scaleMatrix to get scale matrix horizontal scale -100.0 vertical scale 100.0
              transform every item in selectedItems using scaleMatrix
          end if
      end tell
      

      【讨论】:

        猜你喜欢
        • 2012-02-17
        • 2016-10-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-09-21
        • 2011-12-08
        • 1970-01-01
        相关资源
        最近更新 更多