move_relative(obj, (b[2] / 2) - (a[2] / 2),
(b[3] / 2) - (a[3] / 2))
end
-
- def alpha=(alpha)
- set_color(*(get_color[0..-2] << alpha))
- end
end
module Embrace
class AlphaAnimator < ZeroToOneAnimator
def initialize(duration, object)
super(duration) do |v|
- object.alpha = compute_alpha(v)
+ a = compute_alpha(v)
+ object.set_color(a, a, a, a)
end
end
@objects = [@img, @label]
@objects.each { |o| add_member(o) }
- set_color(255, 255, 255, 0)
- @img.set_color(255, 255, 255, 0)
- @label.set_color(255, 0, 0, 0)
+ set_color(0, 0, 0, 0)
@img.set_file(ICON_FILE)
@img.set_fill(0, 0, *@img.get_size)
end
def smart_color_set(r, g, b, a)
- @objects.each { |o| o.alpha = a }
+ @img.set_color(r, g, b, a)
+ @label.set_color(r, 0, 0, a)
end
end