Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.
My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.
animator = Util::PositionAnimation.new({:x => 15, :y => 20}, {:x => 30, :y => 60}, 40)
#the line above says, create an animator which goes from (x = 15 & y = 20) to (x = 30 & y = 60) in 40 hops
#hops are always equidestent(so if used to fetch the coordinates for updating, this will give a constant velocity motion effect
animator.start
#suppose we have a window, which updates his coordinates via update method(which gosu calls before render)....
#the code in update method will look like this...
def update
x, y = animator.hop
end
#and then in render this x and y can be used to render the image @ the right place.
#MORE USE-CASES.....
animator = Util::PositionAnimation.new({:x => 15, :y => 20}, {:x => 30, :y => 60}, 40, true)
#the above line creates an animator which plays the animation both sides 20 hops forward and 19 backwards
#(which essentially means, it comes to its initial position) @ the end
animator = Util::PositionAnimation.new({:x => 15, :y => 20}, {:x => 30, :y => 60}, 40, false, {40 => lambda { puts "40% complete"}, 65 => lambda {puts "65% complete"}})
#the line above, registers 2 callbacks with the animation, which will be executed when the animation has run beyond the key's percent value.
# experiment with it, to understand it better.....
animator.start #will reset the animation, so that its ready to run again....
#so every time it need to be run... it need not be a fresh instance....
#take a look @ http://github.com/janmejay/bakery/tree/master for details(test case is a decent documentation for how it works....) feel free to re-use it... :-)