Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS MacFrameworks Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCocoa/NSAnimation test
This example is the version from Sat, 31th Aug 2012.
Project "NSAnimation test.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action()
a = new MoveAnimation(1.0, NSAnimationMBS.NSAnimationEaseInOut)
a.frameRate = 20
a.animationBlockingMode = a.NSAnimationNonblocking
a.c = label1
a.StartLeft = label1.Left
a.Starttop = label1.top
a.DistanceX = 100
a.DistanceY = 0
a.startAnimation
End EventHandler
End Control
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action()
a = new MoveAnimation(1.0, NSAnimationMBS.NSAnimationEaseInOut)
a.frameRate = 20
a.animationBlockingMode = a.NSAnimationNonblocking
a.c = label1
a.StartLeft = label1.Left
a.Starttop = label1.top
a.DistanceX = -100
a.DistanceY = 0
a.startAnimation
End EventHandler
End Control
Property a As MoveAnimation
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
Class MoveAnimation Inherits NSAnimationMBS
EventHandler Sub CurrentProgressChanged(progress as double)
if DistanceY <> 0 then
c.top = StartTop + DistanceY * progress
end if
if DistanceX <> 0 then
c.left = StartLeft + DistanceX * progress
end if
End EventHandler
Property DistanceX As Integer
Property DistanceY As Integer
Property StartLeft As Integer
Property StartTop As Integer
Property c As RectControl
End Class
End Project
The items on this page are in the following plugins: MBS MacCocoa Plugin.