# How do I slowly layer photos to appear on top of eachother?

**URL:** <https://discourse.processing.org/t/how-do-i-slowly-layer-photos-to-appear-on-top-of-eachother/36698>\
**Category:** Coding Questions\
**Created:** [May 3, 2022, 5:23pm UTC](https://discourse.processing.org/t/how-do-i-slowly-layer-photos-to-appear-on-top-of-eachother/36698 "2022-05-03T17:23:53Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [May 4, 2022, 1:23pm UTC](https://discourse.processing.org/t/how-do-i-slowly-layer-photos-to-appear-on-top-of-eachother/36698/5 "2022-05-04T13:23:30Z")

</div>

This example loads all images inside subfolder “data/” and assign them to a PImage[] array: 🖼

```auto
/**
 * Load All Images (v1.0.0)
 * GoToLoop (2022/May/04)
 *
 * https://Discourse.Processing.org/t/
 * how-do-i-slowly-layer-photos-to-appear-on-top-of-eachother/36698/5
 */

static final String PICS_EXTS = "extensions=,png,jpg,jpeg,gif,tif,tiff,tga,bmp";

static final float FPS = .25;

PImage[] images;

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

  frameRate(FPS);
  imageMode(CENTER);

  images = loadAllImages();
  if (images.length == 0) exit();
}

void draw() {
  clear();
  image(images[frameCount % images.length], width >> 1, height >> 1);
}

PImage[] loadAllImages() {
  final File dir = dataFile("");
  println(dir);

  String[] imagePaths = {};
  int imagesFound = 0;

  if (dir.isDirectory()) {
    imagePaths = listPaths(dir.getPath(), "files", "recursive", PICS_EXTS);
    imagesFound = imagePaths.length;
    java.util.Arrays.sort(imagePaths);
  }

  printArray(imagePaths);
  println("Found", imagesFound, "image(s)");

  final PImage[] imgs = new PImage[imagesFound];
  for (int i = 0; i < imagesFound; imgs[i] = loadImage(imagePaths[i++]));

  return imgs;
}

```

---

_[View the full topic](https://discourse.processing.org/t/how-do-i-slowly-layer-photos-to-appear-on-top-of-eachother/36698)._
