UIView Animation like Periscope app - ios

I want to re-create the animation that exists in the "Periscope" app.
In the app the user presses the screen and small hearts goes from the button right of the screen half way the the top and disappears from the screen.
I was wondering what would be the most efficient way of implementing this?
UIView animations / UIKit Dynamics / CABasicAnimation?
This is a screen shot from the app
Thanks,

You could create such an effect quite easily with particles in SpriteKit. It's exactly designed for creating such effects, especially in games, but it is also usable in normal apps. The interesting class is SKEmitterNode.
The official doc is here:
https://developer.apple.com/library/ios/documentation/SpriteKit/Reference/SKEmitterNode_Ref/index.html

Since UIKit Dynamics is a physics engine which is integrated to the UIkit it provides a option to create interface that feel real by adding behaviors such as gravity, attachments (springs) and forces. Also you can define the physical traits that you would like your interface elements to adopt. Where as UIView has most powerful animatable property which takes a CGAFFineTransform. This is a matrix that expresses how each pixel of the UIView should be modified, applying some math formulas.
Pl. check the below links, which has very good examples of UIKit dynamics and Animation and what features can be acheived. I feel it might be good option to use UIKit dynamics because of the flexibility it provides. http://www.sitepoint.com/using-uikit-dynamics-swift-animate-apps/
http://www.bignerdranch.com/blog/uidynamics-in-swift/
http://mathewsanders.com/prototyping-iOS-iPhone-iPad-animations-in-swift/

Related

Have someone ever seen those Interface Builder properties 'Opaque' and 'Clears Graphics Context' work?

I am scanning my whole project disabling anything that can be disabled to speed the application. For example, the user interaction property of views that don't need to respond to touches and things like that. I know the gain will be minimum but anyway, allow me to do that. 😃
Looking at what stuff I can turn OFF, I see these properties called Opaque and Clears Graphics Context, that I know for a long time, on all views.
I develop for iOS since 2008, initially creating everything programmatically and extensively using Interface Builder since the storyboards were created.
Said that, I have realized that I never saw these properties Opaque or Clears Graphics Context produce any difference at all, despite their states.
For example: I have created this UIButton now that uses a background image. The image has a semi opaque shadow. I set the button's Opaque and Clears Graphics Context properties on/off and there is no difference on Interface Builder and no difference when the app runs.
I know what Apple say these properties in theory but thinking about them now, I realize that I never saw any of them produce any difference at all, despite their state, even when I used to create views programmatically.
Can you guys give some example of codes where the status of these properties will make an effect?
opaque views are quicker to draw as no compositing is required. This makes little difference for static views but on UITableViews / UIScrollViews / UICollectionViews or in animation where views must "move" this can be the difference between 60fps and poor performance.
Apple have covered this topic in past free WWDC videos on performance. UIVisualEffectViews, which are transparent AND blur the background, can cause a big performance hit, for instance.
Below are links to free WWDC videos that reference graphics / UI performance; there are definitely more WWDC CAAnimation / SpriteKit videos but the ones below specifically cover performance.
WWDC 2012:
Optimizing 2D Graphics and Animation Performance: https://developer.apple.com/videos/play/wwdc2012/506/ (talks about opaque; includes example of using instruments to debug an app for better performance)
iOS App Performance: Graphics and Animations: https://developer.apple.com/videos/play/wwdc2012/238/ (smooth animations and scrolling)
WWDC 2014:
Advanced Graphics and Animations for iOS Apps: https://developer.apple.com/videos/play/wwdc2014/419/ (UIVisualEffects; includes example of using instruments to debug an app for better performance)

Apple Music genre selection screen

Does anybody have an idea how the genre selection bubbles in Apple music were made? The movement seems to be done with UiKit Dynamics. I definitely see collision behaviors but can't seem to reproduce the fluidity of the drag movement and the gravity towards the center of the view. I tried using UIPushBehavior and UiSnapBehavior, but no luck.
I don't think that it was done with UIKit Dynamics, I think they was using SpriteKit.
I created a component that's can simulate similar physics
https://github.com/ProudOfZiggy/SIFloatingCollection_Swift
It is possible with UIKitDynamics as well, but can be done with SpriteKit as well which makes it much easier to implement, I have written a small component which give similar kind of effect in Objecti-C using SpriteKit. You can find it here, Its not exactly the same but its near and you can take same approach to create your own or polish it as well.
i have developed it using box2d and libGdx on android,, so using libGdx u can use my code logic for iOS also...
have a look at my project, hope it helps,
https://github.com/mohitKejriwal/Bubble-UI-Android

Is it posible to insert a UITextView (or other UIKit view) into an augmented reality SCNScene?

Weird crazy question I know. My current setup is a SCNScene with a camera controlled by the device's gyroscope. I'm able to add and light normal nodes, however I would like to add 2D UIView objects into the scene like UITextViews or maybe some buttons. The views would need to be inside the scene and thus become no longer visible if the camera moves away from them.
Firstly, is this even possible? Or would this be way more difficult to implement than rebuilding an editable textview as a node? Could this be achieved by categories or...?
I just talked to the scenekit people here at WWDC. He said that as of now it is completly impossible to do it in a nice, functional way. The only options he offered as a possible solution is to create the UIView element somewhere off screen or behind the scene and continuously take screenshots of the object and apply those images as a texture to a SCNNode. He also pointed out the performance will be very poor with this because taking screenshots is heavy and you can't get going very quick with it. So I guess this is a no-go until UIView adds support because, according to the engineer, it's impossible to implement this because of a UIView limitation and not a SceneKit one.

iOS 8 for iPhone/iWatch: is it better to use SpriteKit+UIKit or only standard UIKit to implement a spinning wheel?

I would like to create an iPhone/iWatch app featuring a spinning wheel. The spinning wheel will allow the user to control the behaviour of the app and should be touchable; in other words other than spinning (long touch) the wheel should be able to detect short touches.
To design the architecture of this App I have a doubt: should I use UIImage view subclasses only or should I use SpriteKit and mix it with UIKit?
Example of spinning wheel.
Many thanks
On iPhone I've already done this by only using UIKit... And I didn't have any problem with it. So I would answer pure UIKit. On iWatch, I don't have the knowledge to answer you about this part.
You said you want to subclass UIImageView, but I don't think you want to do that. Instead, you should subclass UIView and manage UIImageView instances privately.
Also, if and only if you want to use SpritKit only for that component in your application, you should avoid using it because the less dependency you have, the more happy you are. But it's my personal thought about that.

Animating a "character" within iOS app that's not SpriteKit

I am in talks with a client to do an app, but in it, they are wanting it to revolve around a little character that follows you throughout the app (think Clippy, from the old days of Microsoft Word :)).
One thought I had was, can I use an SKSprite/Node inside an iOS app not using the SpriteKit framework?
Or is this a matter of animating through an array of UIImages?
Those were my first thoughts - does anyone know the best direction to go in for something like this? I need basic animations for a character throughout the whole app.
Depending on the detail of animation needed, you could do it with just CoreAnimation and possibly selectively choosing the image to display in an UIImageView. For example, see the answers to this question: rotate a UIView around its center but several times
Simple answer is, No, out of the box you can't use a class from a framework and choose to not use the framework. Though I'm not exactly sure what that question means. An SKSpriteNode renders via an SKScene node, and an SKScene node renders via an SKView, which is rendered by a View Controller.
You could do something fancy like dedicate the SKView as only part of the screen, and have a standard UIKit view as the other part, or only have the SKView appear on the screen when you needed it I guess.

Resources