Hackpact.Mx

. . . make and document something new everyday, for one month
Inicio Proyectos     Contacto Ligas

Thomas Sanchez Lengeling

 
   
31 Julio 2011

//código Processing

int numParticulas = 800;
int numRuido = 20;
int distZ = 50;
float radio = 20;
float noiseVal = 0.1;
float theta = 0.1;

Particulas[] particulasVals;

void setup() {
size(600, 600, P3D);
smooth();
background(0);
particulasVals = new Particulas[numParticulas];
for (int i = 0; i < numParticulas; i++)
particulasVals[i] = new Particulas();
}

void draw() {
fill(0, 5);
rect(0, 0, width, height);
translate(width/2, height/2, 0);
rotateX( PI/2);
strokeWeight(5);
for (int i = 0; i < numParticulas; i++) {
Particulas from = particulasVals[i];
for (int j = 0; j < numParticulas; j++) {
Particulas to = particulasVals[j];
float distancia = dist(from.posx, from.posy, from.posz, to.posx, to.posy, to.posz);
if (distancia < distZ) {
stroke((distZ + j)%255, 40);
line(from.posx, from.posy, from.posz + random(-10,10), to.posx, to.posy, to.posz + random(-10, 10));
}
}
}

for (int i =0; i < numParticulas; i++) {
Particulas tmpPar = particulasVals[i];
tmpPar.restart(theta);
}

noiseVal += 0.01;
radio = noise(noiseVal) * 50;
distZ = int(radio/1.3);
theta+=0.1;
}

int i =0;
void keyPressed() {
save("image1"+i+".jpg");
i++;
}

class Particulas{
float t1;
float t2;
float posx;
float posy;
float posz;
float ruidVal;
float radio;

Particulas(){
this.t1 = random(360);
this.t2 = random(360);
ruidVal = random(0.01, 0.1);
radio = random(100, 200);
}

void restart(float rad){
posx = radio * cos(t1) * (sin(t2) + noise(rad));
posx = radio * sin(t1) * (sin(t2) + noise(rad));
posz = radio * sin(t2 + noise(rad));

ruidVal += 0.05;
radio = noise(ruidVal)*radio + 150;
}
}

 
30 Julio 2011

//código Processing

void draw() {
for (int i=0; i < n ; i++) {
Particulas tmpPar = particulas[i];
Particulas p = tmpPar.tipoCurva(tmpPar.posx, tmpPar.posy, 1 );
float opac = mag(p.posx, p.posy) % 40;
float hue = atan2(p.posy, p.posx);
stroke(0, i%30 + hue, hue +i%50, opac + 10);
beginShape();
vertex( tmpPar.posx*cos(tiempo)+random(30) + opac*2, tmpPar.posy*cos(tiempo)*sin(tiempo) +random(30) + opac*2);
vertex( tmpPar.posx*cos(tiempo)+random(30) + opac*2, tmpPar.posy*sin(tiempo)*sin(tiempo) +random(30) + opac*2);
vertex( tmpPar.posx*cos(tiempo)+random(30) + opac*2, tmpPar.posy*sin(tiempo)+random(30) + opac*2);
endShape();
//tmpPar.update(i);
tiempo+=0.1;
}
}
}

