1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#
#  MoveController.rb
#  movebutton
#
#  Created by Erik Kastner on 11/22/07.
#  Copyright (c) 2007 __MyCompanyName__. All rights reserved.
#

require 'osx/cocoa'

# code by Jay Phillips - ninja
class OSX::NSAnimationContext
  class << self
    def with_animation_property_group
      beginGrouping
      yield currentContext
      endGrouping
    end
  end
end

class MoveController < OSX::NSObject
  ib_outlet :button, :image
  ib_action :move do
    OSX::NSAnimationContext.with_animation_property_group do |context|
      context.duration = 30.0
      @button.animator.setFrameOrigin([30,30])
    end
  end
end