Added options to animations.throb

This commit is contained in:
Todd Werth
2013-09-25 21:38:01 -07:00
parent a2553f6ee7
commit b0e3b9d324
2 changed files with 10 additions and 8 deletions

View File

@@ -83,19 +83,21 @@ module RubyMotionQuery
end
# @return [RMQ]
def throb
def throb(opts = {})
opts.merge!({
duration: 0.4,
animations: -> (cq) {
cq.style {|st| st.scale = 1.0}
}
})
@rmq.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}
}
)
q.animate(opts)
}
)
end

View File

@@ -44,7 +44,7 @@ module RubyMotionQuery
def reapply_styles
selected.each do |selected_view|
if style_name = selected_view.rmq_data.style_name
apply_style_to_view selected_view, style_name
apply_style_to_view selected_view, style_name
end
end
self