topical media & game development

talk show tell print

lib-present-graphic-canvas-process.htm / htm



  <html><head>
  <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  
          <title>Processing.js</title>
          <script src="lib-present-graphic-canvas-processing.js"></script>
          <script src="lib-present-graphic-canvas-init.js"></script>
  </head><body>
  <script type="application/processing">
  int pos = 0, dir = 1;
  
  void setup(){
          size(500, 500);
          noStroke();
          background( 0 );
  }
  
  void draw(){
          rotate( 15 * pos );
          
          fill(0, 10);
          rect(0, 0, width, height);
          
          fill(255, 0, 0);
          rect( pos, pos, 20, 20 );
          
          pos += dir;
          
          if ( pos > width ) {
                  dir = -1;
          } else if ( pos + 20 < 0 ) {
                  dir = 1;
          }
  }
  </script><canvas height="500" width="500"></canvas>
  </body></html>
  


(C) Æliens 27/08/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.