Last active
March 19, 2017 15:06
-
-
Save pawal/55065fdcb35d33b844e4f071bbc1b9d6 to your computer and use it in GitHub Desktop.
Rasterbar in Processing
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
// c64 rasterbars | |
float y1 = 0; | |
float y2; | |
float y3; | |
float x1; | |
float xspeed = TWO_PI/222.0; | |
float yspeed = TWO_PI/233.0; | |
PFont petFont; | |
// pepto c64 palette | |
color black = color(0x00, 0x00, 0x00); | |
color white = color(0xff, 0xff, 0xff); | |
color red = color(0x68, 0x37, 0x2b); | |
color cyan = color(0x70, 0xa4, 0xb2); | |
color magenta = color(0x6f, 0x3d, 0x86); | |
color green = color(0x58, 0x8d, 0x43); | |
color blue = color(0x35, 0x28, 0x79); | |
color yellow = color(0xb8, 0xc7, 0x6f); | |
color orange = color(0x6f, 0x4f, 0x25); | |
color brown = color(0x43, 0x39, 0x00); | |
color pink = color(0x9a, 0x67, 0x59); | |
color darkgrey = color(0x44, 0x44, 0x44); | |
color grey = color(0x6c, 0x6c, 0x6c); | |
color lightgreen = color(0x9a, 0xd2, 0x84); | |
color lightblue = color(0x6c, 0x5e, 0xb5); | |
color lightgrey = color(0x95, 0x95, 0x95); | |
int[] colors = {black, white, red, cyan, magenta, green, blue, yellow, orange, brown, pink, darkgrey, grey, lightgreen, lightblue, lightgrey}; | |
int[] rasterbar = { 0,6,0,0,6,6,0,6,6,6,4,6,6,4,4,6,4,4,4,14,4,4,14,14,4,14,14,14,3,14,14,3,3,14,3,3,3,13,3,3,13,13,3,13,13,13,1,13,13,1,1,13,1,1,1,7,1,1,7,7,1,7,7,7,15,7,7,15,15,7,15,15,15,10,15,15,10,10,15,10,10,10,8,10,10,8,8,10,8,8,8,2,8,8,2,2,8,2,2,2,9,2,2,9,9,2,9,9,9,0,9,9,0,0,9,0,0 }; | |
int[] rasterbar2 = { 0,6,0,6,4,6,0,6,4,14,4,6,0,6,4,14,3,14,4,6,0,6,4,14,3,13,3,14,4,6,0,6,4,14,3,13,1,13,3,14,4,6,0,6,4,14,3,13,3,14,4,6,0,6,4,14,3,14,4,6,0,6,4,14,4,6,0,6,4,6,0,6,0,0,0,9,0,9,8,9,0,9,8,10,8,9,0,9,8,10,15,10,8,9,0,9,8,10,15,7,15,10,8,9,0,9,8,10,15,7,1,7,15,10,8,9,0,9,8,10,15,7,15,10,8,9,0,9,8,10,15,10,8,9,0,9,8,10,8,9,0,9,8,9,0,9,0,0 }; | |
int[] rasterbar3 = { 9,8,5,8,9,0,9,8,5,3,5,8,9,0,9,8,5,3,13,3,5,8,9,0,9,8,5,3,13,1,13,3,5,8,9,0,9,8,5,3,13,1,1,13,3,5,8,9,0,9,8,5,3,13,1,1,1,7,3,14,4,6,0,6,4,14,3,13,1,1,13,3,14,4,6,0,6,4,14,3,13,1,13,3,14,4,6,0,6,4,14,3,13,3,14,4,6,0,6,4,14,3,14,4,6,0,6,4,14,4,6 }; | |
int[] rasterbar4 = { 9,0,9,8,9,0,9,8,8,9,0,9,8,10,8,9,0,9,8,10,10,8,9,0,9,8,10,15,10,8,9,0,9,8,10,15,15,10,8,9,0,9,8,10,15,7,15,10,8,9,0,9,8,10,15,7,7,15,10,8,9,0,9,8,10,15,7,1,7,15,10,8,9,0,9,8,10,15,7,1,1,7,15,10,8,9,0,9,8,10,15,7,1,1,1,7,15,10,8,9,0,9,8,10,15,7,1,1,7,15,10,8,9,0,9,8,10,15,7,1,7,15,10,8,9,0,9,8,10,15,7,7,15,10,8,9,0,9,8,10,15,7,15,10,8,9,0,9,8,10,15,15,10,8,9,0,9,8,10,15,10,8,9,0,9,8,10,10,8,9,0,9,8,10,8,9,0,9,8,8,9,0,9,8,9,0,9 }; | |
void setup() { | |
fullScreen(P2D); | |
smooth(8); | |
noStroke(); | |
fill(102); | |
frameRate(60); | |
petFont = createFont("Pet Me 64", 32); | |
} | |
void draw() { | |
background(blue); // clear screen | |
strokeWeight(1); | |
y1 = y1 + yspeed; | |
int j = 0; | |
for (int i : rasterbar4) { | |
stroke(colors[i]); | |
line(0,sin(y1)*400+500+j,width,sin(y1)*400+500+j); | |
j++; | |
} | |
j = 0; | |
for (int i : rasterbar3) { | |
stroke(colors[i]); | |
line(0,sin(y1+100)*400+500+j,width,sin(y1+100)*400+500+j); | |
j++; | |
} | |
x1 = x1 + xspeed; | |
fill(black); | |
textFont(petFont); | |
text("Commodore 64", sin(x1)*700+700, sin(y3)*400+500+96); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment