Sunday 23 January 2011

ProcessingJS/HTML

Ok so I need to figure out how adding scripts using the HTML works. I know that I can load an external script from another webpage and can therefore load the processing script and run the processing sketches in the blog.

Link to my post with the code I found that allows you to do this.

So....

< script type="application/processing" >

I think you would describe it as a declaration of what script(type?!) to use. Type and name maybe? so its an application called processing?

Useful little explanation of scripts:

"A client-side script is a program that may accompany an HTML document or be embedded directly in it. The program executes on the client's machine when the document loads, or at some other time such as when a link is activated. HTML's support for scripts is independent of the scripting language."

Scripts offer authors a means to extend HTML documents in highly active and interactive ways. For example:
  • Scripts may be evaluated as a document loads to modify the contents of the document dynamically.
  • Scripts may accompany a form to process input as it is entered. Designers may dynamically fill out parts of a form based on the values of other fields. They may also ensure that input data conforms to predetermined ranges of values, that fields are mutually consistent, etc.
  • Scripts may be triggered by events that affect the document, such as loading, unloading, element focus, mouse movement, etc.
  • Scripts may be linked to form controls (e.g., buttons) to produce graphical user interface elements.

There are two types of scripts authors may attach to an HTML document:
  • Those that are executed one time when the document is loaded by the user agent. Scripts that appear within a SCRIPT element are executed when the document is loaded. For user agents that cannot or will not handle scripts, authors may include alternate content via the NOSCRIPT element.
  • Those that are executed every time a specific event occurs. These scripts may be assigned to a number of elements via the intrinsic event attributes.

I am going to assume that canvas width/height is the size of the display area for the moment, although there is a size() command in the processing script also, I shall have to find out.

< canvas width="320" height="240" >

The next line indicates the destination to get the script from

< script src='http://processingjs.org/source/current/pjs-init.js' >

Seems fairly simple, I understand this if my posts have working examples in them! (other than the expanding/contracting blue and white circle once, as that is simply a copy and pasted example/test.

I also learned(put into practice) the tiniest bit of HTML formatting writing this post WOOOP! (for example the bullet point list)

No comments:

Post a Comment