Hi there, i found this fantastic code by amnon while searching for a slideshow.
This code is great and works as excpetdec i just have two little problems i cant figure out.
First is that the code doesnt work in the latest processing versios. but works fine when using older ones.
i guess it misses some java libraries that has to be loaded. but how do i know which one?
oh and the second is the way it works.it loads all images in one folder and place them on the screen. this is pretty cool, but lets say i have only 4 images. it stops but what i would love to do is, if the last image is placed it should begin again without removing the other images, so its getting more and more. this has two benefits. first it looks good when you only have a limited number of images and if you have a little more, it starts again frmo the beginning and you get to see the other images as well and you can actually run the code forever which would be cool instead of just showing every picture only once. maybe it can also be random... can any body give me some hints. that would be great.
here is the code.
//***************************************************************// // Dynamic Image Slideshow // by amnonP5 <http://amnonp5.wordpress.com> // // space = Add slide // z = Turn ON / OFF the autoplay function // x = Delete last slide // c = Clear all slides // // Comment IN / OUT: print added image message to console // Comment IN / OUT: auto-reset slideshow at last slide // //***************************************************************//
import processing.opengl.*;
ArrayList photos = new ArrayList(); String[] loadFilenames; PImage[] loadPhotos; int counter, fileCount; boolean autoPlay = true; // by default autoplay is OFF
void setup() { size(1280,720,OPENGL); // size(screen.width,screen.height,OPENGL); // full screen mode smooth(); loadPhotos = new PImage[10000]; // maximum of 10.000 images loadFilenames(); loadPhotos(); // all existing images are loaded in setup fileCount = loadFilenames.length; }
void draw() { background(51); checkNew(); // checks for new images in the data directory every draw cycle if(autoPlay) {autoPlay();} for (int i = 0; i < photos.size(); i++) { Photo s = (Photo) photos.get(i); s.display(); s.move(); } // if (photos.size() == fileCount) {photos.clear();} // reset slideshow when it reaches the last slide }
void loadFilenames() { java.io.File folder = new java.io.File(dataPath("")); // reads files from data folder java.io.FilenameFilter imgFilter = new java.io.FilenameFilter() {boolean accept(File dir, String name) {return name.toLowerCase().endsWith(".jpg") || name.toLowerCase().endsWith(".png");} }; loadFilenames = folder.list(imgFilter); }
void loadPhotos() { for (int i = fileCount; i < loadFilenames.length; i++) { // only load new images loadPhotos[i] = loadImage(loadFilenames[i]); // println("Photo added: " + loadFilenames[i]); // print added image message to console } }
void checkNew() { loadFilenames(); if (loadFilenames.length > fileCount) {loadPhotos(); fileCount = loadFilenames.length;} // only call loadPhotos if there are new images }
hey guys, i am kinda confused. i am trying to use opengl and smooth to smooth for example a simple ellipse.
But it is not working at all, not using smooth ( which is not work anymore if i am correct) but not using
hint(ENABLE_OPENGL_4X_SMOOTH);
or anything similar. I am pretty sure it was possible, i exported a lot of images using openGL and smooth, but i just cant make it work again. Is it possible or not or am i wrong here ?
this is how the following code looks on my computer...
Hello. I am working with the controlP5 library which is fantastic.
but i am having a little problem moving/repositioning the tabs bar.
its always in the upper left corner.
controlP5.tab(""+i).setPosition(60,100*i);
and stuff like that doenst produce an error, but nothing changed.
is it possible to move them? cause need them, but not in the right upper corner.
Hey folks, i have seen this great video of somebody using the kinetc to control a puppet.
http://vimeo.com/16985224
looks great, but as far as i dont understand you dont really need a kinect, you could also use some regular camera when you get good images, black hand in front of white background for example. So the kinect just helps to get good cam results.
But my question is, how do you think is the skeleton Tracking done? How can you say, that the elbow, arm, hand is one elemente? you need to add points to it. How would you do this in concept ? I would love to figure it out myself.
hey people.
i am working on a pixel icon editor but i am already encountering some basic problems.
i am creating a grid of different pixel. and change the color when hover over them with mouse pressed or click them. but
every time i do that it starts to flicker cause its turning on and off so fast
i guess that is because "on" is set several times a second,
but how can i do it, that it turns red when i click it ones, or turns red when i move the pressed mouse (dragged) over it.
so i want it to change red when i move over it, and only turn white again when i move over it a second time.
i just cant make it work.
here is my code so far.
int pSize = 10; int w = 800; int h = 600; int cols = w/pSize; int rows = h/pSize; int num = rows*cols;
Pixel[] pixel = new Pixel[num];
void setup() { size(800,600); smooth(); background(0); rectMode(CENTER); int c = 0; for (int x=0; x<cols; x++){ for (int y=0; y<rows; y++){ pixel[c] = new Pixel((pSize/2)+x*pSize,(pSize/2)+y*pSize); c++ ; } } }
void draw() { background(0);
for (int i=0; i<pixel.length; i++){ pixel[i].show(); } }