ZIM js JavaScript Framework

Canvas Components, Controls and more!

ZIM 2 DUO Launches with Extra Parameter Functionality

duo3

ZIM 2 DUO has launched as full version 2 of ZIMjs, the open source, free framework for interactive media on the HTML 5 Canvas working with the powerful CreateJS.

DUO works the same way as ZIM and is backwards compatible with all the same features.  The main difference is, you can pass parameters the traditional way or as a single object with properties that match the parameter names.  This saves the bother of passing in nulls for parameters and is also easier to read.  For example – these all work:

zim.move(circle, 100, 100, 500, null, null, null, null, null, 30);
zim.move({target:circle, x:100, y:100, time:500, fps:30});

var r = new zim.Rectangle(100, 100, null, null, null, 10);
var r = new zim.Rectangle({width:100, height:100, corner:10});

ZIM DUO has a new function in its wrap module called zob().  This function is what allows you to pass an alternate object as a single parameter.  You can use this function too for your functions and classes.  Have a read about it in the ZIM Docs.

ZIM 2 also has a new format for the CDN (Content Delivery Network).  We now minify all the modules and the full zim code under just the zim and version number, i.e. zim_2.0.js.   So no more _min.  The only file that is human readable has _doc after the version number, i.e. zim_2.0_doc.js.

The new version is 61K and the old version is 58K.  zob() automatically reads the function parameter names but unfortunately, if the code is minified, this does not work, so you need to pass a string of the parameters – hence the extra 3K for roughly 60 sets of parameters.  Note, we did not bother setting the dual feature with functions that had no optional parameters.  We may change that later for consistency if it is perceived as an issue.

Dan

 

Advertisements

One comment on “ZIM 2 DUO Launches with Extra Parameter Functionality

  1. Pingback: ZIM 2 DUO – CreateInTO Talk – What’s Bubbling on the HTML 5 Canvas? – ZIM js JavaScript Framework

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Information

This entry was posted on December 24, 2015 by in javascript, launch.
%d bloggers like this: