We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
Rolodex effect (Read 868 times)
Rolodex effect
Nov 3rd, 2008, 9:56am
 
Hi guys, I am an novice of processing.
Currently I am doing a rolodex effect for photo display, but the result is still far from what I want.

I have succeeded in applying several photos on a rolodex mechnanism but I dont know how to make each photo stay in their order when rotating. As you can see the code below, when you rotate the mouse middle button, some photos will start to run before others.

All I want is
1.simulating the page flipping in the rolodex to see each photo clearly when I rotate the rolodex slowly
2.simulating the "flipbook effect" of photos on the rolodex when I rotate it fast.

Anyone can help me? Thanks in advance.

-------------------------------------------------------------

PImage[] images4 = new PImage[29];
//mousewheel
import java.awt.event.*;
import processing.opengl.*;
int photonum4 = 29;
int K_prev = 0;
int K = -90;


Photoframe4[]pp = new Photoframe4[photonum4];



void setup(){
 size(600, 300, P3D);
 frameRate(60);
 noStroke();
 for(int i=1; i<29; i++){
   images4[i] = loadImage(i+".JPG");
 }
 
 textureMode(NORMALIZED);
 for(int i = 0; i < photonum4; i++){
   pp[i] = new Photoframe4(100, 100,1);
 }

 //mousewheel
 addMouseWheelListener(new java.awt.event.MouseWheelListener() {
   void mouseWheelMoved(java.awt.event.MouseWheelEvent evt) {
     int notches = evt.getWheelRotation();
     if(notches!=0 & mouseX > 170 & mouseX <430 & mouseY > 60& mouseY <250){
       //println(notches);
      K+=notches*1;
      if ((K >-90)&&(K < 90)){
         if(K > K_prev){
            K+=notches*20;
         } else if(K < K_prev){          
            K+=notches*5;
         }
          K_prev = K;
      }
     
     
      println("K" + " = " +  K );
     }
   }
 }
 );      
}

void draw(){
 background(0);
 duplPframe4();
}
void mouseDragged(){
 println("mouseY" + " = " +  mouseY );
 println("mouseX" + " = " +  mouseX );
}


void duplPframe4(){
 //duplicate photos
 for(int i=0; i<1; i++){
   pushMatrix();
   translate(250, 150, 100);
   //translate(100, 100, -20);
   noStroke();
   pp[i].create();
   popMatrix();      
 }
}


class Photoframe4{
 float w, h, d;
 Photoframe4(float w, float h, float d){    
   this.w = w;
   this.h = h;
   this.d = w;  
 }

 void create(){                    
   for( int i=0; i<28; i++){                                        
   
   beginShape(QUADS);
     texture(images4[i+1]);
     vertex(    0,  -(h/2)*sin(radians((i/(sq(i)))*K)),  (h/2)*cos(radians((i/(sq(i)))*K)), 0, 1);
     vertex(    w,  -(h/2)*sin(radians((i/(sq(i)))*K)),  (h/2)*cos(radians((i/(sq(i)))*K)), 1, 1);
     vertex(    w,                          0,                       0, 1, 0);
     vertex(    0,                          0,                       0, 0, 0);
     endShape();

     beginShape(QUADS);
     texture(images4[i+1]);
     vertex(    0,  -(h/2)*sin(radians((i/(sq(i)))*K)),  (h/2)*cos(radians((i/(sq(i)))*K)), 0, 0);
     vertex(    w,  -(h/2)*sin(radians((i/(sq(i)))*K)),  (h/2)*cos(radians((i/(sq(i)))*K)), 1, 0);
     vertex(    w,                          0,                       0, 1, 1);
     vertex(    0,                          0,                       0, 0, 1);
     endShape();  
   
   
     
   }
 }
}
Re: Rolodex effect
Reply #1 - Jun 30th, 2009, 5:40am
 
Bump!
I was just wondering is there was any news on this, I'm looking for some kind of Pageflip thingy as well...
Kristoffer
Page Index Toggle Pages: 1