Giter Club home page Giter Club logo

jquery.phantascope's Introduction

Phantascope

A jQuery plugin for animating sprites.

Usage

  1. Phantascope has only dependancy; jQuery. You can download your own copy of jQuery at http://jquery.com or link to the Google hosted script:
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js"></script>
  1. Download and include Phantascope in your document as well:
<script src="jquery.phantascope.js"></script>
  1. Call the Phantascope function in your document ready function, parsing in the required options for your animation
$(document).ready(function() {
  $('.sprite').phantascope({
    optionName: value
  });
});
  1. Enjoy super sweet frame based animations on you webpage!

Options

Option Type Default Description
fps Int 24 The number of frames per second the animation should run at.
layout Array [6] An array containing the number of frames on each row of the sprite. The default describes a sprite containing one row of six frames.

For example, a sprite sheet consisting of three rows, the first two containing six frames and the last row containing four frames would be described as: [6,6,4]
animationPoints Array [
  [1,1],
  [1,6]
]
The points through which the animation will play. Each point is an array, the first value refering to the column, the second to the row.

This default value will play from the first frame to last frame (based upon the default layout of six frames on one row). You can use as many points as you want, and the animation can play either forward or backwards.

For example, to update the current animation to reverse and play back to the start you would parse these settings: [[1,1], [1,6], [1,1]].
loop Int/String 1 Number of times the animation should loop. For an infinite loop use the string "*".
autoStart Boolean false Whether to play the animation upon initialisation.
resetAtEnd Boolean false When complete reset the sprite to the starting frame.
onComplete Function null Callback fired when the animation is complete.

Methods

Method can be called using the following syntax: $('.sprite').spritely("methodName", params). An example of this would be: $('.sprite').spritely("play", {fps: 30, animationPoints: [[6,1],[1,1]]});

Method Parameters Description
play options (object) Start playing the animation from it's current point. You can also update any of the settings of that animation with the options above.
update options (object) Update any of the settings of that animation with the options above.
gotoFrame point (array) Move to the specified frame
pause none Pause the animation
stop none Stop the animation
destroy none Remove all plugin functionality from the element

Bugs

This project is still in beta so please inform me of any bugs you find here: [email protected]

I hope you enjoy using this plugin!

jquery.phantascope's People

Contributors

barneyfoxuk avatar

Watchers

James Cloos avatar dmirtyisme avatar

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.