Giter Site home page Giter Site logo

csscripts's Introduction

Creative Cloud Scripts

Various scripts for Creative Cloud (fka Creative Suite) tools organized in a very simple framework.

Scripts are organized by software (Photoshop, Illustrator, Flash Pro…). Inside each folder is a series of utilities declared as top-level object, usually defined inside function closures.

Subfolders contain ready-to-use scripts. When available, end users should always use the compiled jsxbin version of the scripts since it includes dependencies.

csscripts's People

Contributors

davidderaedt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

csscripts's Issues

CC 2024 support

After selection of swatches the script doesn't apply the swatches to the objects.

Added support for groups for the Randomize Colors scripts

var logStr="";
function log(pStr){
logStr+=pStr+"
";
}

function main(){

if ( app.documents.length == 0 ) {  
    return;     
}

doStuff();

return logStr;

}

function doStuff() {

var doc = app.activeDocument;
var canRect = doc.artboards[0].artboardRect;
var boardW = canRect[2];
var boardH = -canRect[3];

var swatches = doc.swatches.getSelected();

if(doc.selection.length==0) {
   alert("No items selected");        
} else if(swatches.length == 0) {
   alert("Please select swatches");
} else {
    findShapes
   randomizeColor(findShapes(doc.selection), swatches);
}

}

function findShapes (items)
{
var itemsList = [];
for (var i = 0; i < items.length; i++)
{
if (items[i].typename === "GroupItem") {
itemsList = itemsList.concat(findShapes(items[i].pageItems));
}
else{
itemsList.push(items[i]);
}
}

    if(itemsList.length > 0){

    return itemsList;
        }

}

function randomizeColor (items, swatches) {

var count = items.length;

for (var i = 0; i < count ; i++) {                
    var c = items[i];
    var swatchIndex = Math.round( Math.random() * ( swatches.length - 1 ) );
    c.fillColor = swatches[ swatchIndex ].color;

   // var swatchIndex2 = Math.round( Math.random() * ( swatches.length - 1 ) );            
  // c.strokeColor = swatches[ swatchIndex2 ].color;
}

}

main();

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.