Module: RubySketch

Defined in:
lib/rubysketch.rb,
lib/rubysketch/all.rb,
lib/rubysketch/shape.rb,
lib/rubysketch/sound.rb,
lib/rubysketch/sprite.rb,
lib/rubysketch/context.rb,
lib/rubysketch/easings.rb,
lib/rubysketch/extension.rb,
lib/rubysketch/graphics_context.rb

Defined Under Namespace

Modules: GraphicsContext Classes: Circle, Context, Shape, Sound, Sprite, SpriteWorld

Constant Summary collapse

Vector =
Processing::Vector
Image =
Processing::Image
EASINGS =
{
  linear: -> x {x},

      sineIn: -> x {1.0 - Math.cos(x * pi_div2)},
      quadIn: -> x {x ** 2.0},
     cubicIn: -> x {x ** 3.0},
     quartIn: -> x {x ** 4.0},
     quintIn: -> x {x ** 5.0},
      expoIn: -> x {x == 0 ? 0.0 : 2.0 ** (10.0 * x - 10.0)},
      circIn: -> x {1.0 - Math.sqrt(1.0 - x ** 2.0)},
      backIn: -> x {c3 * x ** 3.0 - c1 * x ** 2.0},
   elasticIn: elasticIn,
    bounceIn: -> x {1.0 - bounceOut[1.0 - x]},

     sineOut: -> x {Math.sin(x * pi_div2)},
     quadOut: -> x {1.0 - (1.0 - x) ** 2.0},
    cubicOut: -> x {1.0 - (1.0 - x) ** 3.0},
    quartOut: -> x {1.0 - (1.0 - x) ** 4.0},
    quintOut: -> x {1.0 - (1.0 - x) ** 5.0},
     expoOut: -> x {x == 1 ? 1.0 : 1.0 - 2.0 ** (-10.0 * x)},
     circOut: -> x {Math.sqrt(1.0 - (x - 1.0) ** 2.0)},
     backOut: -> x {1.0 + c3 * (x - 1.0) ** 3.0 + c1 * (x - 1.0) ** 2.0},
  elasticOut: elasticOut,
   bounceOut: bounceOut,

     sineInOut: -> x {-(Math.cos(pi * x) - 1.0) / 2.0},
     quadInOut: -> x {x < 0.5 ?  2.0 * x ** 2 : 1.0 - (-2.0 * x + 2.0) ** 2.0 / 2.0},
    cubicInOut: -> x {x < 0.5 ?  4.0 * x ** 3 : 1.0 - (-2.0 * x + 2.0) ** 3.0 / 2.0},
    quartInOut: -> x {x < 0.5 ?  8.0 * x ** 4 : 1.0 - (-2.0 * x + 2.0) ** 4.0 / 2.0},
    quintInOut: -> x {x < 0.5 ? 16.0 * x ** 5 : 1.0 - (-2.0 * x + 2.0) ** 5.0 / 2.0},
     expoInOut: expoInOut,
     circInOut: circInOut,
     backInOut: backInOut,
  elasticInOut: elasticInOut,
   bounceInOut: bounceInOut
}.freeze