【问题标题】:Fill Shapes automatically with 5~ colors randomly in illustrator在 Illustrator 中随机使用 5~ 种颜色自动填充形状
【发布时间】:2020-11-17 15:56:40
【问题描述】:

我在 Illustrator 中有一个拼凑的形状马赛克,但目前它们都是黑白的。

例如:

但是,我已经有了一系列颜色,我想用这些颜色以随机顺序填充每个形状(最好不要让两种颜色彼此相邻),使其看起来像:

例如:

我的第一个文件中有 250 多块马赛克,而我的第二个文件有 800 多块。

【问题讨论】:

    标签: adobe-illustrator


    【解决方案1】:
    /*
       This script performs random color fill.
       Select art items and colors in swatches panel and run script.
       Note: neighbor art items can get the same colors.
    */
    var doc = app.activeDocument;
    var selItems = doc.selection;
    var sw_sel = doc.swatches.getSelected();
    if (sw_sel.lenght==0 )
        exit;
    
    for (var i=0; i<selItems.length; i++)
    {
        var selItem = selItems[i];
        if(selItem.typename == "PathItem"   || 
            selItem.typename == "CompoundPathItem")
        {
            var randomColorIdx = getRandom(0, sw_sel.length - 1);
            setColor(selItem, sw_sel[randomColorIdx].color);                
        }
    }
    
    function setColor(pItem, color)
    {
       pItem.filled = true;
       if(pItem.typename == "PathItem")
                pItem.fillColor = color;
        else
            pItem.pathItems[0].fillColor = color;    
    }
    
    function getRandom(min, max)
    {
        return Math.floor(Math.random() * (max - min + 1)) + min;
    }   
    

    【讨论】:

      【解决方案2】:

      有一些插件和脚本可以做到这一点。

      Randomill 就是这样一个插件,robotwood 的'Random Swatches Fill' script 是另一个。使用其中任何一个,您都可以使用色板面板中的色板并将它们随机应用于一组对象。

      【讨论】:

        猜你喜欢
        • 2016-02-20
        • 2014-05-21
        • 2013-06-27
        • 2020-07-01
        • 1970-01-01
        • 2014-05-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多