Animating
The most basic:
find.animate do
find(UIButton).nudge r: 40
end
A better way to do that is select something first. In this case q
is an RMQ instance selecting all UIButtons:
find(UIButton).animate do |q|
q.nudge r: 40
end
Some more options, this time it is animating a selected view:
find(my_view).animate(
duration: 0.3,
animations: lambda{|q|
q.move left: 20
}
)
# As an example, this is the implementation of .animations.throb
find(selectors).animate(
duration: 0.1,
animations: -> (q) {
q.style {|st| st.scale = 1.1}
},
completion: -> (did_finish, q) {
q.animate(
duration: 0.4,
animations: -> (cq) {
cq.style {|st| st.scale = 1.0}
}
)
}
)
# You can pass any options that animateWithDuration allows: options: YOUR_OPTIONS
Built-in animations
find(my_view).animations.fade_in
find(my_view).animations.fade_in(duration: 0.8)
find(my_view).animations.fade_out
find(my_view).animations.fade_out(duration: 0.8)
find(my_view).animations.blink
find(my_view).animations.throb
find(my_view).animations.sink_and_throb
find(my_view).animations.land_and_sink_and_throb
find(my_view).animations.drop_and_spin # has optional param 'remove_view: true'
find(my_view).animations.slide_in # default from_direction: :right
find(my_view).animations.slide_in(from_direction: :left) # acceptable directions :left, :right, :top, :bottom
find(my_view).animations.slide_out # default to_direction: :left, also accepts :right, :top, and :bottom
find(my_view).animations.slide_out(remove_view: true) # removes the view from superview after animation
find(my_view).animations.slide_out(to_direction: :top, remove_view: true) #combining options example
find.animations.start_spinner
find.animations.stop_spinner
Fade In
Fade Out
Blink
Throb
Sink and Throb
Land and Sink and Throb
Drop and Spin
Slide In