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

Create motio-jquery.js #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

miamarti
Copy link

jQuery Sprite Animation

[jquery-sprite-animation] Sprite Animation on jQuery

Bower install de dependency

$ bower install jquery-sprite-animation --save

HTML Page include

<script src="bower_components/jquery-sprite-animation/dist/jquery-sprite.min.js"></script>

Creating an animation

$(document).ready(function() {

    var config = {
        slide: 1,
        fps: 12,
        frames: 17,
        cycles: {
            '1': {
                url: 'assets/slides/slide01/Cycle-0.sprite.png'
            },
            '2': {
                url: 'assets/slides/slide01/Cycle-1.sprite.png'
            },
            '3': {
                url: 'assets/slides/slide01/Cycle-2.sprite.png'
            },
            '4': {
                url: 'assets/slides/slide01/Cycle-3.sprite.png'
            }
        },
        onPlay: function(){
        },
        onPause: function(){
        },
        onFrame: function(obj){
        }
    };
    $('.slide').sprite(config);
});

Methods

#play

Starts playing continuous animation that doesn't stop until interrupted by other methods.

$('.slide').play();

#Pause

Pauses the current animation.

$('.slide').pause();

#Toggle

Pauses when playing, resumes when paused.

$('.slide').toggle();

Based on Darsa Motion

jQuery Sprite Animation
===========
[jquery-sprite-animation] Sprite Animation on jQuery

<p>
  <img src="https://img.shields.io/badge/jquery--sprite--animation-release-green.svg">
  <img src="https://img.shields.io/badge/version-1.0.0-blue.svg">
  <img src="https://img.shields.io/bower/v/bootstrap.svg">
</p>

## Bower install de dependency
```
$ bower install jquery-sprite-animation --save
```

## HTML Page include
```
<script src="bower_components/jquery-sprite-animation/dist/jquery-sprite.min.js"></script>
```

## Creating an animation
```
$(document).ready(function() {
    
    var config = {
        slide: 1,
        fps: 12,
        frames: 17,
        cycles: {
            '1': {
                url: 'assets/slides/slide01/Cycle-0.sprite.png'
            },
            '2': {
                url: 'assets/slides/slide01/Cycle-1.sprite.png'
            },
            '3': {
                url: 'assets/slides/slide01/Cycle-2.sprite.png'
            },
            '4': {
                url: 'assets/slides/slide01/Cycle-3.sprite.png'
            }
        },
        onPlay: function(){
        },
        onPause: function(){
        },
        onFrame: function(obj){
        }
    };
    $('.slide').sprite(config);
});
```

## Methods

### #play
Starts playing continuous animation that doesn't stop until interrupted by other methods.
```
$('.slide').play();
```

### #Pause
Pauses the current animation.
```
$('.slide').pause();
```

### #Toggle
Pauses when playing, resumes when paused.
```
$('.slide').toggle();
```

## Based on Darsa Motion
- http://darsa.in/motio/
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

Successfully merging this pull request may close these issues.

1 participant