heartcode/CanvasLoader — Issue #6: Passing in (visual) parameters as object to constructor
Author: daaain
Created: 2012-01-27 20:52:37+00:00
State: open

In case you want to create more than one instance of the loader with the same looks, at the moment you have to set them up individually. As an alternative it would be nice to be able to pass in an object with all the desired parameters.

So instead of this:

```javascript
cl2 = new CanvasLoader('overlay-canvasloader-container');
cl2.setShape('roundRect'); // default is 'oval'
cl2.setDensity(14); // default is 40
cl2.setRange(1); // default is 1.3
cl2.setSpeed(1); // default is 2
cl2.setFPS(12); // default is 24
cl2.show(); // Hidden by default

cl = new CanvasLoader('canvasloader-container');
cl.setShape('roundRect'); // default is 'oval'
cl.setDensity(14); // default is 40
cl.setRange(1); // default is 1.3
cl.setSpeed(1); // default is 2
cl.setFPS(12); // default is 24
cl.show(); // Hidden by default
```

Something like this:

```javascript
clparams = {
shape: 'roundRect',
density: 14, // default is 40
range: 1, // default is 1.3
speed: 1, // default is 2
FPS: 12, // default is 24
show: true // Hidden by default
}

cl2 = new CanvasLoader('overlay-canvasloader-container', {params: clparams});
cl = new CanvasLoader('canvasloader-container', {params: clparams});
```