Mar 10

Harmony is a new drawing tool, a HTML5/Canvas experiment with great potential. It provides some unique brush styles, and can produce some great-looking charcoal pencil style sketches, among other things. Better to try it out than explain it in words.

Creator Mr. Doob (Richard Cabello) explains how he used Canvas to make it darker the more you draw over it:

The whole thing is quite modular so I can keep adding more brush styles whenever I get inspired. During the process I found out that, for some reason (apparently lack of hardware acceleration), Firefox and Opera do not support context.globalCompositeOperation = ‘darker’. This was on the HTML5 spec before but got removed. Just so you know what I’m talking about, this is like the “multiply” blending in Photoshop. Webkit does support it tho. I hope they put it back on the specs and all browsers support it.

You can also save images using data URI encoding.

As it works on webkit, he made sure it worked on the mobile Android and iPhone browsers. No multi-touch as yet, but the touch UI still makes a nice input mechanism.

harmony

(Thanks FND)

Continue reading »

Tagged with:
Feb 17

Martin Aumont has released Harmony, which “provides a simple DSL to execute JavaScript and DOM code within Ruby.”

This enables you to do very cool things such as unit test JavaScript in the same area as your Ruby tests:

RUBY:

    require ‘test/unit’
    require ‘harmony’

    class JavascriptTest <Test::Unit::TestCase
      def setup
        @page = Harmony::Page.new
        @page.load(‘public/javascripts/foo.js’)
      end

      def test_foo
        assert_equal "world", @page.execute_js(<<-JS)
          foo = new Foo;
          foo.hello();
        JS
      end
    end

and you can even use JavaScript libraries…. as script tags are autofetched:

RUBY:

    require ‘harmony’

    page = Harmony::Page.new(<<-HTML)
      <html>
        <head>
          <script src="javascripts/jquery.js" type="text/javascript"></script>
        </head>
        <body>
          <div id="widget">ohaie</div>
        </body>
     
    HTML

    page.execute_js("$(‘#widget’).innerHTML") #=> "ohaie"

This library builds on the shoulders of giants, one of which is Mr. Johnson, John Barnette who I had the pleasure of working with many moons ago. He is the person I think of when I remember that the best engineers that I have worked with haven’t been computer scientists, but musicians and biologists. He is also a great fun guy.

Anyway, sorry for the aside.

If you are a Rails chap, you may also be interested in the Rails plugin holygrail.

Continue reading »

Tagged with:
preload preload preload