Sprite3D, Fayer, STD-Rest

12 Aug 2011 | By Alex Young | Tags libraries webgl webkit json

Sprite3D

Sprite3D (GitHub: boblemarin / Sprite3D.js, License: MIT) by Emeric Florence is a JavaScript API that wraps around CSS 3D transforms to make creating 3D animations and sprite handling a lot easier. The site has a lot of examples (I like Sprite Harrier and Canvas demo).

Sprite3D’s API allows chaining:

new Sprite3D(element)
  .setPosition(x, y, z)
  .setRotation(x, y, z)
  .update();

In this example, update() will apply the position and rotation values to the element passed to the constructor. The Sprite3D API documentation shows all of the other transforms and methods.

According to the author:

As you manipulate “real” HTML elements, you don’t need a Canvas object (and its performance problems), nor a WebGL-enabled browser. And, as 3D transforms are hardware-accelerated, you can get a very decent framerate, even on (Apple’s) mobile devices.

This is an interesting point, because a lot of people have been frustrated at Canvas performance on iOS. Given the author’s background in AS3, perhaps this library will appeal to Flash developers looking to build interactive content for mobile WebKit browsers?

Fayer

Fayer (License: dual MIT/GPLv2) is a library that helps selectively execute functions based on the current “page”. The current page is determined based on a body ID:

// Given <body id="page-home">

fayer.on('page-home', function() {
  // code for homepage goes here
})

This doesn’t require jQuery and is a very lightweight library. Fayer would come in handy when working on a project with monolithic client-side JavaScript, although I find myself using libraries like LABjs these days.

STD Rest

STD Rest (or API Kit) by Richard Lyon is an attempt to provide a standard API format using JSON that can be accessed using the same API in multiple languages. The author has written prototype implementations in CoffeeScript and PHP.

Richard hopes to make a universally readable format that can be applied to any JSON REST API. To see if this is realistic, he’s testing it with Last.fm, Twitter, LinkedIn, and Qwerly. Although he notes that:

[I need to] figure out flexible authentication scheme (OAuth is easy if everyone would just implement it please?)

Chance would be a fine thing!

The lastfm.json file illustrates how the project works. The service is described in JSON, and this includes API methods, authentication, validation, and error handling. This sounds suspiciously like WSDL, and the author addresses this comparison in the project’s README.


blog comments powered by Disqus