will not run in Javascript on my machine, nor will it run on the web like my other .pde s
in
Processing with Other Languages
•
22 days ago
And yet the code is very similar.
It runs fine from the sketch window but as soon as I dump it into a web page (like all my other sketches) or try to run it in Javascript -- even using the export-to-web tool, it simply will not run. I have tried it with processing.js, processing.min.js, and even processing-1.4.1.min.js.
I want to get back to studying the camera that Jeff showed me, but had to finish the piece I was working on. It's done now, and I'm happy with it. BUT though there are no errors -- it will not run on my website. And, this is even based on code that already runs there.
I don't mind programming problems because in trying to figure them out I usually learn a great deal, but I hate this kind of stuff because I don't know where to look.
I've checked books, but none seem to address this kind of issue.
It runs fine from the sketch window but as soon as I dump it into a web page (like all my other sketches) or try to run it in Javascript -- even using the export-to-web tool, it simply will not run. I have tried it with processing.js, processing.min.js, and even processing-1.4.1.min.js.
I want to get back to studying the camera that Jeff showed me, but had to finish the piece I was working on. It's done now, and I'm happy with it. BUT though there are no errors -- it will not run on my website. And, this is even based on code that already runs there.
I don't mind programming problems because in trying to figure them out I usually learn a great deal, but I hate this kind of stuff because I don't know where to look.
I've checked books, but none seem to address this kind of issue.
- // Title: Hard Edge Organics
- // by Clair Dunn - September, 2013
- int cr, cg, cb;
- float xstrt, ystrt, squaresize;
- void setup() {
- size(600, 600, P2D);
- frameRate(10);
- colorMode(HSB, 255);
- background(0);
- xstrt = random(10);
- ystrt = random(10);
- squaresize = height/8;
- }
- void draw() {
- xstrt += 0.02;
- ystrt += 0.01;
- float noise = noise(10);
- translate(width/2+noise, height/2+noise);
- float ynoise = ystrt;
- for (float y = -squaresize; y <= squaresize*noise; y+=3) {
- ynoise += 0.05;
- float xnoise = xstrt;
- for (float x = -squaresize; x <= squaresize; x+=3) {
- xnoise += 0.05;
- drawPoint(x, y, noise(xnoise, ynoise));
- }
- }
- }
- void drawPoint(float x, float y, float noiseFactor) {
- pushMatrix();
- translate(x * noiseFactor * 4, y * noiseFactor * 4);
- float edgeLen = noiseFactor * 50;
- stroke (0, 0, 0);
- rectMode(CORNER);
- rect(0, 0, edgeLen, edgeLen);
- cr = int(random(255));
- cg = int(random(127));
- cb = int(random(255));
- stroke(cr, cg, cb);
- triangle (0, 0, edgeLen, edgeLen, 35, 60);
- if ( (x >500) && (y < -500) ) {
- line(x, y, 600, 600);
- }
- popMatrix();
- }
1