Skip to content

Instantly share code, notes, and snippets.

@jacobjoaquin
Created May 20, 2014 22:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacobjoaquin/a11d7ef65c0f6aec790b to your computer and use it in GitHub Desktop.
Save jacobjoaquin/a11d7ef65c0f6aec790b to your computer and use it in GitHub Desktop.
A quick mockup to see if LED strips aligned at an angle could produce readable scrolling type.
PGraphics theMask;
PImage imageMask;
String s = "Fresno Ideaworks LED Panel Test";
int xOffset;
int xInc = 200 / 11;
void generateMask() {
theMask = createGraphics(width, height);
theMask.beginDraw();
theMask.stroke(255);
theMask.strokeWeight(1);
for (int i = -80; i < width + 100; i += xInc) {
theMask.line(i, 0, i - (xInc * 4), height);
}
theMask.endDraw();
imageMask = createImage(width, height, ALPHA);
imageMask.copy(theMask, 0, 0, width, height, 0, 0, width, height);
}
void setup() {
size(300, 100);
generateMask();
smooth();
xOffset = width;
rectMode(CENTER);
}
void draw() {
background(0);
PGraphics visual = createGraphics(width, height);
visual.beginDraw();
visual.textSize(height + 30);
visual.textAlign(LEFT, CENTER);
visual.text(s, xOffset, height / 2 - 15);
visual.endDraw();
xOffset = xOffset - 2;
if (xOffset < -2000) {
xOffset = width;
}
imageMask.mask(visual);
image(imageMask, 0, 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment