Skip to content
This repository has been archived by the owner on Aug 21, 2019. It is now read-only.

tilpner/tween.rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tween.rs Build Status

This repository contains code that has not been properly tested yet, continue at the risk of doing stupid things while discovering parts of this library don't work.

Introduction

Games and other applications often have a need to change values smoothly, without the need for a fully-blown physics system. This is where Tweening (Inbe tween ing) comes in. It allows to interpolate between numerical values in a lightweight way.

This YouTube video is an interesting example of how the addition of animations (via tweens) can change the feeling of a game.

Example

See the examples.

Compiling and running images.rs should create .ppm files of all basic variations of tweens in the current directory.

More complex examples will (might) follow.

Features

  • Allows tweening of any type (via traits)
  • Multiple easing equations:
  • Linear
  • Quad
  • Cubic
  • Quart
  • Quint
  • Sine
  • Circular
  • Back
  • Elastic
  • Bounce
  • Easy to add own equations
  • Easing modes In, Out and InOut
  • Tween organization:
  • Sequential execution
  • Parallel execution
  • Pauses
  • Function execution
  • Repeated execution
  • Three value access modes:
  • via unsafe pointers
  • via Cell
  • via callback functions

Todo

  • Direct task launching
  • Making tweens Sendable?

Feedback and contribution

Feedback in any form is strongly desired. Either email me at ubrccare.gvyy@tznvy.pbz (rot-13 that), create an issue or ping me on IRC (nick: flan3002).

Thanks

Many thanks to eddyb, cmr, bjz, kimundi, mindslight, hoverbear, sfackler, and others from mozilla/#rust! Also thanks to lifthrasiir from reddit for helping me with a 'static problem.

Resources

For preview of the easing equations you may visit easings.net for an overview of different easings. Note that Expo is not implemented at time of writing.

About

(THIS IS OLD, MOVE ALONG) - A small tweening library written solely in Rust

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages