how to animate multiple uiview objects
yasirmturk opened this issue · comments
is there a way to animate multiple attributes of multiple uview objects using same motion duration delay etc.??? or in other words equivalent to UIView.animate
or
Motion.animate(duration: 0.3, animations: { view.translate(x: 0, y: 100) view2.rotate(50) })
You can do this:
v1.animate(.duration(1), .fadeOut)
v2.animate(.duration(3), .translate(x: 10))
The animation cycle will take the both of these in consideration and will also stack the animation if needed.
For UIView.animate ... all that actually does is allow the underlying layers to be animated. By default CALayers are animated when transitioning between property values. When using a UIView it disables that. So the UIView.animate function enables that once again. Give it a try and if you have any issues, please let me know :)
no there is no issue doing it this way.. i was just looking for way so that when i animate many ui components they start and end at exact same time
Yeah, set the duration to the same value and all should work :) Also, you can stack animations during an already animating view. So if you did this:
v1.animate(.duration(3), .spin(3))
v1.animate(.delay(1), .duration(1), .fadeOut)
That would work :)
great thanks