Class: Shoes::Swt::Animation

Inherits:
Object
  • Object
show all
Defined in:
shoes-swt/lib/shoes/swt/animation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dsl, app) ⇒ Animation

An Swt animation implementation

Parameters:



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'shoes-swt/lib/shoes/swt/animation.rb', line 12

def initialize(dsl, app)
  @dsl = dsl
  @app = app

  # Wrap the animation block so we can count frames.
  # Note that the task re-calls itself on each run.
  @task = proc do
    unless animation_removed?
      run_animation unless @dsl.stopped?
      schedule_next_animation
    end
  end
  schedule_next_animation
end

Instance Attribute Details

#taskObject (readonly)

Returns the value of attribute task.



6
7
8
# File 'shoes-swt/lib/shoes/swt/animation.rb', line 6

def task
  @task
end

Instance Method Details

#eval_blockObject



27
28
29
# File 'shoes-swt/lib/shoes/swt/animation.rb', line 27

def eval_block
  @dsl.blk.call(@dsl.current_frame)
end