Skip to content

Loads, plays, and provides control for flipbook style animations into Matt Rix's 2D Framework Plugin for Unity, Futile

Notifications You must be signed in to change notification settings

JustinHoldstock/FAnimation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 

Repository files navigation

This is a plugin for Matt Rix's Futile Framework, https://github.com/MattRix/Futile, that allows for animations to be loaded and played using FAnimSprite.

Naming Convention

The naming convention of all assets must be as follows: SpriteID-Animation-FrameNum-Delay

ie) SuperDude-Jump-1-60
SuperDude-Run-1-30
SuperDude-Run-2-30
SuperDude-Run-3-30

SpriteID will be parsed as a string to be used for referencing sprite data.

Animation will be parsed as a string for which animation set it belongs to. ** is optional **

Frame is parsed as an int to be used for sorting frame list ** is optional, needs to be implemented **

Delay will be parsed as a float value. indicates FPS for animation to be played at. ** optional, uses 60FPS by default **

Use

So, steps to use animations:
  1. Replace all Futile.atlasManager.LoadAtlas("path") with FAnimationManager.Instance.LoadAtlas("path");

2)FAnimSprite construtor takes in the SpriteID (outlined in the Naming Convention)
FAnimSprite mySprite = new FAnimSprite("SuperDude");

3)To change the animation of the asset call setAnimation("animationName")
mySprite.setAnimation("Run");

4)To change the atlas/id of a sprite, just use FAnimSprite.load("SpriteID");
//mySprite is currently using the SuperDude sprite data. next line changes it to use EvilDude images and data
mySprite.load("EvilDude");

Playback Speed

So, knowing that it's impossible to have enough control, I've added the ability to control the speed at which
animations are played, during runtime. If you want to speed them up during their playback, just use it like the
examples below.
//speeds up the animation playback by 2x
mySprite.PlaySpeed = 2.0f;
//slows the animation playback to half
mySprite.PlaySpeed = 0.5f;
//the default speed, as in the delta time added to the delay is unchanged
mySprite.PlaySpeed = 1.0f;

More To Come

-optimizations

-anything suggested by other users!

About

Loads, plays, and provides control for flipbook style animations into Matt Rix's 2D Framework Plugin for Unity, Futile

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages