Module: Metro::SceneTransitions

Extended by:
SceneTransitions
Included in:
SceneTransitions
Defined in:
lib/metro/transitions/scene_transitions.rb

Instance Method Summary collapse

Instance Method Details

#find_transition(name) ⇒ Object



22
23
24
25
# File 'lib/metro/transitions/scene_transitions.rb', line 22

def find_transition(name)
  transition_name = supported_transitions[name]
  transition_name.constantize
end

#generate_transition(name, next_scene, options) ⇒ Object



15
16
17
18
19
20
# File 'lib/metro/transitions/scene_transitions.rb', line 15

def generate_transition(name,next_scene,options)
  transition = find_transition(name).new
  transition.next_scene = next_scene
  transition.options = options
  transition
end

#insert_transition(scene, options) ⇒ Object Also known as: filter



7
8
9
10
11
# File 'lib/metro/transitions/scene_transitions.rb', line 7

def insert_transition(scene,options)
  return scene unless options.key?(:with)
  name = options[:with]
  generate_transition(name,scene,options)
end

#supported_transitionsObject



27
28
29
30
31
32
33
# File 'lib/metro/transitions/scene_transitions.rb', line 27

def supported_transitions
  @supported_transitions ||= begin
    hash = HashWithIndifferentAccess.new("Metro::FadeTransitionScene")
    hash[:edit] = "Metro::EditTransitionScene"
    hash
  end
end