Eng:Sb2.js

sb2.js is a Scratch Extension written in JavaScript by RHY3756547 as an open source alternate Scratch player for Scratch 2.0 project files. It unzips .sb2 files and converts the JSON Scratch scripts into JavaScript, which is then executed. Because the project has not been updated since August 4, 2012, it is likely no longer under development by RHY3756547.

sb2.js is designed to be easily moddable, as it makes addition of blocks simple. This could allow for other Scratch Modifications to use sb2.js as a way to play their projects in the browser, or transition to the Scratch 2.0 file format.

Features currently in progress are a completely HTML5-based editor, which displays sprites' scripts using the DOM, a mobile enhanced version of the player for iOS, and an implementation of Mesh.

Because sb2.js is coded in JavaScript, it allows projects to be viewed and created on devices such as the iPad and iPhone.

Compatibility
Right now, sb2.js supports nearly every block and behaves very similarly to the Flash Player.

Features which are unimplemented or implemented incorrectly are:


 * The .sb format is not supported. Currently, all projects must be converted to .sb2 using Scratch 2.0.
 * Execution order of scripts is incorrect. Can be seen in sketch.sb2.
 * All graphic effects excluding ghost are unimplemented.
 * Microphone blocks and Scratch 2.0 video blocks, despite being possible with new HTML5 APIs, are not currently implemented due to lack of widespread support.
 * Casting is not fully implemented.
 * Sensor Boards are not supported as the device interfacing is not possible in JavaScript. However, Mesh is supported, so the Sensor Value (block) is still functional.
 * List Watchers are not implemented.
 * Note Blocks only play notes as square waves, and drums do not play at all.
 * Draggable Sprites are not draggable.
 * Procedures are not yet supported.
 * Since sb2.js is not on the Scratch 2.0 website, cloud variables are not feasible.

Features which are deliberately different or extra are:


 * Sprites can go offscreen.
 * Mesh is built in, but requires an external Websockets server to connect 2 clients. It currently cannot connect with Scratch 1.4.
 * A console is included for performance measurements.
 * Player settings like the framerate, turbo mode and presence of the frame around the project can be changed in the embed code.
 * There is no limit to the clone block.

Performance
sb2.js is faster than all of the 1.4 players and the Flash Player. This is because of code recompilation by the JavaScript V8 engine in modern browsers.

Performance on mobile devices is considerably slower than on PC; however, with more modern devices such as the iPhone 4 the performance is still much faster than that of Scratch 1.4 on desktop.