Class: TransitionEffect

Inherits:
Scene
  • Object
show all
Defined in:
lib/rubysketch/solitaire/common/transitions.rb

Direct Known Subclasses

Curtain, Fade, Pixelate

Instance Attribute Summary collapse

Attributes inherited from Scene

#name, #parent

Instance Method Summary collapse

Methods inherited from Scene

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

Constructor Details

#initialize(nextScene, sec: 1, secOut: nil, secIn: nil, easeOut: :expoOut, easeIn: :expoIn, showAd: false, &block) ⇒ TransitionEffect

Returns a new instance of TransitionEffect.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/rubysketch/solitaire/common/transitions.rb', line 6

def initialize(
  nextScene, sec: 1,
   secOut: nil,       secIn: nil,
  easeOut: :expoOut, easeIn: :expoIn,
  showAd: false,
  &block)

  super()
  @nextScene, @easeOut, @easeIn, @showAd, @block =
    nextScene, easeOut, easeIn, showAd, block
  @secOut = secOut || sec / 2.0
  @secIn  = secIn  || sec / 2.0
  @phase  = :out
end

Instance Attribute Details

#phaseObject (readonly)

Returns the value of attribute phase.



21
22
23
# File 'lib/rubysketch/solitaire/common/transitions.rb', line 21

def phase
  @phase
end

Instance Method Details

#activatedObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/rubysketch/solitaire/common/transitions.rb', line 26

def activated()
  super
  start do
    case @phase
    when :out
      sendCommand :showInterstitialAd if @showAd
      delay do
        pa = parent
        pa.remove self
        @phase = :in
        @nextScene.add self
        pa.transition @nextScene
        @block.call if @block
      end
    when :in
      parent.remove self
    end
  end
end

#effect(t) ⇒ Object



23
24
# File 'lib/rubysketch/solitaire/common/transitions.rb', line 23

def effect(t)
end