module UnderOs::UI::Animation
Public Instance Methods
animate(style, options={}, &block)
click to toggle source
# File lib/under_os/ui/utils/animation.rb, line 3 def animate(style, options={}, &block) if block_given? options = style style = nil else [:complete, :curve, :autoreverse, :repeat, :duration, :delay].each do |key| options[key] = style.delete(key) if style.has_key?(key) end block = Proc.new{ self.style = style } end Animation.new(self, options, &block) self end
fade_in(options={})
click to toggle source
# File lib/under_os/ui/utils/animation.rb, line 27 def fade_in(options={}) animate({opacity: 1}, options) end
fade_out(options={})
click to toggle source
# File lib/under_os/ui/utils/animation.rb, line 31 def fade_out(options={}) animate({opacity: 0}, options) end
highlight(color=:yellow, options={})
click to toggle source
# File lib/under_os/ui/utils/animation.rb, line 20 def highlight(color=:yellow, options={}) old_color = style.background animate({background: color}, {curve: :ease_out}.merge(options)) animate({background: old_color}, {curve: :ease_in}.merge(options)) end