Skip to content

Instantly share code, notes, and snippets.

@companje
Created June 7, 2012 22:16
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 companje/2891975 to your computer and use it in GitHub Desktop.
Save companje/2891975 to your computer and use it in GitHub Desktop.
LAOS SimpleCode Preview tool in Processing
//by Rick Companje, 8 june 2012
String lines[];
float scale=.003;
void setup() {
size(900,600);
mouseX = 0;
smooth();
lines = loadStrings("freest.lgc");
}
void draw() {
background(0);
float px=0; //previous position
float py=0;
float stepf = map(mouseX,0,width,0,lines.length); //progress
int step = int(stepf);
text(step + ": " + lines[step],5,height-7);
for (int i=0; i<lines.length; i++) {
int c[] = int(split(lines[i],' '));
if (c[0]<2) {
float x=c[1]*scale; //scale
float y=c[2]*scale;
if (c[0]==0) stroke(i<=step ? 255:50, 0, 0, 200); //red
else stroke(i<=step ? 255:50); //white
line(px,py,x,y);
if (i==step) { //ellipse moves substeps on line
float lx = lerp(px,x,stepf-step); //interpolate
float ly = lerp(py,y,stepf-step); //using rest value of division
ellipse(lx,ly,6,6);
}
px=x;
py=y;
}
}
}
2 98
0 1727 15747
7 101 10000
7 100 500
7 102 2500
1 5080 1270
1 7365 1270
1 7365 3860
1 7416 4368
1 7569 4876
1 7772 5283
1 8077 5638
1 8432 5943
1 8889 6197
1 9347 6349
1 9855 6400
1 10363 6349
1 10820 6197
1 11226 5943
1 11633 5638
1 11937 5283
1 12141 4876
1 12293 4368
1 12344 3860
1 12344 1270
1 14630 1270
1 17983 15747
1 1727 15747
1 1727 15747
0 19913 15747
1 23215 1270
1 25501 1270
1 25501 3860
1 25552 4368
1 25704 4876
1 25907 5283
1 26212 5638
1 26619 5943
1 27025 6197
1 27482 6349
1 27990 6400
1 28498 6349
1 28955 6197
1 29413 5943
1 29768 5638
1 30073 5283
1 30327 4876
1 30429 4368
1 30479 3860
1 30479 1270
1 32816 1270
1 36118 15747
1 35610 16103
1 35001 16509
1 34137 16916
1 33019 17373
1 31648 17729
1 30073 17983
1 28295 18084
1 26466 17983
1 24790 17729
1 23367 17373
1 22148 16916
1 20472 16103
1 19913 15747
1 19913 15747
0 0 0
2 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment