Class: CustomEasing

Inherits:
Metro::Easing show all
Defined in:
lib/templates/game/lib/custom_easing.rb

Overview

This custom easing is an exact copy of the ‘Ease In’ easing defined in Metro. It is present here as an example.

Class Method Summary collapse

Methods inherited from Metro::Easing

calculate, easing_for, easings, register

Class Method Details

.calculation(moment, start, change, interval) ⇒ Float

Returns the value at the particular moment of the interval.

Parameters:

  • moment (Float)

    the point in time within the interval. For example for a 60 tick interval, this would be the values 0, 1, 2, 3, 4, 5, 6, … 59.

  • start (Float)

    the starting value of the property

  • change (Float)

    the final value for the property

  • interval (Float)

    the total length of the interval

Returns:

  • (Float)

    the value at the particular moment of the interval



26
27
28
29
# File 'lib/templates/game/lib/custom_easing.rb', line 26

def self.calculation(moment,start,change,interval)
  # @note this is the exact same as the already defined Ease In
  change * (moment = moment / interval) * moment + start
end