// Alpha Mask // by toxi // Loads a "mask" for an image which specifies its transparency // in different parts of the image. The two images are blended // together using the blend() function. // Created 29 April 2003 MyImage myImg; int winkel = 0; int count = 0; int winkel_speed = 2; int anzahl = 20; float wOffset = 360 / anzahl; int x_amp = 70; int y_amp = 70; int z_amp = 50; float xFreq = 1.2; float yFreq = 0.8; float zFreq = .9; int x_mid; int y_mid; int z_mid = 50; void setup() { size(200,200); framerate(30); myImg = new MyImage("meer.jpg"); x_mid = width/2; y_mid = height/2; } void loop() { myImg.setBack(); smooth(); lights(); count++; if (count>= 720){ //count = 360; } int winkel_x = 360 * mouseX/width; int winkel_y = 360 * mouseY/height; winkel += winkel_speed; float A = radians(count); //println(sin(count*PI/180)); for(int i=0; i360) xA -= 360; if (yA>360) yA -= 360; if (zA>360) zA -= 360; float w_x = radians(xA); float w_y = radians(yA); float w_z = radians(zA); translate(sin(w_x)*x_amp + x_mid, sin(w_z)*cos(w_y)*y_amp + y_mid, cos(w_z)*z_amp - z_mid); rotateX(A); rotateY(A); box(10); pop(); } /* float rad = radians(deg); println(deg + " degrees is " + rad + " radians"); push(); rotateX(winkel* PI / 180); pop(); //- erster würfel fill(0, 100, 200); push(); translate(90, 90, -winkel_x/2 + 30); rotateX(winkel* PI / 180); rotateY(winkel_y * PI / 180); // rotateZ(winkel_y * PI / 90); box(40); pop(); //- zweiter würfel fill(204, 102, 0); translate(110, 110, -30); rotateX(winkel* PI / 180); //rotateY(winkel_y * PI / 180); //rotateZ(winkel_y * PI / 90); box(40); */ } class MyImage { BImage b; //int[] mask; int area; MyImage(String basefile) { //img=loadImage(basefile); //background(img); //area=img.width*img.height; //BImage b; b = loadImage("meer.jpg"); background(b); } void setBack() { background(b); } }