Long time graphic designer/typographer and artist. I teach web design at the Community College of Vermont and live in a small town near the Canadian border. I love colors and working with processing.
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);
Don't know how else to put it. When I run this (errorless) code, sometimes there is a blank sketch window, next time perhaps a drawn line or two -- or even many, next time, a
black sketch window, then back to white with or without lines.
The background is never redrawn. I don't know where to look for this kind of problem event.
I am happy with the code which I am just beginning to work with. I want to expand it, but I want to solve this problem first.
You can easily see it by repeatedly clicking run and stop, run and stop. Even if you happen to get a line or two the first time, keep on clicking stop and run. (Oh, it never does start over either, although it does get into the last section, as you can see by the comment.) Thank you much!
float unkn = 0.09;
int cpx1 = width/4;
int cpy1 = height/4;
int cpx2 = width/4;
int cpy2 = height/4;
int x = round(cpx1+=unkn);
int y = cpy2+=random(10, 390);
int k;
int m;
int x2, y2;
int i = 0;
void setup( )
{
size(400, 600);
background(255);
smooth();
noFill();
stroke(0);
}
void draw( )
{
// for (int i = 0; i<=200; i++) { // went to while loop, but problem remains
while (i != 200) {
beginShape();
k = int(random(30, 80));
m = int(random(20, 120));
vertex(30, 70); // first point
bezierVertex(cpx1, cpy1, cpx2, cpy2, 50, 100);
x2 = cpx2;
y2 = cpy2;
bezierVertex(x2, y2, cpx2+=k, cpy2+=m, 100, 75);
x2 = cpx2;
y2 = cpy2;
stroke(random(255), random(255), random(255));
endShape();
i++;
if (i == 200){ // makes no difference if this code is within Shape or here
it appears a little more than half-way down the page.
Because I am learning, I decided to work with the code piece by piece to see if I could learn what it was doing.
I'm leaving out all the camera stuff which is way beyond me. But, I ran into a problem when I wanted to confine, to the processing screen, the lines being drawn.
I first tried constrain with this code:
// constrain(p.x, 0, width-20);
// constrain(p.y, 0, height-20);
// constrain(p.z, 0, height);
and that appeared to do nothing.
I then tried the forceful brute math method:
if (p.x >= width) {p.x=width-10;}
if (p.y >= height){ p.y=height-10;}
if (p.x < 0) {p.x=10;}
if (p.y < 0){ p.y=10;}
And still they disappear.
Although the line usually comes back on screen fairly fast,
my main issue is with the immediate start up of the sketch -- it VERY often is off screen for quite some time and I stop and restart. But I would like to ALWAYS have the line start on the screen area.
I've no idea what's going on. Here is the full sketch:
// a selection from amnon's 3D line code
ArrayList <PVector> points = new ArrayList <PVector> ();
When my sketch, which has a black background, runs on the web on a page also with a black background, there is a grey fine-dotted border around the sketch window.
I would very much like to get rid of it -- I've checked the ref., three books, and can't find anything about this mysterious border.
The interesting thing is, that when the sketch/page first loads, there is no border. Thereafter it appears with each mouse click----which tells me that the issue is in my code -- but I am unable to find it.
I have changed all sorts of things which might be related to a border, but nothing changes.
//////////////////////////////////////////// // Clair Dunn 15SEP2013 CHAOS OUT OF ORDER //////////////////////////////////////////// int i; void draw() { // stroke(0); //tried this to see if border vanished - didn't }; void setup() { size (500, 500); background(0); for (int i=0; i<100; i++) { drawRectangle(random(width), random(height), random(200), random(200)); } }
void drawRectangle(float x, float y, float w, float h) { if (x+width/2 >=499) { fill(random(255), random(255), random(255)); stroke(0); strokeWeight(2); triangle (x-200, int (random(400)), 100, 100, 35, int(random(150))); } else { int opacity = int (random(255)); noStroke(); fill(random(255), random(255), random(255), opacity); rect( x, y, w, h); } } void mousePressed() { // background(random(255), random(255), random(255)); background(0); for (int i=0; i<100; i++) { noStroke(); drawRectangle(random(width), random(height), random(200), random(200)); } }
You can't see the border when you just run it in the processing window, but you can see it on the web if you need to.
How do folks handle this? Or am I missing some kind of setting. At this time I am able to see only about half of the sketches I've been working with. I then have to use "open" which puts me in my home directory from which I have to navigate to the sketchbook.
I checked preferences.txt, but there seems to be nothing about configuring the sketches list, or for setting the base directory for "open".
Curious about how you all set up your working environment.
I hope there are some folks on here old enough to have been there and done that! But here is a shot of my very earliest algorithmic art work. The computer: a
Timex-Sinclair. (Which I still have.)
I put this here because there seemed to be no obvious place for this. I apologize if it is the wrong thing to do.
I have re-organized the processing.org Reference Index Page into alphabetic order.
People new to processing (as I am) must scan the entire non-alpha page in search of a function. Becuase we are new, we haven't the foggiest idea of what category it falls under. It is an open source document.
I want to keep drawing lines from the last point to the next point -- the next point is randomly chosen (Brownian movement) but I woud like to be able to control the length of the line, say have each line be 80 points long. I'm no math prodigy and I can't seem to find the right functions to look at. Here's the functioning code:
point (x, y);
fill(255,0,0); // make a red circle around each node
ellipse(x,y, 8,8);
ex = int(random(0, rangex));
ey = int(random(0, rangey));
stroke(4,216,52); // green line
line(x, y, ex, ey);
I want the set the distance of the line which is drawn from x,y to ex, ey.
The rita folder is in the sketchbook folder under libraries right along with Open CV. The OpenCV shows up under Contributed Libaries but RiTa does not. When I put one of the rita examples into P and try to run it, I get this msg.:
No library found for rita
Libraries must be installed in a folder named 'libraries' inside the 'sketchbook' folder.
And the top level of rita has the same pattern as opencv. I have restarted Processing twice. I have even shut down the machine and started up again.
Anyone have any ideas about this? (Of course I first followed rita's own install text which said it should be installed in a libraries folded under Processing-*. When that didn't work I tried the standard way.)
Thanks. ( LINUX users with problems in this area, check the last post here.)
I have found no clear install instructions for fixing the Java issues on Linux. I have downloaded and installed (from Sun/Oracle) jkd1.0.7_25 TWICE and also have installed processing twice. I still get this error when running the following command
>>>
clair@clair-p7-1226s ~/processing-2.0.1 $ /opt/java/jdk1.7.0_25/bin/../bin/java: 1: /opt/java/jdk1.7.0_25/bin/../bin/java: Syntax error: end of file unexpected (expecting ")")
<<<
The error is quite unhelpful it seems to say that the file which has the error is the java file in the /bin subdir of the jdk1.0.7_25 directory.
I am running this on:
Linux Mint 15
version:
3.8.0-25-generic #37-Ubuntu SMP Thu Jun 6 20:47:30 UTC 2013 i686 i686 i686 GNU/Linux
(I am finding it impossible to understand why such a wonderful language implementation as Processing is should have an extremely complex installation. Seems to nullify the beauty and simplicity of Processing itself.)
I am desperate to get going with processing so I will be grateful for any help. Especially a pointer to some clear explanation of exactly how do deal with the java problems which processing seems to have embedded in its installation.