Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Digital Thaumatropes
- Created: November, 15, 2018
- Author: Verity Griscti
- Version: 1.0
- This program is meant to recreate the optical illusion of analog thaumatropes and export the ouput to a gif.
- (press mouse button to end gif loop)
- Two images of the thaumatrop are required (Back & Front). Images must be saved in the same file as the pde.
- The script alternates between the two of them quickly recreating the optical illusion.
- The output is saved as a .gif Animation so it can be shared easily over the web.
- The gifAnimation library is required for this to work.
- */
- import gifAnimation.*;
- GifMaker gifExport;
- int count = 1;
- void setup(){
- size(290,175);
- gifExport = new GifMaker(this, "Digital_Thaumascope.gif");
- gifExport.setRepeat(0); //= loop forever
- }
- void draw(){
- if(count%2 == 0){
- PImage back;
- back = loadImage("InsertImageNameHere.jpg");
- if(count == 2 || count == 4){
- frameRate(2);
- }else{
- frameRate(15);
- }
- image(back,0,0);
- } else {
- PImage front;
- front = loadImage("InsertImageNameHere.jpg");
- if(count == 1 || count == 3){
- frameRate(2);
- }else{
- frameRate(15);
- }
- image(front,0,0);
- }
- count = count + 1;
- gifExport.setDelay(1);
- gifExport.addFrame();
- }
- void mousePressed(){
- gifExport.finish();
- }
Add Comment
Please, Sign In to add comment