Created
April 14, 2018 15:31
-
-
Save fal-works/348233c9471e7b43f9f2ee8e4d2521fc to your computer and use it in GitHub Desktop.
Icon Creator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Processing 3.3.7 | |
int iconSize = 640; | |
float strokeWeightFactor = 1.0 / 24; | |
int lineColorValue = 32; | |
int backgroundColorValue = 255; | |
boolean transparentIndicator = false; | |
float rotationAngleDegrees = -24; | |
float scaleFactor = 1; | |
String fileName = "icon"; | |
String fileExtension = "png"; | |
String directoryName = "output"; | |
void settings() { | |
size(iconSize, iconSize); | |
} | |
void setup() { | |
PGraphics graphics = createGraphics(iconSize, iconSize); | |
graphics.smooth(8); | |
graphics.beginDraw(); | |
if (transparentIndicator) graphics.stroke(0, 255 - lineColorValue); | |
else graphics.stroke(lineColorValue); | |
graphics.noFill(); | |
graphics.strokeWeight(max(strokeWeightFactor * iconSize, 1)); | |
graphics.translate(graphics.width / 2, graphics.height / 2); | |
graphics.rotate(radians(rotationAngleDegrees)); | |
graphics.scale(scaleFactor); | |
graphics.rectMode(CENTER); | |
graphics.rect(0, 0, iconSize / 2, iconSize / 2); | |
graphics.endDraw(); | |
background(backgroundColorValue); | |
image(graphics, 0, 0); | |
if (transparentIndicator) graphics.save(directoryName + '/' + fileName + ".png"); | |
else save(directoryName + '/' + fileName + "." + fileExtension); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment