Giter Site home page Giter Site logo

jquery-sakura's Introduction

jQuery Sakura

Make it rain - sakura petals or anything else for that matter.

Uses CSS3 animations and requestAnimationFrame to put a plethora of cherry blossom petals that drift and sway in the "wind" on your site.

Sakura Animation

Installation

Download and add the files to your asset folder(s), be sure to use the right paths when including the files in your site.

Basic Usage

Simply include both the css and js file in your HTML and run the sakura() function added by this plugin on domReady or windowLoad:

<!-- In your HTML head -->
<link type="text/css" rel="stylesheet" media="screen" href="/css/jquery-sakura.min.css" />

<!-- End of your HTML body -->
<script src="/js/jquery-sakura.min.js"></script>
<script>
    // domReady
    $(function() {
        $('body').sakura();
    });

    // windowLoad
    $(window).load(function() {
        $('body').sakura();
    });
</script>

If you ever want or need to disable the generation of the petals, run the method again, passing the event name 'stop' to the function:

$('#stop_sakura').on('click', function() {
    $('body').sakura('stop');
});

Configuration

You're able to change some parameters by passing an option object to the sakura function:

$(window).load(function() {
    $('body').sakura('start', {
        blowAnimations: [
            'blow-soft-left',
            ...
        ],                   // Horizontal movement animation names
        className: 'sakura', // Class name to use
        fallSpeed: 1,        // Factor for petal fall speed
        maxSize: 14,         // Maximum petal size
        minSize: 9,          // Minimum petal size
        newOn: 300,          // Interval after which a new petal is added
        swayAnimations: [    // Swaying animation names
            'sway-0',
            ...
        ]
    });
});

Live Demo

You can view a live preview of the most recent version of the plugin here.

Credits

Originally thought up and commissioned by Naomi Forame.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.