Questions tagged [uikit-dynamics]

UIKit Dynamics is a feature introduced in iOS 7 that enables dynamic behaviors, which offers a way to enhance the user experience by incorporating real-world behaviors and characteristics, such as gravity, into your animations.

UIKit Dynamics is "a composable, reusable, declarative, real-world inspired animation, and interaction system" (as described in WWDC 2013 video, Getting Started with UIKit Dynamics).

Any object that conforms to the UIDynamicItem protocol, such as UIView objects, can be associated with "behaviors" that can be added to a dynamic animator, a UIDynamicAnimator. These behaviors include forces, elasticity, gravity, collisions, etc.

The types of behavior objects which can be added to the UIDynamicAnimator object include UIAttachmentBehavior, UICollisionBehavior, UIDynamicItemBehavior, UIGravityBehavior, UIPushBehavior, and UISnapBehavior. You can also combine these behaviors together or create your own custom dynamic behaviors.

UIKit Dynamics is not designed to replace Core Animation or UIView animations, but is designed to offer another mechanism to easily create more interactive and dynamic animations with less code. Likewise, UIKit Dynamics is not intended to replace SpriteKit, which might be better suited for many games.

Resources:

Related tags:

203 questions
3
votes
1 answer

Custom UIDynamicBehavior: how do I know the total number of animation steps/ticks?

I'd like to implement a custom UIDynamicBehavior that makes a view "burst". To do that I need to fade it out and scale it to 2x its size. I do this by setting the view's alpha and bounds in the action block. However, how do I know how often the…
Mark
  • 6,647
  • 1
  • 45
  • 88
3
votes
4 answers

Rubber like bouncy button with UIKit dynamics

I would like to create a rubber-like button in my iOS app: when the user taps the button it would shrink its frame and when the user releases the tap it would grow, expand a bit and then turn back to its original size with a bouncing effect just…
MrTJ
  • 13,064
  • 4
  • 41
  • 63
3
votes
1 answer

How do I make my view that is being manipulated by UIPushBehavior not rotate as much? It's an absurd amount

Right now, I have a UIPushBehavior that I use on a view to push it off screen depending on where the user touched with a UIPanGestureRecognizer. It works, but my problem is the view rotates an absurd amount... like it's attached to the tire of a…
Doug Smith
  • 29,668
  • 57
  • 204
  • 388
3
votes
1 answer

UICollisionBehavior - custom shape for UIView collision

I'm trying to figure out how to use UIKit Dynamics to successfully collide two UIViews which have custom boundary shapes. The most basic example I can think of to explain my question is to have two circles collide (taking in to account their round…
Adam Carter
  • 4,741
  • 5
  • 42
  • 103
3
votes
1 answer

How can I speed up UISnapBehavior?

I can easily make the snapping slower by adding a UIDynamicItemBehavior with resistance. However, the default value for resistance is 0.0, which is still too slow for me. Setting the resistance to a negative value has no effect, it seems move as…
Hunkpapa
  • 724
  • 5
  • 17
3
votes
4 answers

UIDynamicKit with attachment and push behaviour causes long oscillation time

I am just starting to use the UIDynamic kit and have followed examples online. I have achieved the behaviour I want, which is for a view to recieved an instantaneous force in a direction and spring back to the original spot. I achieved this using…
noRema
  • 559
  • 5
  • 13
3
votes
1 answer

Is it possible to know when [UIDynamicItemBehavior addLinearVelocity:forItem:] has finished running?

I'm using a UIPanGestureRecognizer and UIAttachmentBehavior to move a UIView around the screen. When the user ends the gesture I apply the velocity of the gesture recognizer to the view using a UIDynamicItemBehavior and the…
Reid Main
  • 3,394
  • 3
  • 25
  • 42
2
votes
0 answers

What corresponds to UIKit Dynamics in SwiftUI?

I'm specifically interested in electricField() and magneticField(). Is there any similar SwiftUI library?
h4master
  • 31
  • 3
2
votes
1 answer

What’s difference between UIKit Dynamics and UIKit Animation?

What is the most essential difference between UIKit Dynamics and UIKit Animation at the animation level? There is not a lot of information about UIKit Dynamic. I don't know much about it. I just know how to use it. I think this question is related…
holaux
  • 96
  • 3
2
votes
0 answers

Why sometimes the View pass through the boundary?

I have a square view , when I drop it sometimes pass through a boundary of a line , if the line is horizontal there is no problem , but some position of it cause the problem. Here is my codes: square = UIView(frame: CGRect(x: 100, y: 30, width:…
Hassan Taleb
  • 2,350
  • 2
  • 19
  • 24
2
votes
0 answers

What is this? UIView's border line or shadow? And how to remove it from the background?

I'm creating a dynamic animation system(UIKit Dynamics) with an object orbiting around a point (the center of the orbit). Radial gravity and Vortex, 2 simultaneous forces make the blue object orbit around the yellow object. They are UIFieldBehavior…
Vitya Shurapov
  • 2,200
  • 2
  • 27
  • 32
2
votes
1 answer

UICollisionBehaviorDelegate methods not called

I worked on an app and implemented collision detection using UIKitDynamics. Collision detection is working. But somehow the UICollisionBehaviorDelegate methods are not called. No warnings or errors are shown. I created an example project to…
user610246
  • 732
  • 1
  • 7
  • 11
2
votes
1 answer

UIKit Dynamics with pan, rotate and pinch gesture

I have added UIDynamics to imageview and used pan gesture for that. It is working fine with pan gesture but when I apply pinch gesture with that it is not working. It is showing large imageview but when I start dragging then it is changed to…
Hardik Halani
  • 290
  • 2
  • 12
2
votes
1 answer

Using UIDynamics gravity to animate CGRects

My goal is to have a bunch of UIViews that have a property of CGRect falling from offscreen and then piling up. Right now, I have one circle working, but every time I try to add another circle, they won't animate anymore. I am using UIDynamics and…
Theo Strauss
  • 1,281
  • 3
  • 19
  • 32
2
votes
0 answers

Creating triangular UIRegions

I need to separate the screen into regions that look like this (separated by black lines): The documentation says Most regions are rectangular or elliptical in shape, but you can use the methods of this class to create more complex shapes by…
user
  • 352
  • 3
  • 13