I'm really kind of despaired at the moment. Because I just can't get to the results I want to get to.
My plan: Create a photo slide-show with about 20-30 pictures which can be scrolled vertically by the hardware key "LEFT" and "RIGHT". When the left or right "edge" of the photo stripe is reached, the serie just begins again. so that you can scroll virtually endlessly in any direction (left/right). and every 20-20 series of pichtures they are repeated...
the sliding should be performed in a physically correct way (so you can accelerate the photos and the smoothly are getting slower then - until they finally stop. When the stopping point is reached and the screen isn't fully filled with just 1 photo the program should begin to smoothly move the picture-stripe again to "snap" or "align" the stripe so that in the end always exactly one picture is beeing showed.
My work so far:
// CODE START
final int MAX_PICTURES = 5;
float x_pos = 0;
float easing = 0.1;
float speed = 0.0;
float max_speed = 10.0;
float acceleration = 0.4;
int direction = 1;
PImage[] photo=new PImage[MAX_PICTURES];
void setup(){
size(720,480,P3D);
colorMode(HSB,100);
imageMode(CENTER);
noStroke();
frameRate(60);
for(int i=0;i<MAX_PICTURES;i++){
photo[i]=loadImage("0" + i + ".jpg");
}
}
void draw(){
background(0);
if(keyPressed == true){
if (key == CODED) {
if (keyCode == RIGHT) {
move_right();
}
}
if (key == CODED) {
if (keyCode == LEFT) {
move_left();
}
}
}
if(speed>0){
speed -= easing;
}else{
speed = 0;
}
translate(x_pos,0,0);
if(direction == 1){
x_pos += speed;
}else{
x_pos -= speed;
}
for(int i=0;i<MAX_PICTURES;i++){
image(photo[i],360,240,720,480);
translate(-720,0,0);
// if(i>31) i=0;
}
}
void move_right(){
speed+=acceleration;
direction = 1;
if(speed<max_speed){
move_right();
}
}
void move_left(){
speed-=-acceleration;
direction = -1;
if(speed<max_speed){
move_left();
}
}
// CODE END
There has to be a folder named "data" in the same directory of the .pde file in which the .jpg-files are located which are named "00.jpg", "01.jpg", ... I was able to implement the smooth movement...
As you can see, I just can't get to the endless-slide feature. I think it would be enough if there were 3 pictures displayed at one time in in the center of the screen, and one left and one right of the screen. as the stripe is beeing scrolled the program has to replace the pictures to generate the illusion that you can scroll endlessly...
I also don't know how to implement the align method (which automatically moves the stripe further when the picture is not completely shown in the viewport when the movement has stopped)... It should work together with the requirement, that you can scroll smoothly and endlessly.
I'm really looking forward to get some ideas or even some code how I can implement the features I'd like to have. Since I worked so many hours on this problem I really need your help. If someone with great experience can even completely implement all features I'd be very glad because this would help me a lot. But I'm also looking forward to any kind of help!
Thank you very much in advance!
kind regards,
the man who needs help and appreciates it even more
I have to do a presentation about Processing next week. The task is, to show the internal working-process of processing. So I have to understand all the internal processes and the concept of the class and inheritance hierarchy in detail.
I couldn't find any documentation about that (except the comments in the SRC-Files in PGraphics ect, but they didn't help me that much).
Where does PGraphics use Graphics (of AWT)?
I can find "PGraphics g" in the source code of PGraphics.java but i can't find the spot where Processing is using the original "Graphics"-Context of AWT.
I would appreciate your help very much!
I also couldn't find any documentation about the class and inheritance hierarchy. Are there any overview diagramms?
How does the Packages (PGraphics, PImage, ...) work together?
For example, if I want to draw a line. Which steps (in which classes) does Processing perform to translate the Processing Code into real Java (AWT) code?
Can I see the processed/translated Java Code somewhere?
What steps are performed to translate the Processing-Code into Java-Code in detail (which procedures/classes a called, where's / when's the AWT-Graphics context called)?