Project

tsuku

0.0
No commit activity in last 3 years
No release in over 3 years
A tweening library made with Ruby
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.15
~> 3.5.0
~> 10.0
~> 3.0
 Project Readme

tsuku

A tweening tool written in Ruby

Installation

Add this line to your application's Gemfile:

gem 'tsuku'

And then execute:

$ bundle

Or install it yourself as:

$ gem install tsuku

Usage

The recommended way to use Tsuku is to interface with the Tweener class. First, make sure to call the step method in your main update loop. You will need to provide the number of milliseconds that have elapsed since the previous frame:

def game_update_loop
    ...
    
    Tweener.step(delta_ms)

    ...
end

Then use add_tween to create tweens as needed. For example, this tween changes the player's x and y coordinates over a span of 3000 milliseconds:

Tweener.add_tween(player, { x: 10, y: 5 }, 3000)

Any tweens created with Tweener will start and be cleaned up automatically. If you need greater control, you can create a Tween manually like so:

@tween = Tsuku::Tween.new(player, { x: 10, y: 5 }, 3000)
@tween.start

Now in your game update loop, advance the tween by calling its step method:

@tween.step(delta_ms)

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/jtuttle/tsuku.

License

The gem is available as open source under the terms of the MIT License.