Sha256: 0a82494bbfaf2d276af36c68b4984d6f73cb56cec0af5ac776babfb1cf725a29

Contents?: true

Size: 863 Bytes

Versions: 2

Compression:

Stored size: 863 Bytes

Contents

module Browser; class Event

class Animation < Event
  def self.supported?
    Browser.supports? 'Event.Animation'
  end

  class Definition < Definition
    def animation=(value)
      `#@native.animationName = #{value}`
    end

    def elapsed=(value)
      `#@native.elapsedTime = #{value}`
    end
  end

  if Browser.supports? 'Event.constructor'
    def self.construct(name, desc)
      `new AnimationEvent(#{name}, #{desc})`
    end
  elsif Browser.supports? 'Event.create'
    def self.construct(name, desc)
      %x{
        var event = document.createEvent("AnimationEvent");
            event.initAnimationEvent(name, desc.bubbles, desc.cancelable,
              desc.animationName, desc.elapsedTime);

        return event;
      }
    end
  end if supported?

  alias_native :name, :animationName
  alias_native :elapsed, :elapsedTime
end

end; end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
diamonds-0.1.5 lib/diamonds/opal/browser/event/animation.rb
opal-browser-0.2.0 opal/browser/event/animation.rb