+ Reply to Thread
Results 1 to 7 of 7

Thread: Processing on the Web

  1. #1
    Join Date
    Aug 2009
    Location
    ~/
    Posts
    918
    Rep Power
    19

    Smile Processing on the Web

    This tutorial is a brief intro to the Processing Language
    and Processing.js (Processing ported to Javascript).

    The Processing Language
    Here is the opening paragraph from Processing.org
    Processing is an open source programming language and environment for people who want to program images, animation, and interactions. It is used by students, artists, designers, researchers, and hobbyists for learning, prototyping, and production. It is created to teach fundamentals of computer programming within a visual context and to serve as a software sketchbook and professional production tool.

    Below are 2 images where I use the Processing IDE to create a simple animation and execute it.





    I have to say...
    Processing is by far the easiest language I've tried, but it offers some awesome graphic capabilities.
    The syntax is very easy to understand, just click Help -> Reference in the IDE or click the
    Reference Tab at Extended Language (API) \ Processing 1.0




    Processing.js (Processing Language ported to javascript)
    Here is the opening paragraph from Processingjs.org
    Processing.js is an open programming language for people who want to program images, animation, and interactions for the web without using Flash or Java applets. Processing.js uses Javascript to draw shapes and manipulate images on the HTML5 Canvas element. The code is light-weight, simple to learn and makes an ideal tool for visualizing data, creating user-interfaces and developing web-based games.
    Processing.js runs in FireFox, Safari, Opera, Chrome and will also work with Internet Explorer, using Explorer Canvas.

    Processing.js requires a few javascript files/libraries which can be downloaded here:
    Processing.js




    The commands available for Processing.js are slightly reduced and can be found here:
    Processing.js. It you click the "toggle all" link on this page, it shows the Processing commands that are not available to Processing.js



    Here is a simple website using the script I created above.

    Code:
    <!DOCTYPE html>
    <html>
    <head>
      <title>Debtboy's Processing Language Site</title>
      <script src="./js/init.js"></script>
      <script src="./js/processing.js"></script>
    </head>
    
    <body>
      <center>
    
      <h2>Debtboy's Processing Ported to Javascript Site</h2>
    
      <script type="application/processing" target="debtboy_canvas">
        float a = 0.0;
        float s = 0.0;
        PImage img1;
    
        void setup()
        {
          size(400,400);
          noStroke();
          frameRate(20);
          img1 = loadImage( "./images/debtboy_cow.jpg" );
        }
    
        void draw()
        {
          background(255);
          a = a + 0.04;
          s = cos(a)*2;
      
          translate(width/2, height/2);
          scale(s); 
    
    
          image(img1,-103,-90);
        }
      </script>
      <canvas width="300" height="300" id="debtboy_canvas"></canvas>
      <br></br>
      </center>
    </body>
    </html>
    Note the javascript libraries in the <head></head> section:
    Code:
      <script src="./js/init.js"></script>
      <script src="./js/processing.js"></script>
    Note the simple script creating this neat graphical effect:
    Code:
      <script type="application/processing" target="debtboy_canvas">
        float a = 0.0;
        float s = 0.0;
        PImage img1;
    
        void setup()
        {
          size(400,400);
          noStroke();
          frameRate(20);
          img1 = loadImage( "./images/debtboy_cow.jpg" );
        }
    
        void draw()
        {
          background(255);
          a = a + 0.04;
          s = cos(a)*2;
      
          translate(width/2, height/2);
          scale(s); 
    
    
          image(img1,-103,-90);
        }
      </script

    Note that the canvas object is used:
    Code:
    <canvas width="400" height="400" id="debtboy_canvas"></canvas>

    Here is a link to my website with the animation:
    Debtboy's Processing Language Site


    Below are a few website images (at different points) of the running animation:









    I'm quite impressed by Processing and Processing.js capabilities. I'll be experimenting quite a bit with this language on my member website. It's very easy to understand and use which are sought after features for a lazy programmer like myself

    If you haven't already... give Processing (Processing.js) a try.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    Jordan Guest

    Re: Processing on the Web

    That is so cool! The animation on your site is very smooth. Nicely formated tutorial as well!

    Why didn't you attach the images or upload them to your CC site (vs your Comcast site)?

    +rep!

  4. #3
    Join Date
    Aug 2007
    Location
    Gizeh, Al Jizah, Egypt, Egypt
    Posts
    8,675
    Blog Entries
    12
    Rep Power
    81

    Re: Processing on the Web

    love this tutorial *bookmark*
    ive always been interested in canvas +rep
    yo homie i heard you like one-line codes so i put a one line code that evals a decrypted one line code that prints "i love one line codes"
    Code:
    eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
    www.amrosama.com | the unholy methods of javascript

  5. #4
    Join Date
    Mar 2008
    Posts
    7,144
    Rep Power
    86

    Re: Processing on the Web

    Very cool! +rep

  6. #5
    zeroradius's Avatar
    zeroradius is offline Speaks fluent binary
    Join Date
    Feb 2008
    Location
    Ohio
    Posts
    1,403
    Rep Power
    25

    Re: Processing on the Web

    Nice tutorial + rep

    Does this offer any advantages over using something such as flash, other than the user not having to download flash to use it? Does it have capabilities that make it easier than making an animated gif or is it just somthing fun to do and not for serious production?

  7. #6
    Join Date
    Aug 2009
    Location
    ~/
    Posts
    918
    Rep Power
    19

    Re: Processing on the Web

    Thanks everyone for the positive feedback

    Quote Originally Posted by zeroradius View Post
    Nice tutorial + rep

    Does this offer any advantages over using something such as flash, other than the user not having to download flash to use it? Does it have capabilities that make it easier than making an animated gif or is it just somthing fun to do and not for serious production?
    It's free/open and very easy to program, but you will
    have to decide for yourself.

  8. #7
    zeroradius's Avatar
    zeroradius is offline Speaks fluent binary
    Join Date
    Feb 2008
    Location
    Ohio
    Posts
    1,403
    Rep Power
    25

    Re: Processing on the Web

    I guess every thing is worth trying once (^_^)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Not processing keypress
    By Christoph in forum C and C++
    Replies: 2
    Last Post: 09-09-2010, 11:03 PM
  2. File Processing in C
    By Maze in forum C and C++
    Replies: 8
    Last Post: 07-07-2009, 09:29 AM
  3. Not processing php
    By thomas123 in forum PHP Development
    Replies: 3
    Last Post: 12-15-2008, 10:26 PM
  4. I/O processing
    By renoald in forum Visual Basic Programming
    Replies: 4
    Last Post: 09-24-2008, 12:03 AM
  5. Processing
    By Matt in forum General Programming
    Replies: 2
    Last Post: 07-12-2007, 10:45 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts