I've set this program to play audio files of different cricket chirp frequencies depending on real time temperature pulled from yahoo, but seem to have a (layering)? problem because it sounds like it is playing all of the audio files at once. Any suggestions?
I can't see why the ellipse getting pushed to the side in this program. When I separate the ellipse and the sphere out from each other they run fine. I'm miffed, lol!
PFont f;
float r = 200; //radius
float w1 = 40;
float h1 = 15;
float w2 = 15;
float h2 = 40;
void setup() {
size(600, 600, P3D);
background(0);
}
void draw() {
background(235);
noFill();
stroke(255, 100);
strokeWeight(10);
fill(255);
//ellipse(300, 300, 400, 400);
lights();//set a default light
translate(300, 300, 0);//move the sphere to the center of the canvas
rotateY(random(-.08, .01));
rotateX(random(-.08, .01));
rotateZ(random(-.08, .01));
sphere(200);//draw the sphere
delay(50);
//start in the center and draw the circle
translate(300,300);
noFill();
noStroke();
ellipse(width/2,height/2,r*2,r*2);
//10 crosses along the curve
int totalCrosses = 25;
// We must keep track of our position along the curve
float arclength = 0;
// for every cross
for (int i = 0; i < totalCrosses; i++) {
arclength += w1/2; //each cross is centered so we move half the width
float theta = arclength/r; // angle in radians is the arclength divided by the radius
Below is a simple sketch I'm playing with - a visualization of the simstim switch in William Gibson's novel "Neuromancer". Can anyone please give me a hint as to how to end the loop and reset the initial image after a couple second delay? Seems simple enough, but after playing with delay(), endLoop, and recalling the initial image, i'm still stumped.
PImage img;
void setup() {
size(400, 400);
smooth();
img = loadImage("simstim switch off 2.jpg"); //load initial image
The following code I began playing with from openprocessing.org. I'm interested in emergent systems and flocking patterns. It is interesting to me that flocks of birds and schools of fish will behave as a unit based on subtle cues. I used to think this happens less with people. Now I would argue that it happens across the board, with people, with the spread of ideas, etc. What I would like to do with this code is draw in another boid of a different color (we'll say green because it is a cool and natural color). This boid will not be controlled by the flocking algorithm but will move randomly. However, when it gets very close to another boid it will turn that boid green which will then spread throughout the flock, one by one. That being said, I'm not sure how to write the code to make this happen yet. Any pointers would be greatly appreciated.
int initBoidNum = 100; //amount of boids to start the program with
BoidList flock1;//,flock2;//,flock3;
float zoom=800;
boolean smoothEdges = false;
void setup()
{
size(800,600,P3D);
//create and fill the list of boids
flock1 = new BoidList(initBoidNum,0);
//flock2 = new BoidList(0,0);
//flock3 = new BoidList(100,128);
}
void draw()
{
//clear screen
beginCamera();
camera();
rotateX(map(mouseY,0,height,0,
TWO_PI));
rotateY(map(mouseX,width,0,0,
TWO_PI));
translate(0,0,zoom);
endCamera();
background(#75E8ED);
noFill();
stroke(#75E8ED);
line(0,0,300,0,height,300);
line(0,0,900,0,height,900);
line(0,0,300,width,0,300);
line(0,0,900,width,0,900);
line(width,0,300,width,height,
300);
line(width,0,900,width,height,
900);
line(0,height,300,width,
height,300);
line(0,height,900,width,
height,900);
line(0,0,300,0,0,900);
line(0,height,300,0,height,
900);
line(width,0,300,width,0,900);
line(width,height,300,width,
height,900);
flock1.run();
//flock2.run();
//flock3.run();
if(smoothEdges)
smooth();
else
noSmooth();
}
void keyPressed()
{
switch (keyCode)
{
case UP: zoom-=10; break;
case DOWN: zoom+=10; break;
}
switch (key)
{
case 's': smoothEdges = !smoothEdges; break;
}
}
//new tab
class Boid
{
//fields
PVector pos,vel,acc,ali,coh,sep; //pos, velocity, and acceleration in a vector datatype
float neighborhoodRadius; //radius in which it looks for fellow boids
float maxSpeed = 4; //maximum magnitude for the velocity vector
float maxSteerForce = .1; //maximum magnitude of the steering vector
float h; //hue
//constructors
Boid(PVector inPos)
{
pos = new PVector();
pos.set(inPos);
vel = new PVector(random(-1,1),random(-
1,1),random(1,-1));
I'm stumped in trying to tweak this code into returning the ball from the left edge of the screen, instead of the middle of the ball off screen. Can anyone point me in the right direction of how manipulate the x variable to make that happen?
I'm a grad student in painting, learning processing language for the first time. I've gotten nearly half way through Shiffman's Learning Processing textbook but stuck on one of the lessons in the book. Could anyone please take a second to look at this code and let me know what you think might be wrong?
Zoog[] zoogies = new Zoog[200];
void setup() {
size(500,500);
smooth();
frameRate(60);
for (int i = 0; i < zoogies.length; i++) {
zoogies[i] = new Zoog(color(80,225,180),250,200,60,60,16,random(255),random(255),random(255),random(255));