Splash

Splash

Abstract class representing a splash screen animation.

Constructor

new Splash(style, anim_options)

Source:
Version:
  • 2.0
Author:
Examples

Get started - Create instance example

// Instance
var splash = new Splash()
// Or instance with custom parameter
var splash = new Splash({background: 'rgba(0, 0, 0, 0.7)'}, {
        use: true,
        start: FancyAnimation.moveIn,
        end: FancyAnimation.rubberBand
    });
Parameters:
Name Type Description
style styler
anim_options animator

Methods

fromAnimation(animation, animation_time, options)

Source:
Since:
  • 2.0
Example

Pre build svg animation from SVGAnimation

// sample use
splash.fromAnimation(SVGAnimation.Rotate, 3000, {background: 'transparent'});
Parameters:
Name Type Description
animation SVGAnimation
animation_time Number
options styler

fromCSSAnimation(css_file, html, remove_css, duration)

Source:
#codepen = https://codepen.io/koffiisen/pen/wvBJgKR
Example
splash.fromCSSAnimation("custom-anim.css","<div id="loader-wrapper"><div id="loader"></div></div>");
Parameters:
Name Type Description
css_file String
html String
remove_css boolean
duration number

fromCustomNode(node, duration, option)

Source:
Example
var custom_node = document.createElement("div");
 custom_node.style.display = 'grid';

 var text = document.createElement("strong");
 text.innerText = "SPLASH";
 text.style.padding = "25px";

 var img = document.createElement("img");
 img.src = "https://s3.amazonaws.com/cdn.wp.m4ecnet/wp-content/uploads/2018/06/05041237/GitHub-logo-2-imagen.jpg";
 Object.assign(img.style, {
                width: '100px',
                height: '100px',
                'border-radius': '50%'
            });

 custom_node.appendChild(img);
 custom_node.appendChild(text);

 splash.fromCustomNode(custom_node, 5000, {
                color: 'red',
                'font-family': 'fantasy'
            });
Parameters:
Name Type Description
node Node => Ex: document.createElement('div');
duration Number
option Object

fromHtml(html, duration, option)

Source:
Examples
// default call
splash.fromHtml("<h3 style='color: #e0a800'>HTML SPLASH</h3>");
// or with custom parameter
splash.fromText("<h3>HTML SPLASH</h3>", 5000, {
        color: 'red',
        'font-family': 'fantasy'
    })
Parameters:
Name Type Description
html String
duration Number
option Object

fromImage(image, duration, option)

Source:
Example
//=> url | base64 => based on html <img>
splash.fromImage("https://s3.amazonaws.com/cdn.wp.m4ecnet/wp-content/uploads/2018/06/05041237/GitHub-logo-2-imagen.jpg", 5000, {
    width: '130px',
    height: '130px',
    'border-radius': '20%'
    });
Parameters:
Name Type Description
image String
duration Number
option Object

fromText(text, duration, option)

Source:
Examples
// default call
splash.fromText("MY SPLAH SCREEN");
// or with custom parameter
splash.fromText("SPLASH SCREEN", 5000, {
        color: 'red',
        'font-family': 'fantasy'
    })
Parameters:
Name Type Description
text String
duration Number
option Object

indeterminateLoad(splash, callback) → {function}

Source:
Example
var indeterminate = () => {
    //splash.fromText("<h3 style='color: #e0a800'>CUSTOM SPLASH</h3>")
    splash.fromCSSAnimation('custom-anim.css',
        '<div id="loader-wrapper">\n' +
        '     <div id="loader"></div>\n' +
        '</div>', false
    );
};

 splash.indeterminateLoad(indeterminate, function (callback) {
    var stop = callback;
    console.log(self);
    setTimeout(function () {
        console.log("stop execute");
        stop();
    }, 12000);
});
Parameters:
Name Type Description
splash function
callback function
Returns:
- to stop animation
Type
function