Class: Curtain

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) ⇒ Curtain

Returns a new instance of Curtain.



87
88
89
90
91
# File 'lib/rubysketch/solitaire/common/transitions.rb', line 87

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

Instance Method Details

#drawObject



101
102
103
104
105
106
# File 'lib/rubysketch/solitaire/common/transitions.rb', line 101

def draw()
  super
  fill *@rgb
  noStroke
  rect 0, @y, width, @h
end

#effect(t) ⇒ Object



93
94
95
96
97
98
99
# File 'lib/rubysketch/solitaire/common/transitions.rb', line 93

def effect(t)
  @y, @h =
    case phase
    when :out then [height * (1.0 - t), height]
    when :in  then [0,                  height * t]
    end
end