├── PraxinoscopeTemplate.pde ├── README.md ├── images ├── praxinoscope-animation-1.gif ├── praxinoscope-animation-2.gif └── praxinoscopes.jpg └── praxinoscope-output.pdf /PraxinoscopeTemplate.pde: -------------------------------------------------------------------------------- 1 | // Template for KidzLabs/4M/Toysmith Animation Praxinoscope 2 | // https://www.amazon.com/4M-3474-Animation-Praxinoscope/dp/B000P02HYC 3 | // https://www.walmart.com/ip/Animation-Praxinoscope-Science-Kits-by-Toysmith-3474/45681503 4 | // Developed for Processing 3.3.6 * http://processing.org 5 | // 23 January 2018 * Golan Levin 6 | 7 | // See information about Processing PDF export at: 8 | // https://processing.org/reference/libraries/pdf/index.html 9 | // PDF generated by Processing can be opened in Adobe Illustrator. 10 | import processing.pdf.*; 11 | boolean bRecordingPDF = false; 12 | 13 | float inch = 72; 14 | float diamArtInner = inch * 1.50; 15 | float diamArtOuter = inch * 4.80; 16 | float diamCutInner = inch * 1.41; 17 | float diamCutOuter = inch * 4.875; 18 | float holeDy = inch * 0.23; 19 | float holeDx = inch * 0.20; 20 | float holeD = inch * 0.1; 21 | 22 | final int nFrames = 10; 23 | int myFrameCount = 0; 24 | int exportFrameCount = 0; 25 | boolean bAnimate = true; 26 | boolean bExportFrameImages = false; 27 | 28 | //------------------------------------------------------- 29 | void setup() { 30 | size(792, 612); // 11x8.5" at 72DPI 31 | frameRate(15); 32 | smooth(); 33 | } 34 | 35 | //------------------------------------------------------- 36 | void draw() { 37 | background(240); 38 | if (bRecordingPDF) { 39 | beginRecord(PDF, "praxinoscope-output.pdf"); 40 | } 41 | 42 | // Do all the drawing. 43 | pushMatrix(); 44 | translate(width/2, height/2); 45 | drawCutLines(); 46 | drawGuides(); 47 | drawAllFrames(); 48 | popMatrix(); 49 | 50 | if (bExportFrameImages) { 51 | // If activated, export .PNG frames 52 | if (exportFrameCount < nFrames) { 53 | String filename = "frame_" + nf((exportFrameCount%nFrames), 3) + ".png"; 54 | saveFrame("frames/" + filename); 55 | println("Saved: " + filename); 56 | exportFrameCount++; 57 | if (exportFrameCount >= nFrames) { 58 | bExportFrameImages = false; 59 | exportFrameCount = 0; 60 | } 61 | } 62 | } 63 | 64 | if (bRecordingPDF) { 65 | endRecord(); 66 | bRecordingPDF = false; 67 | } 68 | } 69 | 70 | 71 | //------------------------------------------------------- 72 | void keyPressed() { 73 | switch (key) { 74 | case ' ': 75 | // Press spacebar to pause/unpause the animation. 76 | bAnimate = !bAnimate; 77 | break; 78 | 79 | case 'p': 80 | case 'P': 81 | // Press 'p' to export a PDF for the Praxinoscope. 82 | bRecordingPDF = true; 83 | break; 84 | 85 | case 'f': 86 | case 'F': 87 | // Press 'f' to export .png Frames (to make an animated .GIF) 88 | myFrameCount = 0; 89 | exportFrameCount = 0; 90 | bExportFrameImages = true; 91 | bAnimate = true; 92 | break; 93 | } 94 | } 95 | 96 | //------------------------------------------------------- 97 | void drawCutLines() { 98 | fill(0); 99 | textAlign(CENTER, BOTTOM); 100 | text("Praxinoscope Template", 0, 0-diamCutOuter/2-6); 101 | 102 | stroke(0); 103 | strokeWeight(1.0); 104 | 105 | noFill(); 106 | if (!bRecordingPDF) { 107 | fill(255); 108 | } 109 | ellipse(0, 0, diamCutOuter, diamCutOuter); 110 | 111 | noFill(); 112 | if (!bRecordingPDF) { 113 | fill(240); 114 | } 115 | ellipse(0, 0, diamCutInner, diamCutInner); 116 | 117 | noFill(); 118 | ellipse(diamCutOuter/2 - holeDx, 0-holeDy, holeD, holeD); 119 | 120 | line (diamCutInner/2, 0, diamCutOuter/2, 0); 121 | } 122 | 123 | //------------------------------------------------------- 124 | void drawGuides() { 125 | // This function draws the guidelines. 126 | // Don't draw these when we're exporting the PDF. 127 | if (!bRecordingPDF) { 128 | 129 | noFill(); 130 | stroke(128); 131 | strokeWeight(0.2); 132 | ellipse(0, 0, diamArtInner, diamArtInner); 133 | ellipse(0, 0, diamArtOuter, diamArtOuter); 134 | 135 | for (int i=0; i 3 | Developed for Processing 3.3.6 / 23 January 2018 by Golan Levin 4 | 5 | * Animation Praxinoscopes are available from: 6 | * https://www.amazon.com/4M-3474-Animation-Praxinoscope/dp/B000P02HYC 7 | * https://www.walmart.com/ip/Animation-Praxinoscope-Science-Kits-by-Toysmith-3474/45681503 8 | 9 | It is anticipated that students will customize the code in the "drawArtFrame()" function in PraxinoscopeTemplate.pde with their own design. No other code needs to be modified. Pressing 'p' exports a PDF. Cut out the circle and put it on your spinny praxinoscope. Fun! 10 | 11 | Also see this template for a Zoetrope: https://github.com/golanlevin/ZoetropeTemplate 12 | 13 | ![Praxinoscopes](images/praxinoscopes.jpg "Praxinoscopes") 14 | 15 | ![Animated GIF example 1](images/praxinoscope-animation-1.gif "Praxinoscope example 1") 16 | 17 | ![Animated GIF example 2](images/praxinoscope-animation-2.gif "Praxinoscope example 2") 18 | 19 | -------------------------------------------------------------------------------- /images/praxinoscope-animation-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golanlevin/PraxinoscopeTemplate/a0562cdf4fc53d2e8606b56ab8f05550dfb0d16f/images/praxinoscope-animation-1.gif -------------------------------------------------------------------------------- /images/praxinoscope-animation-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golanlevin/PraxinoscopeTemplate/a0562cdf4fc53d2e8606b56ab8f05550dfb0d16f/images/praxinoscope-animation-2.gif -------------------------------------------------------------------------------- /images/praxinoscopes.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golanlevin/PraxinoscopeTemplate/a0562cdf4fc53d2e8606b56ab8f05550dfb0d16f/images/praxinoscopes.jpg -------------------------------------------------------------------------------- /praxinoscope-output.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golanlevin/PraxinoscopeTemplate/a0562cdf4fc53d2e8606b56ab8f05550dfb0d16f/praxinoscope-output.pdf --------------------------------------------------------------------------------