Skip to content

vnoise/canvas.ui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

canvas.ui

canvas.ui is a HTML5 Canvas UI Framework with Multitouch support.

Features

canvas.ui is a light library for

  1. hiding different event models: apple touch, firefox touch or stock mouse events.
  2. delegating touch events to the right widget in a widget tree.
  3. drawing ui widgets on the html5 canvas element.
  4. managing layout for child widgets.

Usage

Following simple example assumes a canvas element in a html document:

<html>
  <head>
    <script src="/canvas.ui/mootools.js" type="text/javascript"></script>
    <script src="/canvas.ui/touch-tracker.js" type="text/javascript"></script>
    <script src="/canvas.ui/widget.js" type="text/javascript"></script>
    <script src="/canvas.ui/slider.js" type="text/javascript"></script>
    <script src="/app.js" type="text/javascript"></script>
  </head>
  <body onLoad="onLoad()" style="background:#000;margin:0">
    <canvas id="canvas" width="800" height="600"></canvas>
  </body>
</html>

Let's just create a root widget and add a slider with the label 'Pitch'.

The slider fires the change event, so we can pass an event handler to the constructor.

function onLoad() {
        var widget = new Widget({
            canvas: document.getElementById('canvas'),
            layout: 'vertical',
            width: 800,
            height: 600
        });

        var slider = widget.add({ 
            type: Slider, 
            label: 'Pitch',
            on: {
                change: function(value) {
                    console.log("value changed to: " + value);
                }
            }
        });
}

About

HTML5 Canvas UI Framework with Multitouch support

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published