This blog uses responsible cookies for functionality and user preferences.
Google Analytics is used for collecting general public information to understand how my blog is used.
Learn moreDear visitors,
This blog and the Tigarus.com network will be changing our website software in May (2024). There will be some down time and there will be a change to the webpage addresses.
We will also be removing the Anime blogs. The Rocksmith Songs website will be unavailable of a few weeks or months while I move the database to the new software.
At the moment we are running on Wordpress, the new software is an in-house project which is 57 times faster. It will also provide more freedom for development.
Thank you for understanding.
Script Title: simpleSpriteSheet
Programming Language: Java Script
Date Completed: 2012/09/24
Purpose: To display a sprite sheet animation style system for animation and 2D game development. Simple sheet system allows for a horizontal or vertical sprite sheet to be displayed like animation or display a select frame.
Description: Simple sprite sheet style system for animation or displaying a select frame. Allows for a horizontal or vertical sprite sheet to be used. Similar properties and functions to Action Scripting, with play(), gotoAndPlay(), etc.
Compatibility: Works with all Web browsers
Methods:
var class = new simpleSpriteSheet();
Properties
class.img;Set image source of sprite sheet
class.targetId;Set the element ID to assign to
class.horizontal;Default false, Set true if the sprite sheet is horizontal
class.vertical;Default false, Set true if the sprite sheet is vertical
class.height;Set the height in pixels of the sprite area
class.width;Set the width in pixels of the sprite area
class.totalFrames;Set the total number of sprite on the sheet
class.frameRate;Default 60, Set the frame rate when played
class.current;Default 1, Set or return the current frame
class.playOnce;Default false, Set true to play only onceFunctions
class.create();Assign and initialize sprite sheet for use
class.play();Play sprite sheet animation
class.pause();Pause sprite sheet animation
class.stop();Stop sprite sheet animation, back to frame one
class.gotoAndStop( int );Go to frame and don’t play animation
class.gotoAndPlay( int );Go to frame and play animation
Example Horizontal Sprite Sheet:
Example Frame 3:
Example Usage:
HTML
<div id=”instance0″></div>
Java Script
instance0 = new simpleSpriteSheet();
instance0.horizontal = true;
instance0.width = 200;
instance0.height = 200;
instance0.current = 1;
instance0.totalFrames = 4;
instance0.frameRate = 4;
instance0.img = “sheet-1.jpg”;
instance0.targetId = “instance0”;
instance0.create();
instance0.play();
Terms of Use, Cookies, Privacy, and more, see Terms and Privacy
Third-party copyrights and trademarks featured on this site are owned by their respected holders.
Website written and designed by Patcoola 2019, some rights reserved.
This blog uses responsible cookies for functionality and user preferences.
Google Analytics is used for collecting general public information to understand how my blog is used.
Learn moreDear EU visitor, I am required to ask you consent for the following.