class Particulas {
void newPos(int index) {
float randVal = random(longitud);
float ang = random(TWO_PI);
setPos( random(-width/2 +50, width/2- 50) + randVal* cos(ang*index), random(-height/2 + 50, height/2- 50) + randVal *sin(ang*index) );
}

Particulas tipoCurva(float posx, float posy, int type) {
return new Particulas( noise(tiempo)*width, noise(tiempo)*height);
}

void update(int index) {
tiempo += 0.06;
vida++;
if ( vida > vidaMax) {
vida= (int)random(70);
newPos(index);
}

 
29 Julio 2011

//código Processing

int numParticulas = 2000;
float tiempo =0.01;
float velocidad = 60;
float noiseValue;
int i =0;

void setup() {
size(600, 600);
smooth();
noStroke();
background(0);
}

void draw() {
fill( 0, 20);
rect(0, 0, width, height);
for (int i = 0; i < numParticulas; i++) {
update();
}
tiempo += 0.09;
}

void update() {
float x = random(-1, 1);
float y = random(-1, 1);
float ang = atan2(y, x);
float dx = x * sin(tiempo - x);
float dy = cos(tiempo *y);
float dang = atan2(dy, dx);

float d = 1 + 5*mag(dx, dy);
float rot = random(-velocidad, velocidad)*tiempo;

float px = map(dx, -1, 1, 0, width);
float py = map(dy, -1, 1, 0, height);

stroke( abs((ang - dang)*190)%200, abs(cos(dang + tiempo))*90);
strokeWeight(d*2.0);
line( px - d * sin(rot)*cos(rot), py - d * cos(rot) * cos(rot),
px + d * cos(rot)*sin(rot), py + d * cos(rot));

noStroke();
fill(abs((ang - dang)*150)%200, 0, 0, abs(cos(dang + tiempo))*50);
ellipse(px - d*sin(rot)*cos(rot)*random(-10, 10)*noise(tiempo),
py +d*sin(rot)*sin(rot)*random(-10, 10)*noise(tiempo), 6, 6);

}

void keyPressed() {
save("image1"+i+".jpg");
i++;
}

 
28 Julio 2011

//código Processing

int numParticulas = 1000;
float tiempo = 0.01;
float noiseValue = 0.01;

void setup() {
size(600, 600);
smooth();
noStroke();
background(0);
}

void draw() {
fill( 0, 2);
rect(0, 0, width, height);
for (int i = 0; i < numParticulas; i++) {
update();
}
tiempo += 0.09;
noiseValue += 0.06;
}

void update() {
float x = random(-1, 1);
float y = random(-1, 1);
float ang = atan2(y, x);

float dx = x * cos(tiempo) + x*noise(noiseValue);
float dy = y * sin(tiempo) + y*noise(noiseValue);

float mx = map(dx, -1, 1, 0, width);
float my = map(dy, -1, 1, 0, height);

float mg = mag(x, y);

stroke(80+ ang*10, 50);
strokeWeight(mg*10 + 1);
line(mx + dx*70*cos(tiempo), my + dy*70*cos(tiempo), mx + random(-20, 20), my + random(-20, 20));

stroke(mg*80 + ang*20, 50);
strokeWeight(mg*15 + 1);
line(mx + dx*70*cos(-tiempo), my + dy*70*cos(-tiempo), mx, my);

noStroke();
fill( abs(dx)*85, 30);
ellipse(mx, my, 10, 10);
fill(0, 0, abs(dy)*30, 40);
ellipse(mx, my, 20, 20);
}

int i =0;
void keyPressed() {
save("image1"+i+".jpg");
i++;
}

 

27 Julio 2011

//código Processing

int numParticulas = 2000;
float tiempo =0.01;
float velocidad = 60;
float noiseValue;
int i =0;

void setup(){
size(600, 600);
smooth();
noStroke();
background(255);
}

void draw(){
fill( (noise(tiempo)*100)%255 + 150, 10);
rect(0, 0, width, height);
for(int i = 0; i < numParticulas; i++){
update();
}
tiempo += 0.09;
}

void update() {
float x = random(-1, 1);
float y = random(-1, 1);
float ang = atan2(y, x);
float dx = x * cos(tiempo - x);
float dy = sin(tiempo *y);
float dang = atan2(dy, dx);

float d = 3 + 10*mag(dx, dy);
float rot = random(-velocidad, velocidad)*tiempo;

float px = map(dx, -1, 1, 0, width);
float py = map(dy, -1, 1, 0, height);

stroke( abs((ang - dang)*190)%200, abs(cos(dang + tiempo))*90);
strokeWeight(d);
line( px - d * cos(rot) + random(-100, 100)*noise(tiempo), py - d * sin(rot) * cos(rot),
px + d * cos(rot)*sin(rot), py + d * cos(rot) + random(-100, 100)*noise(tiempo));

noStroke();
fill(abs((ang - dang)*150)%200, 0, 0, abs(cos(dang + tiempo))*50);
ellipse(px - d*sin(rot)*cos(rot)*random(-10, 10)*noise(tiempo),
py +d*sin(rot)*sin(rot)*random(-10, 10)*noise(tiempo), 6, 6);
}

 
26 Julio 2011

//código Processing

int values[];
int niveles = 15;
float noiseZoom = 0.001;

float noiseValue = 0.03;

void setup() {
size(600, 600);
smooth();
values = new int[width * height];
noiseDetail(6, 0.55);
background(0);
}

void draw() {
fill(0, 5);
rect(0, 0, width, height);

for (int y =0; y < height; y++) {
for (int x =0; x < width; x++) {
int index = y * width + x;
values[index] = (int) (niveles * noise(x * noiseZoom, y * noiseZoom, noiseValue));
}
}
loadPixels();
for (int y = 1; y < height - 1; y++) {
for (int x = 1; x < width - 1; x++) {
int index = y * width + x;
int centro = values[index];
if(centro != values[index - 1] || centro != values[index + 1]){
float dst = mag(x ,y )%100;
println(dst);
pixels[index] = color(200, dst);
}
}
}
updatePixels();

noiseValue+=0.02;
}

void keyPressed(){
save("imagen1.jpg");
}

 
25 Julio 2011

//código Processing

void draw() {
for (int i =1; i < numParticulas -1; i++) {
Particulas tmp = par[i];
if (tmp.newParticula() ) {
tmp.newVals();
}
float opac = mag(tmp.posx, tmp.posy)%100;
println(opac);
fill(i%100 + 10, opac);
ellipse(tmp.posx, tmp.posy, 30, 30);

fill(i%120 + 10, opac);
ellipse(tmp.posx, tmp.posy, 20, 20);

fill(i%200 + 50, opac);
ellipse(tmp.posx, tmp.posy, 10, 10);

fill(i%150 + 100, opac);
ellipse(tmp.posx, tmp.posy, 4, 4);
tmp.update();
}
}

void newVals() {
vida = random(50);
longitud = (int)random(40, 70);
raz = random(0.006, 0.01);
}

void update() {
noiseValX += 0.02;
noiseValY += 0.04;
tiempo += 0.01;

vida++;

posx = noise(noiseValX, noiseValY)*longitud+ cos(tiempo)*sin(tiempo)*(longitud +5) + random(-400, 320);
posy = noise(noiseValX, noiseValY)*longitud+ sin(tiempo)*sin(tiempo)*(longitud+5) + random(-400, 320);
}

boolean newParticula() {
if (vida >= vidaMax) {
return true;
}
return false;
}

Descargar código

hackpact25

24 Julio 2011

//código Processing

int numPoints = 50;
PVector[] points;

float noiseValX = 0.04;
float noiseValY = 0.05;

float theta =0.03;

void setup() {
size(600, 600);
smooth();
background(0);
noStroke();
points = new PVector[numPoints];
for (int i =0; i < numPoints; i++)
points[i] = f(0, 0);
}

void draw() {
fill(0, 1);
rect(0, 0, width, height);
pushMatrix();
translate(width/2, height/2);
rotate(frameCount*0.05);
scale(1.9);
beginShape();
for (int i =1; i < numPoints -2; i++) {
float px = noise(noiseValX)*100 -200;
float py = noise(noiseValY)*100 -200;
points[i+1].x = px;
points[i+1].y = px;
points[i+2].x = points[i+1].x;
points[i+2].y = points[i+1].y;
float opac = mag(points[i+2].x, points[i+2].y)%10+ 5;
println(opac);
stroke(125, 0, 0, opac);
vertex(points[i].x, points[i].y );
vertex( cos(theta)*200 + random(-5, 5), cos(theta)*sin(theta)*100 + random(-5, 5));
vertex(points[i+2].x, points[i+2].y);
vertex( tan(theta)*200 + random(-2, 2), sin(theta)*sin(theta)*100 + random(-2, 2) );
vertex(points[i+1].x, points[i+ 1].y);
vertex( tan(theta)*200 + random(-2, 2), cos(theta)*sin(theta)*100 + random(-2, 2) );
}
endShape();

theta+=0.1;
noiseValX +=0.03;
noiseValX +=0.02;
popMatrix();
}

PVector f(float posx, float posy) {
float randX = random(TWO_PI);
float randY = random(TWO_PI);
posx = numPoints/randY + 0.0001 - numPoints;
posy = numPoints/randX + 0.0001 - numPoints;
return new PVector(posx, posy);
}
int i=1;
void keyPressed(){
save("imagen"+i+".jpg");

}

 
23 Julio 2011

//código Processing

import processing.opengl.*;

float noiseValX = 0.01;
float noiseValY = 0.04;

void setup() {
size(600, 600, OPENGL);
background(0);
frameRate(20);
}

void draw() {
fill(0, 5);
rect(0, 0, width, height);
translate(width/2 -200, height/2 -200);
for (int i =0; i < 100; i++) {
color innerCol = color(220, 230);
color outerCol = color(0, 20);
translate(5, 10);
drawDisc( noise(noiseValX)*random(-width/2, width/2), noise(noiseValY)*random(-height/2, height/2),
50 + noise(noiseValX)*25, + 50 + noise(noiseValX)*25, innerCol, outerCol);
}
update();
}

void update() {
noiseValX +=0.02;
noiseValY +=0.03;
}

void drawDisc(float x, float y, float radiusX, float radiusY, int innerCol, int outerCol) {
noStroke();
beginShape(TRIANGLE_STRIP);
for (float theta=0; theta<TWO_PI; theta+=TWO_PI/36) {
fill(innerCol);
vertex(x, y);
fill(outerCol);
vertex(x+radiusX*cos(theta), y+radiusY*sin(theta));
}
endShape();
}
void keyPressed(){
save("imagen1.jpg");
}

 
22 Julio 2011

//código Processing

float theta;
float rotTheta = 0.05;

void setup() {
size(600, 600);
smooth();
background(0);
}

void draw() {
fill(0, 3);
rect(0, 0, width, height);
float a = cos(rotTheta)*90 -90;
theta = radians(a);
translate(width/2, height);
strokeWeight( abs(a/80) + 1);
line(0,0,0,-260);
branch(320);
rotTheta+= 0.07;
}

void branch(float h) {
h *= 0.66;
if (h > 2) {
pushMatrix();
rotate(theta);
stroke(0, h*2, h*4);
line(0, 0, 0, -h);
translate(0, -h);
branch(h);
popMatrix();
pushMatrix();
rotate(-theta);
stroke(h*15, h*3);
line(0, 0, 0, -h);
translate(0, -h);
branch(h);
popMatrix();
}
}

void keyPressed(){
save("imagen2.jpg");
}

 
21 Julio 2011

//código Processing

HackPack #21 eahhhh!!
class Spiral {
  int n = 3000; //numero de espirales
 
  Particulas particulas[];
 
  Spiral() {
    particulas = new Particulas[n];
    for (int i =0; i < n; i++) {
      particulas[i] = new Particulas();
    }

    for (int i = 0; i < n; i++)
      particulas[i].newPos(i);
  }

  void draw() {
    for (int i=0; i < n ; i++) {
      Particulas tmpPar =  particulas[i];
      Particulas p = tmpPar.tipoCurva(tmpPar.posx, tmpPar.posy, 1 );
      float opac = mag(p.posx, p.posy) % 50;
      float hue =  atan2(p.posy, p.posx); 
      stroke(0, i%50, hue*60 + frameCount%60, opac);
      beginShape();
      vertex(tmpPar.posx, tmpPar.posy);
      vertex( tmpPar.posx*sin(tmpPar.tiempo*5), tmpPar.posy*cos(tmpPar.tiempo*5) );
      endShape();
      tmpPar.update(i);
    }
  }
}

  void newPos(int index) {
    float randVal = random(longitud);
    float ang = random(TWO_PI);
    setPos( random(-width/2  +50, width/2- 50) + randVal* cos(ang*index), random(-height/2 + 50, height/2- 50) + randVal *sin(ang*index) );
  }

  Particulas tipoCurva(float posx, float posy, int type) {
    return new Particulas( noise(tiempo)*width, noise(tiempo)*height);
  }

descargar código

hackpact21

20 Julio 2011

//código Processing

//para dibujar

void draw() {
for (int i=0; i < 3000 ; i++) {
Particulas tmpPar = particulas[i];
Particulas p = tmpPar.tipoCurva(tmpPar.posx, tmpPar.posy, 1 );
float opac = mag(p.posy, p.posy) * 2.5 * tmpPar.longitud;
float hue = atan2(p.posy, p.posx)*50;
stroke(0, 0, hue, opac);
beginShape();
vertex(tmpPar.posx, tmpPar.posy);
float px = tmpPar.posx;
float py = tmpPar.posy;
px += tmpPar.acc*p.posx;
py += tmpPar.acc*p.posy;
tmpPar.posx =px;
tmpPar.posy =py;
vertex( tmpPar.posx, tmpPar.posy);
endShape();
tmpPar.update(i);
}
}
// Funciones nuevas Particulas

void newPos(int index) {
float randVal = random(longitud);
float ang = random(TWO_PI);
setPos( random(-width/2 +50, width/2- 50) + randVal* tan(ang), random(-height/2 + 50, height/2- 50) + randVal *sin(ang) );
vida = 0;
}

Particulas tipoCurva(float posx, float posy, int type) {
if (type == 1)
return new Particulas( noise(tiempo, posx*0.03, posy*0.04) - 0.4, noise(tiempo + 1, posx*0.03, posy*0.04)- 0.4);
return new Particulas( noise(tiempo , posx*sin(PI*tiempo)*0.05, posy*cos(PI*tiempo)*0.04) - .5, noise(tiempo +1, posx*sin(TWO_PI*tiempo)*0.05, posy*0.04)- 0.3);
}

Descargar código

hackpact20

19 Julio 2011

//código OpenFrameworks

#include "testApp.h"

static int width;
static int height;

float noiseVal;
float noiseValX;
float noiseValY;
float changeX;
float changeY;
float posX;
float posY;
float theta;

//--------------------------------------------------------------
void testApp::setup(){
ofSetBackgroundAuto(false);
ofSetFrameRate(20);
ofEnableAlphaBlending();
ofSetVerticalSync(true);
ofEnableSmoothing();
//rotateView = true;
width = ofGetWidth();
height = ofGetHeight();

noiseVal = 0.02;
noiseValX = 0.01;
noiseValY = 0.03;

changeX = 0;
changeY = 0;
}
//--------------------------------------------------------------
void testApp::update(){
width = ofGetWidth();
height = ofGetHeight();

noiseVal += 0.005;
noiseValX += 0.008;
noiseValY += 0.007;
theta +=0.002;

changeX = ofNoise(noiseVal, noiseValX);
changeY = ofNoise(noiseVal, noiseValY);
posX = changeX*cos(theta)*sin(theta);
posY = changeY*sin(theta)*sin(theta);
}
//--------------------------------------------------------------
void testApp::draw(){
ofSetColor(0, 0, 0, 4);
ofRect(0, 0, width, height);
ofPushMatrix();
ofTranslate(width/2, height/2);

ofSetLineWidth(3.0);
for(int i =1; i < 60; i++){
ofSetColor( ofGetFrameNum()%50 + 120 + i, 40);
ofLine( posX + cos(theta*i*5)*i*5, i*5*sin(theta*i*5) +posY, i*10*cos(theta*i*3) + posX, posY + i*10*sin(theta*i*3));
}

ofBeginShape();
ofSetColor(0, 0, 90 + ofRandom(20), 30);
for(int i = 0; i < 60; i++){
ofVertex( posX + cos(theta*i*5)*i*5, i*5*sin(theta*i*5) +posY);
ofVertex( i*10*cos(theta*i*3) + posX, posY + i*10*sin(theta*i*3));
}
ofEndShape();

ofSetColor(0, 0, 20 + ofRandom(20), 20);
for(int i = 0; i < 90; i++){
ofVertex( posX + cos(theta*i*7)*i*7, i*7*sin(theta*i*7) +posY);
ofVertex( i*2*cos(theta*i*2) + posX, posY + i*2*sin(theta*i*2));
}
ofEndShape();

ofPopMatrix();
}

 
18 Julio 2011

//código OpenFrameworks

#include "testApp.h"

static int width;
static int height;

float noiseVal;
float noiseValX;
float noiseValY;

float changeX;
float changeY;
float changeZ;

float posX;
float posY;
float radio;

float theta1;
float theta2;

int numVec = 100;
ofVec3f vectores[100];

//--------------------------------------------------------------
void testApp::setup(){
ofSetBackgroundAuto(false);
ofSetFrameRate(60);
ofEnableAlphaBlending();
ofSetVerticalSync(true);
ofEnableSmoothing();
width = ofGetWidth();
height = ofGetHeight();
noiseVal = 0.02;
noiseValX = 0.01;
noiseValY = 0.03;
changeX = 0;
changeY = 0;
radio = 480;
}

//--------------------------------------------------------------
void testApp::update(){
width = ofGetWidth();
height = ofGetHeight();
theta1 +=0.07;
theta2 += 0.003;
for(int i =0; i <numVec; i++){
changeX = ofNoise(noiseValX)*radio;
changeY = ofNoise(noiseValY)*radio;
changeZ = ofNoise(noiseVal)*radio ;
vectores[i].x = changeX*sin(theta2)*cos(theta1);
vectores[i].y = changeY*sin(theta1)*sin(theta2) ;
vectores[i].z = changeZ*cos(theta1);
noiseVal += 0.03;
noiseValX +=0.02;
noiseValY += 0.04;
}
}

//--------------------------------------------------------------
void testApp::draw(){
ofSetColor(0, 0, 0, 1);
ofRect(0, 0, width, height);
ofPushMatrix();
ofTranslate(width/2, height/2, 0 );
for(int i =0; i < numVec; i++){
ofVec3f to = vectores[i];
for(int j = 0; j <numVec; j++){
ofVec3f from = vectores[j];
if(from.z >= to.z){
ofSetColor( 0 , j + 50, 0, 10);
}
else
ofSetColor(j +i, 10);

ofLine(to.x, to.y, to.z, from.x, from.y, from.z);
}
}
ofPopMatrix();
}

 
17 Julio 2011

//código OpenFrameworks

#include "testApp.h"

static int width;
static int height;

float noiseVal;
float noiseValX;
float noiseValY;

float changeX;
float changeY;

float posX;
float posY

float theta1;
float theta2;

//--------------------------------------------------------------
void testApp::setup(){
ofSetBackgroundAuto(false);
ofSetFrameRate(60);
ofEnableAlphaBlending();
ofSetVerticalSync(true);
ofEnableSmoothing();
//rotateView = true;
width = ofGetWidth();
height = ofGetHeight();

noiseVal = 0.02;
noiseValX = 0.01;
noiseValY = 0.03;

changeX = 0;
changeY = 0;
}

//--------------------------------------------------------------
void testApp::update(){
width = ofGetWidth();
height = ofGetHeight();

noiseVal += 0.03;
noiseValX +=0.02;
noiseValY += 0.04;
theta1 +=0.07;
theta2 += 0.003;
changeX = ofNoise(noiseVal, noiseValX)*5;
changeY = ofNoise(noiseVal, noiseValY)*5;

posX = changeX*ofRandom(-2, 2)*sin(theta1)*sin(theta1);
posY = changeY*sin(theta1)*cos(theta1);
}

//--------------------------------------------------------------
void testApp::draw(){
ofSetColor(255, 255, 255, 2);
ofRect(0, 0, width, height);
ofPushMatrix();
ofTranslate(width/2, height/2, -400 );
for(int i =1; i < 50; i++){
float nv = ofNoise(noiseVal)*160;
ofPushMatrix();
ofSetColor( i + 10 + ofGetFrameNum()%70, 6);
ofBeginShape();
ofCurveVertex(posX + nv, posY + nv);
ofCurveVertex(posX + i*10*tan(theta2), posY + i*10*sin(theta2)*cos(theta1));
ofCurveVertex(posX + i*10*sin(theta1), posY + i*10*sin(theta1)*sin(theta2));
ofCurveVertex(posX + i*10*sin(theta1), posY + i*10*cos(theta1)*tan(theta2));
ofCurveVertex(posX + i*10*tan(theta2), posY + i*10*sin(theta1)*cos(theta2));
ofCurveVertex(posX + nv, posY + nv );
ofEndShape();
ofPopMatrix();
}
for(int i =0; i < 50; i++){
float nv = ofNoise(noiseVal)*230*ofRandom(-1,1);
ofPushMatrix();
ofSetColor(0 , ofGetFrameNum()%50, (i)%50 + 20, 6);
ofBeginShape();
ofCurveVertex(posX + nv, posY + nv);
ofCurveVertex(posX + i*5*tan(theta2), posY + i*5*sin(theta1)*cos(theta1));
ofCurveVertex(posX + i*5*cos(theta1), posY + i*cos(theta1)*sin(theta2) );
ofCurveVertex(posX + i*cos(theta2), posY + i*5*sin(theta1)*tan(theta2));
ofCurveVertex(posX + i*5*tan(theta2), posY + i*sin(theta1)*sin(theta1));
ofCurveVertex(posX + nv, posY + nv );
ofEndShape();
ofPopMatrix();
}
for(int i =0; i < 150; i++){
float nv = ofNoise(noiseVal)*230;
ofPushMatrix();
ofSetColor( i + 10 + ofGetFrameNum()%20, 40, (i)%70 + 10, 6);
ofBeginShape();
ofCurveVertex(posX + nv, posY + nv);
ofCurveVertex(posX + i*tan(theta2), posY + i*sin(theta1)*cos(theta1));
ofCurveVertex(posX + i*cos(theta1), posY + i*cos(theta1));
ofCurveVertex(posX + i*cos(theta1), posY + i*sin(theta1)*tan(theta2));
ofCurveVertex(posX + i*tan(theta2), posY + i*sin(theta1)*cos(theta1));
ofCurveVertex(posX + nv, posY + nv );
ofEndShape();
ofPopMatrix();
}
ofPopMatrix();
}

 
16 Julio 2011

//código OpenFrameworks

#include "testApp.h"

static int width;
static int height;

float noiseVal;
float noiseValX;
float noiseValY;

float changeX;
float changeY;

float posX;
float posY;

//--------------------------------------------------------------
void testApp::setup(){
ofSetBackgroundAuto(false);
ofSetFrameRate(60);
ofEnableAlphaBlending();
ofSetVerticalSync(true);
ofEnableSmoothing();
//rotateView = true;
width = ofGetWidth();
height = ofGetHeight();

noiseVal = 0.02;
noiseValX = 0.01;
noiseValY = 0.03;

changeX = 0;
changeY = 0;
}
//--------------------------------------------------------------
void testApp::update(){
width = ofGetWidth();
height = ofGetHeight();

noiseVal += 0.03;
noiseValX +=0.02;
noiseValY += 0.04;
theta +=0.07;

changeX = ofNoise(noiseVal, noiseValX)*10;
changeY = ofNoise(noiseVal, noiseValY)*10;

posX = changeX*ofRandom(-1, 1)*sin(theta)*sin(theta);
posY = changeY*sin(theta);
}

//--------------------------------------------------------------
void testApp::draw(){
ofSetColor(255, 255, 255, 10);
ofRect(0, 0, width, height);
ofPushMatrix();
ofTranslate(width/2, height/2, -400 );

for(int i =0; i < 50; i++){
ofPushMatrix();
ofSetColor( (i +50)%10 + 10, 50, (i)%70 + 10, 70);
ofBeginShape();
ofVertex(posX + 67.5*i*cos(theta), posY + 67.5*sin(theta)*cos(theta));
ofVertex(posX + 52.5*i*cos(theta) + 10, posY + 52.5*sin(theta)*cos(theta));
ofVertex(posX + 40.5*i*cos(theta) + 10, posY + 46.5*sin(theta)*tan(theta));
ofVertex(posX + 30.5*i*cos(theta) + 10, posY + 37.5*sin(theta)*tan(theta));
ofEndShape();
ofPopMatrix();
}

for(int i =0; i < 50; i++){
ofPushMatrix();
ofSetColor( 0, i/2 + 50, ofGetFrameNum()%100 + 50, 50);
ofBeginShape();
ofVertex(posX + 67.5*i*cos(-theta), posY + 67.5*sin(-theta)*cos(theta));
ofVertex(posX + 52.5*i*cos(-theta) + 10, posY + 52.5*sin(-theta)*cos(theta));
ofVertex(posX + 40.5*i*cos(-theta) + 10, posY + 46.5*sin(-theta)*tan(theta));
ofVertex(posX + 30.5*i*cos(-theta) + 10, posY + 37.5*sin(-theta)*tan(theta));
ofEndShape();
ofPopMatrix();
}
ofPopMatrix():
}

 
15 Julio 2011

//código OpenFrameworks

#include "testApp.h"
static int width;
static int height;
float theta1;
float theta2;
float changeX;
float changeY;

//--------------------------------------------------------------
void testApp::setup(){
ofSetBackgroundAuto(false);
ofSetFrameRate(60);
ofEnableAlphaBlending();
ofSetVerticalSync(true);
ofEnableSmoothing();
//rotateView = true;
width = ofGetWidth();
height = ofGetHeight();

}

//--------------------------------------------------------------
void testApp::update() {
width = ofGetWidth();
height = ofGetHeight();

theta1 +=0.001;
theta2 += 0.008;
changeX = cos(theta1)*sin(theta2);
changeY = sin(theta1)*sin(theta2);
}

//--------------------------------------------------------------
void testApp::draw() {
ofSetColor(0, 0, 0, 15);
ofRect(0, 0, width, height);
ofPushMatrix();
ofTranslate(width/2, height/2, 120);
ofBeginShape();
for(int i =0; i < 50; i++){
ofSetColor(245, 245, 245, 50);
ofVertex(200*cos(i) + ofRandom(-35, 35), sin(i)*200 + ofRandom(-35, 35));
ofVertex(180*cos(i) + ofRandom(-25, 25), sin(i)*180 + ofRandom(-25, 25));
}
ofEndShape();
ofBeginShape();
for(int i =0; i < 50; i++){
ofSetColor(245, 245, 245, 30);
ofVertex(160*cos(i) + ofRandom(-25, 25), sin(i)*160 + ofRandom(-25, 25));
ofVertex(120*cos(i) + ofRandom(-5, 5), sin(i)*120 + ofRandom(-5, 5));
}
ofEndShape();
ofBeginShape();
for(int i =0; i < 50; i++){
ofSetColor(205, 205, 205, 10);
ofVertex(105*cos(i) + ofRandom(-19, 19), sin(i)*105 + ofRandom(-19, 19));
}
ofEndShape();
ofBeginShape();
for(int i =0; i < 90; i++){
ofSetColor(205, 205, 205, 5);
ofVertex(50*cos(i) + ofRandom(-19, 19), sin(i)*50 + ofRandom(-19, 19));
ofVertex(40*cos(i) + ofRandom(-19, 19), sin(i)*40 + ofRandom(-19, 19));
ofVertex(30*cos(i) + ofRandom(-19, 19), tan(i)*30 + ofRandom(-19, 19));
ofVertex(20*tan(i) + ofRandom(-19, 19), sin(i)*20 + ofRandom(-19, 19));
}
ofEndShape();
ofPopMatrix();

}

 
14 Julio 2011

//código OpenFrameworks

#include "testApp.h"
#include "MSAPhysics2D.h"
using namespace MSA;
static int width;
static int height;
float theta1;
float theta2;

MSA::Physics::World2D physics;
MSA::Physics::Particle2D center;

float changeX;
float changeY;

//--------------------------------------------------------------
void testApp::setup(){
ofSetBackgroundAuto(false);
ofSetFrameRate(60);
ofEnableAlphaBlending();
ofSetVerticalSync(true);
ofEnableSmoothing();
//rotateView = true;
width = ofGetWidth();
height = ofGetHeight();

//Physics
physics.setWorldSize( MSA::Vec2f(-width/2, -height/2 ), MSA::Vec2f(width/2, height/2) );
physics.setGravity(MSA::Vec2f(0,1));
physics.setDrag(0.97f);

int i =0;
while(i < 120){
Physics::Particle2D *sp = physics.makeParticle(Vec2f( ofRandom(-width/2, width/2), ofRandom(-height/2, height/2)), 0.9, 0.9 );
physics.makeAttraction(&center, sp, ofRandom(1.5, 2.5));
i++;
}
changeX =0;
changeY =0;
}

//--------------------------------------------------------------
void testApp::update() {
width = ofGetWidth();
height = ofGetHeight();
physics.update();

theta1 +=0.001;
theta2 += 0.008;
changeX = cos(theta1)*sin(theta2);
changeY = sin(theta1)*sin(theta2);
}

//--------------------------------------------------------------
void testApp::draw() {
ofSetColor(0, 0, 0, 7);
ofRect(0, 0, width, height);
ofPushMatrix();
ofTranslate(width/2, height/2);
ofBeginShape();
ofRotate(cos(theta1*4)*360);
for(int i =0; i < physics.numberOfParticles(); i++){
ofPushMatrix();
Physics::Particle2D *sp = physics.getParticle(i);
sp->moveBy(Vec2f(changeX, changeY -3));
ofSetColor(220, 220, 220, 50);
ofEllipse(sp->getPosition().x, sp->getPosition().y, 18, 18 );
ofSetColor(0 , 40, (i/2)%50 + ofGetFrameNum()%50 + 130, 60);
ofVertex(sp->getPosition().x, sp->getPosition().y);
ofVertex(sp->getPosition().x+ ofRandom(-2, 2), sp->getPosition().y + ofRandom(-5, 5));
ofPopMatrix();
}
ofEndShape();
ofPopMatrix();
}

 
13 Julio 2011

// código OpenFrameworks

#include "testApp.h"
static int width;
static int height;

float theta;

//--------------------------------------------------------------
void testApp::setup(){
ofSetBackgroundAuto(false);
ofSetFrameRate(60);
ofEnableAlphaBlending();
ofSetVerticalSync(true);
ofEnableSmoothing();
//rotateView = true;
width = ofGetWidth();
height = ofGetHeight();
}

//--------------------------------------------------------------
void testApp::update() {
width = ofGetWidth();
height = ofGetHeight();
theta +=0.05;
}

//--------------------------------------------------------------
void testApp::draw() {
ofSetColor(0, 0, 0, 3);
ofRect(0, 0, width, height);
ofPushMatrix();
ofTranslate(width/2, height/2,0);
ofSetColor(0, 255,0);
ofRotate(cos(theta)*5);
for(int i =0; i < 50; i++){
ofPushMatrix();
ofBeginShape();
ofSetColor( i%50 + ofGetFrameNum()%100 + ofRandom(0,20), 0, 0, 100);
ofTranslate( cos(theta)/i, ofRandom(-50,50), 0);
ofVertex(i*cos(theta)*5 - 100, i*5 +sin(theta)*5 - 100+ ofRandom(0,10));
ofVertex(i*sin(theta/2)*8 - 100, i*5 +tan(theta)*15 - 100 + ofRandom(0,10));
ofVertex(i*tan(theta)*9 - 100 + ofRandom(5,10), i*5 +cos(theta/2)*25 - 100);
ofVertex(i*tan(theta)*12 - 100 + ofRandom(0,15), i*5 +tan(theta)*30 - 100);
ofEndShape();
ofPopMatrix();
}

ofPopMatrix();

}
void testApp::keyPressed (int key){
switch(key) {
case 'a':
ofSaveFrame();
break;
}
}

 
12 Julio 2011

//código OpenFrameworks

#include "MSAPhysics2D.h"
#include "testApp.h"
using namespace MSA;
static int width;
static int height;

MSA::Physics::World2D physics;
MSA::Physics::Particle2D center;
float theta;
//--------------------------------------------------------------
void testApp::setup(){
ofSetBackgroundAuto(false);
ofSetFrameRate(60);
ofEnableAlphaBlending();
ofSetVerticalSync(true);
ofEnableSmoothing();
//rotateView = true;
width = ofGetWidth();
height = ofGetHeight();

//Physics
physics.setWorldSize( MSA::Vec2f(-width/2, -height/2 ), MSA::Vec2f(width/2, height/2) );
physics.setGravity(MSA::Vec2f(0,1));
physics.setDrag(0.97f);

physics.addParticle(&center);
center.makeFixed();
center.setMass(8);
center.moveTo(Vec2f(0, 0));
center.setRadius(15);

int i =0;
while(i < 300){
Physics::Particle2D *sp = physics.makeParticle(Vec2f( ofRandom(-width/2, width/2), ofRandom(-height/2, height/2)), 1.0, 1.0 );
physics.makeAttraction(&center, sp, ofRandom(1.5, 2.0));
i++;
}
}

//--------------------------------------------------------------
void testApp::update() {
width = ofGetWidth();
height = ofGetHeight();
physics.update();
theta +=0.01;
}
//--------------------------------------------------------------
void testApp::draw() {
ofSetColor(0, 0, 0, 4);
ofRect(0, 0, width, height);
ofPushMatrix();
ofTranslate(width/2, height/2);
for(int i =1; i < physics.numberOfParticles(); i++){
Physics::Particle2D *sp = physics.getParticle(i);
//sp->setMass(cos(theta)*5);
sp->setVelocity(Vec2f(cos(theta + ofRandom(0, 0.5))*ofRandom(-1, 5), cos(theta)*sin(theta/2 + ofRandom(0, 1))*ofRandom(-2.5, 6.5) ));
for(int g =0; g < 10; g++){
ofSetColor(200 + g*3, (i + 10)%20 + 200 + g*3, ofGetFrameNum()%20 + 200 + g*3, 50+ g*3 + ofGetFrameNum()%20 + (i + 20)%30);
ofEllipse(sp->getPosition().x, sp->getPosition().y, 22 - g*2.2, 22 - g*2.2);
}
}
ofPopMatrix();
}

 
11 Julio 2011

//código OpenFrameworks

Ahi les va el primer hackpack de openframeworks esta en la version 0.062 win
usa la liberia de MSAPysics

fisica del programa y las particulas

void testApp::setup(){
ofSetBackgroundAuto(false);
ofSetFrameRate(60);
// ofEnableAlphaBlending();
ofSetVerticalSync(true);
ofEnableSmoothing();

width = ofGetWidth();
height = ofGetHeight();
//Physics
physics.setWorldSize( MSA::Vec2f(-width/2, -height/2 ), MSA::Vec2f(width/2, height/2) );
physics.setGravity(MSA::Vec2f(0,1));
physics.setDrag(0.97f);
MSA::Vec2f startP(width/2, 00);
MSA::Vec2f endP(-width/2, 0);
//Particles
MSA::Physics::Particle2D *sp = physics.makeParticle(startP, 1.0, 1.0 );
sp->makeFixed();
for(int i = 1; i < numP -1; i++){
MSA::Vec2f pos( ofLerp(startP.x, endP.x, i/(float(numP - 1))), ofLerp(startP.y, endP.y, i/(float(numP - 1))));
MSA::Physics::Particle2D *p = physics.makeParticle(pos, 1.0, 1.0 );
p->makeFree();
}
MSA::Physics::Particle2D *ep = physics.makeParticle(endP, 1.0, 1.0 );
ep->makeFixed();
float d = ofDist(startP.x, startP.y, endP.x, endP.y)/float((numP - 1)) ;
for(int i = 0 ; i < numP -1; i++){
MSA::Physics::Particle2D *a = physics.getParticle(i);
MSA::Physics::Particle2D *b = physics.getParticle(i + 1);
physics.makeSpring(a, b, 1.8, d);
}
cout<<"error"<<endl;
}

void testApp::update() {
width = ofGetWidth();
height = ofGetHeight();
physics.update();
t += step;
for(int i = 0; i < numP; i++){
MSA::Physics::Particle2D *a = physics.getParticle(i);
if(i == 0 || i == numP- 1){
continue;
}
MSA::Vec2f nPos(MSA::Vec2f( 1.0, amp*sin(i*(freq)*sin(theta) + t)) );
a->moveBy( nPos );
}
theta+=0.02;
}
void testApp::draw() {
ofSetColor(0, 0, 0, 7);
ofRect(0, 0, width, height);
ofPushMatrix();
ofTranslate(width/2, height/2);
for(int i = 0; i < physics.numberOfSprings(); i++){
MSA::Physics::Spring2D *spring = (MSA::Physics::Spring2D *) physics.getSpring(i);
spring->setRestLength(springLen);
spring->setStrength(strg);
MSA::Physics::Particle2D *a = spring->getOneEnd();
MSA::Physics::Particle2D *b = spring->getTheOtherEnd();
ofSetColor(120 + (i/3)%50, 0, ofGetFrameNum()%90 + i/3 );
ofSetLineWidth(4.5);
ofLine(a->getPosition().x, a->getPosition().y, b->getPosition().x, b->getPosition().y );
}
ofPopMatrix();
}

descargar código

dia11

10 Julio 2011

//el código se compone de 4 archivos, descargar el archivo zip para verlos

Descargar archivos

day10.zip

9 Julio 2011

//código Processing

float thickness= 230.35;
float amp =1.5;
float angle = 0.0;
float posx;
float posy;
float noiseVal = 0.05;

void setup() {
size(600, 600);
smooth();

posx = height/2 -50;
posy = width/2;
noStroke();
}

void draw() {
fill(0, 15);
rect(0, 0, width*2, height*2);
translate(posx, posy);

for (int i =0; i< 100; i++) {
pushMatrix();
float tmpY=0;
translate(i*2*cos(angle), 0);
amp = noise(noiseVal);
fill(20, 50%frameCount + i/2, frameCount%(i +90) , 180);
ellipse(0, 0, thickness*0.75, thickness*sin(angle)*cos(angle));
rotate(cos(angle)*10/i);
rectMode(CENTER);
fill(0, 20%frameCount + i/2, frameCount%(i +100) , 50);
rect(0, 0, thickness*1.5, thickness*1.5);
angle += 0.05;
noiseVal += 0.02;
popMatrix();
}
}

 
8 Julio 2011

//código Processing

int numParticulas =100;
float angle;
float dx;
float dy;
float theta = 0.5;

Particulas particulas[];

void setup(){
size(600, 600);
smooth();

particulas = new Particulas[numParticulas];
for(int i = 0; i < particulas.length; i++){
particulas[i] = new Particulas(0.06*(0.2*(i + 1)));
}
dx = 1.0;
dy = 1.0;
}

void draw(){
fill(0, 10);
rect(0, 0, width, height);
for(int i =0; i < numParticulas; i++){
particulas[i].ddx += particulas[i].damping;

particulas[i].posx += particulas[i].ddx * dy;
particulas[i].posy += particulas[i].ddy * dx;

stroke(0, 60%frameCount + 50, i%200 + 50, 60);
ellipse( particulas[i].posx, particulas[i].posy, i*cos(theta)*2.3, i*cos(theta)*2.33);

particulas[i].damping*=0.99999;

if( i == numParticulas/2){
dy*=-1;
dx*=-1;
}

theta += 0.1;
}
}

class Particulas{
float posx;
float posy;
float ddx;
float ddy;

float damping;

Particulas(float damping){
posx = width/2;
posy = height/2;
this.damping = damping;
}

}

 
7 Julio 2011

//código Processing

int numParticulas = 400;
float noiseVal = 0.01;
float theta = 0.5;

Particulas[] particulasVals;

void setup() {
size(600, 600, P3D);
smooth();

particulasVals = new Particulas[numParticulas];
for (int i = 0; i < numParticulas; i++)
particulasVals[i] = new Particulas();
}

void draw() {
fill(0, 8);
rect(0, 0, width, height);
pushMatrix();
translate(width/2, height/2, 0);
scale(0.65);
beginShape();
for (int i = 0; i < numParticulas; i++) {
Particulas from = particulasVals[i];
stroke(i%(200 + 100), 30);
if ( 140*abs(cos(theta)) + 100 < dist(from.posx, from.posy, from.posy, from.posz)) {
stroke(0, 30, i%100, 30);
}
vertex(from.posx, from.posy);
vertex(from.posy, from.posz);
}
endShape();
popMatrix();

for (int i =0; i < numParticulas; i++) {
Particulas tmpPar = particulasVals[i];
tmpPar.restart(theta);
}

theta+=0.1;
}

class Particulas{
float t1;
float t2;
float posx;
float posy;
float posz;
float ruidVal;
float radio;

Particulas(){
this.t1 = random(360);
this.t2 = random(360);
ruidVal = random(0.01, 0.1);
radio = random( 200);
}

void restart(float rad){
posx = radio * cos(t1) * (sin(t2) + noise(rad));
posx = radio * sin(t1) * (sin(t2) + noise(rad));
posz = radio * cos(t2 + noise(rad));

ruidVal += 0.03;
radio = noise(ruidVal)*radio + 150;
}
}

 

 

6 Julio 2011

//código Processing

int numParticulas = 400;
int numRuido = 20;
int distZ = 50;
float radio = 20;
float noiseVal = 0.1;
float theta = 0.1;

Particulas[] particulasVals;

void setup() {
size(1024, 864, P3D);
smooth();
particulasVals = new Particulas[numParticulas];
for (int i = 0; i < numParticulas; i++)
particulasVals[i] = new Particulas();
}

void draw() {
fill(0, 10);
rect(0, 0, width, height);
translate(width/2, height/2, 0);
rotateX( PI/2);
for (int i = 0; i < numParticulas; i++) {
Particulas from = particulasVals[i];
for (int j = 0; j < numParticulas; j++) {
Particulas to = particulasVals[j];
float distancia = dist(from.posx, from.posy, from.posz, to.posx, to.posy, to.posz);
if (distancia < distZ) {
stroke((distZ + j)%255, 0, 0, 40);
line(from.posx, from.posy, from.posz + random(-10,10), to.posx, to.posy, to.posz + random(-10, 10));
}
}
}

for (int i =0; i < numParticulas; i++) {
Particulas tmpPar = particulasVals[i];
tmpPar.restart(theta);
}

noiseVal += 0.01;
radio = noise(noiseVal) * 200;
distZ = int(radio/1.3);
theta+=0.1;
}

class Particulas{
float t1;
float t2;
float posx;
float posy;
float posz;
float ruidVal;
float radio;

Particulas(){
this.t1 = random(360);
this.t2 = random(360);
ruidVal = random(0.01, 0.1);
radio = random(100, 200);
}

void restart(float rad){
posx = radio * cos(t1) * (sin(t2) + noise(rad));
posx = radio * sin(t1) * (sin(t2) + noise(rad));
posz = radio * cos(t2 + noise(rad));

ruidVal += 0.03;
radio = noise(ruidVal)*radio + 150;
}
}

 
5 Julio 2011

//codigo. Processing

float theta = 0.02;
float noiseVal = 0.1;
int rad = 10;

void setup() {
size(740, 660);
smooth();
}

void draw() {
fill(255, 6);
rect(0, 0, width*2, height*2);
scale(0.2);
scale(abs(noise(theta))*10);
for (int i =0; i < 30; i++) {
pushMatrix();
rectMode(CENTER);
translate(width/2, height/2);
scale( (noise(theta) *190)/i, (noise(theta)*190 )/i);
rotate( radians(sin(theta)*i*100));
stroke(10, 0 ,frameCount%(i*5 +50), 50);
ellipse(0, 0, 20, 30);
rect(0, 0, 10, 10);
popMatrix();
}
theta+= 0.1;
noiseVal+=0.02;
}

 
4 Julio 2011

//codigo processing

PVector puntos1[];
PVector puntos2[];
float noiseVal1 = 0.02;
float noiseVal2 = 0.01;
float theta = 0.5;

void setup() {
size(800, 600);
smooth();
puntos1 = new PVector[30];
puntos2 = new PVector[30];
for (int i = 0; i < 30; i++) {
puntos1[i] = new PVector(0, 0);
puntos2[i] = new PVector(0, 0);
}
}

void draw() {
fill(0, 5);
rect(0, 0, width, height);
translate(350, 270);
for (int i =0; i < 30; i++) {
pushMatrix();
float n1 = noise(noiseVal1);
float n2 = noise(noiseVal2);
stroke(200, i%(frameCount), 0, 100 + i%frameCount);
puntos1[i].x = n1 *i+ 250*cos(theta);
puntos1[i].y = 200 + cos(theta)*n2*i;
puntos2[i].x = (-1*n2)* 100*sin(theta) + i;
puntos2[i].y = (-1*n1)* 100*cos(theta)*cos(theta) + i;
rotate(10*cos(theta)*sin(theta) );
line(puntos2[i].x, puntos2[i].y + random(40), puntos1[i].x, puntos1[i].y + random(30));
translate(100, 0);
stroke(0, i%(frameCount), 200, 100 + i%frameCount);
line(puntos2[i].x, puntos2[i].y + random(10), puntos1[i].x, puntos1[i].y + random(10));
translate(100, 0);
rotate(10*cos(-theta)*sin(theta) );
stroke(240, 140, (i)%(frameCount));
line(puntos2[i].x, puntos2[i].y + random(30), puntos1[i].x, puntos1[i].y + random(20));
stroke(200, 100);
line(puntos2[i].x, puntos2[i].y + random(10), puntos1[i].x, puntos1[i].y + random(10));

noiseVal1 += 0.02;
noiseVal2 += 0.01;
popMatrix();
}
theta +=0.01;
}

 
3 Julio 2011
 
kpd3

//codigo processing

float noiseVal = 0.2;
float noiseValX = 0.02;
float noiseValY = 0.02;

PVector puntos[] = new PVector[200];

void setup() {
size(1024, 426);
smooth();
noStroke();
for (int i =0; i < 200; i++)
puntos[i] = new PVector(i, i);
}

void draw() {
fill(0, 10);
rect(0, 0, width, height);
translate(width/2, height/2);

loadPixels();
float randomVal = random(-1, 1);
for (int i =0; i < 100; i++) {
pushMatrix();
rotate(noise(noiseVal)*10);
float noiseX = noise(noiseVal, noiseValX);
float noiseY = noise(noiseVal, noiseValY);

fill( noiseY*20 + 100);
ellipse(puntos[i].x*noiseX*8 + 50, puntos[i].y + height/2, 1, 1);
fill( noiseY*70 + 100%frameCount + 100);
ellipse(puntos[i].x*noiseX*10 + 50, puntos[i].y + height/2, 1, 1 );

fill(noiseY*100 + 150, 50);
ellipse(puntos[i].x*noiseX*4, puntos[i].y, 2, 2);
fill(0, 0, noiseX*100 + 100);
ellipse(puntos[i].x*noiseX*5, puntos[i].y, 2, 2);

noiseVal += 0.006;
noiseValX += 0.005;
noiseValY += 0.003;
popMatrix();
}
}

Ver aplicación

descargar aplicación

2 Julio 2011

//codigo processing

PVector puntos[];
float nVal = 0.2;
float theta = 0.1;

void setup() {
size(1024, 876);
smooth();
puntos = new PVector[100];
for (int i =0; i < 100; i++) {
puntos[i] = new PVector( 0, 0);
}
}

void draw() {
fill(0, 3);
rect(0, 0, width, height);
beginShape();
for (int i =0; i < 100; i++) {
float ang = random(TWO_PI);
float t = 100;
puntos[i].x= noise(nVal)*t + 300;
puntos[i].y= noise(nVal)*t + 300;
stroke((i*2 +50)%frameCount + 50);
fill((i + 80)%frameCount, 0, 0, frameCount%20);
vertex(puntos[i].x *cos(ang + theta) + width/2 + random(-15, 15), puntos[i].y* sin(ang)*cos(theta) + height/2 + random(-15, 15) );
}
endShape();
nVal += 0.03;
theta +=0.006;
}

void keyPressed(){
save("imagen2.jpg");

}

 
1 Julio 2011

thomas_day1

//codigo processing

float theta = 0;
int count;
void setup() {
size(1024, 768);
smooth();
}

void draw() {
fill(0, 6);
rect(0, 0, width*2, height*2);

translate(width/2, height/2);

for (int i =1; i < 30; i++) {
pushMatrix();
rectMode(CENTER);
scale(sin(theta)*250/i, sin(theta)*250/i);

if (count <= 200) {
translate( cos(theta)*width/(i*300), sin(theta)*height/(i*300));
}
else {
translate( noise(theta)*width/(i*300), noise(theta)*height/(i*300));
rotate(noise(theta)*i*frameCount%400);
}
stroke( (10*i)%frameCount + 50, 100 + frameCount%150);
rect(0, 0, 10, 10);
stroke( (15*i)%frameCount + 50, 140 + frameCount%50);
ellipse(0, 0, 10, 10);
popMatrix();
}
count++;
theta +=0.04;
if ( count >= 400)
count =0;
}