Sha256: 5aa99ac6371068bac40281d0a9025c0c11322e6e660965a79fb2964463d90e57

Contents?: true

Size: 810 Bytes

Versions: 2

Compression:

Stored size: 810 Bytes

Contents

module Joybox
  module Actions

    class Twirl

      def self.defaults
        {
          duration: 0.3,
          twirls: 1,
          amplitude: 3
        }
      end

      def self.with(options = {})
        # Todo print error message on the console
        return unless options.has_key? :grid_size

        options = options.nil? ? defaults : defaults.merge!(options)
        position = options.delete(:position) || [Common::Screen.half_width, Common::Screen.half_height]
        CCTwirl.actionWithPosition(position,
                                   twirls: options[:twirls],
                                   amplitude: options[:amplitude],
                                   grid: options[:grid_size],
                                   duration: options[:duration])
      end

    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
joybox-1.1.1 motion/joybox/actions/twirl.rb
joybox-1.1.0 motion/joybox/actions/twirl.rb