Class: Fade

Inherits:
TransitionEffect show all
Defined in:
lib/rubysketch/solitaire/common/transitions.rb

Instance Attribute Summary

Attributes inherited from TransitionEffect

#phase

Attributes inherited from Scene

#name, #parent

Instance Method Summary collapse

Methods inherited from TransitionEffect

#activated

Methods inherited from Scene

#activated, #active?, #add, #deactivated, #emitParticle, #focusChanged, #mouseDragged, #mouseMoved, #mousePressed, #mouseReleased, #particle, #pause, #remove, #resized, #resume, #sprites, #transition, #update

Constructor Details

#initialize(*args, rgb: 0, **kwargs, &block) ⇒ Fade

Returns a new instance of Fade.



66
67
68
69
# File 'lib/rubysketch/solitaire/common/transitions.rb', line 66

def initialize(*args, rgb: 0, **kwargs, &block)
  super(*args, easeIn: :expoOut, **kwargs)
  @rgb, @alpha = rgb, 0
end

Instance Method Details

#drawObject



75
76
77
78
79
80
# File 'lib/rubysketch/solitaire/common/transitions.rb', line 75

def draw()
  super
  fill *@rgb, @alpha
  noStroke
  rect 0, 0, width, height
end

#effect(t) ⇒ Object



71
72
73
# File 'lib/rubysketch/solitaire/common/transitions.rb', line 71

def effect(t)
  @alpha = 255 * t
end