Sha256: 654e46ad3a7f7385fa0a340f9349315f62d9e063448a624a684438bfa3c31c13

Contents?: true

Size: 607 Bytes

Versions: 1

Compression:

Stored size: 607 Bytes

Contents

motion_require "base"

=begin
  {
    from: 0.0,
    to: 0.8
  }
=end

module Walt
  module Operation
    class FadeOperation < Base
      PROPERTIES = [:from, :to]
      attr_accessor *PROPERTIES

      def initialize(params = {})
        super

        params.each do |key, value|
          if PROPERTIES.include?(key.to_sym)
            self.send("#{key}=", value)
          end
        end
      end

      def setup(view, animation)
        if self.from
          view.alpha = self.from
        end
      end

      def finalize(view, animation)
        view.alpha = self.to
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
walt-0.1.2 lib/walt/operation/fade.rb