<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to tutorial</title><link>https://sourceforge.net/p/ocejs/home/tutorial/</link><description>Recent changes to tutorial</description><atom:link href="https://sourceforge.net/p/ocejs/home/tutorial/feed" rel="self"/><language>en</language><lastBuildDate>Sun, 27 Nov 2011 02:45:28 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/ocejs/home/tutorial/feed" rel="self" type="application/rss+xml"/><item><title>WikiPage tutorial modified by Madster</title><link>https://sourceforge.net/p/ocejs/home/tutorial/</link><description>The Files
---------
You'll always need to link OCE.js and whatever drawable objects you wish to use.

&gt; &amp;lt;script type="text/javascript" src="OCE.js"&amp;gt;&amp;lt;/script&amp;gt;
&gt; &amp;lt;script type="text/javascript" src="drawables/Node.js"&amp;gt;&amp;lt;/script&amp;gt;

Initialization
--------------
There is none. You will need to draw to something, though, so let's get a canvas element.
Assuming in your HTML there is a canvas with id='frontbuffer'

&gt; &amp;lt;canvas id='frontbuffer'&amp;gt;canvas not supported, please update&amp;lt;/canvas&amp;gt;

You can use this canvas to draw by associating a layer to it:

&gt; var frontbuffer = new OCE.Layer(document.getElementById("frontbuffer"));

Then create a text node (Node.js)

&gt; var mynode= new OCE.Node("Behold\\nThe Textbox",0.3);

And add it to the frontbuffer's list of drawables

&gt; frontbuffer.addDrawable(mynode);

Now whenever you draw the frontbuffer, it's drawables will also be drawn. Usually, you'll want to clear the frontbuffer before drawing (unless you plan to cover it whole)

&gt; frontbuffer.clear();
&gt; frontbuffer.drawChildren();

And that's it!
I suggest you have a look at the nullDrawable properties that all drawables inherit:
- xPos, yPos, setPos(): Position relative to parent layer.
- xAnchor, yAnchor, setAnchor(): This allows you to pivot your objects and layers however you wish. Node is drawn from 0,0 to width,height, so an anchor of 0,0 means it will rotate on it's upper left corner. Objects may have their own origin, but you can change it with a proper anchor.
- xZoom, yZoom, setZoom(): This is zooming in percent.
- xSkew, ySkew, setSkew(): You can skew objects and layers too.

Drawables are in the drawable folder by convention. You'll find an example object there for the basics and you may study circle and node for a basic understanding of how to create drawables.
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Madster</dc:creator><pubDate>Sun, 27 Nov 2011 02:45:28 -0000</pubDate><guid>https://sourceforge.net4f07513d84971dece4bed274bea744f7904d9245</guid></item></channel></rss>