Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing in (visual) parameters as object to constructor #6

Closed
daaain opened this issue Jan 27, 2012 · 2 comments
Closed

Passing in (visual) parameters as object to constructor #6

daaain opened this issue Jan 27, 2012 · 2 comments

Comments

@daaain
Copy link

daaain commented Jan 27, 2012

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:

    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:

    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});
@heartcode
Copy link
Owner

Wonderful idea, thanks!
I will definitely implement this in the next release :)

Thanks for your feedback, I much appreciate it.

@heartcode
Copy link
Owner

Feature added on develop branch, soon should be on master: https://github.com/heartcode/CanvasLoader/tree/develop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants