Amino Refactored

I've done a major refactoring which will make Amino easier to install, easier to maintain and, eventually, better performance and portability. Part of this work involved moving the platform specific parts to their own node modules. This means you should no longer install aminogfx directly. Instead, install the appropriate platform specific module. Currently there is one for GL and one for Canvas. I've also added stage transparency support to Raspberry Pi!

Here's how it works on the Pi.

Install NodeJS if you don't already have it installed. You'll also need GCC for the native bits. Then, inside your app directory, install aminogfx-gl

npm install --save aminogfx-gl

Then wait while it downloads and compiles everything. This may take a while. It's about 5 min on my new Raspberry Pi 2. It'll take a bit longer on the Pi 1.

In your app, require aminogfx-gl then code as normal. The code below creates a window with a rectangle and circle.

var amino = require('aminogfx-gl');
amino.start(function(core, stage) {
    stage.fill("#00ff00");
    stage.opacity(1.0);

    var root = new amino.Group();
    stage.setRoot(root);
    var rect = new amino.Rect()
            .w(200).h(250).x(0).y(0)
            .fill("#0000ff");
    root.add(rect);

    var circle = new amino.Circle().radius(50)
        .fill('#ffcccc').filled(true)
        .x(100).y(100);
    root.add(circle);
});

New to this version are the stage.fill and stage.opacity properties. Fill controls the background of the window, black by default. Opacity affects the opacity of the window's background. If you set it to 0.0 then the background will go away completely. On the Mac this will have no effect:

but on the Raspberry Pi, this will let what's behind show through. This could be the console, or another app, or a video.

Layering multiple apps together opens up a lot of interesting possibilities. I can't wait to see what you make with it.

Though there are multiple github repos now, one for each backend, most of the code is still shared in the aminogfx repo repo. Use that for docs, bugs and feature requests.

Talk to me about it on Twitter

Posted February 27th, 2015

Tagged: amino canvas opengl