ipad sprite/atlas animation - ios

I have an iPad app, where I need an animation full screen - running in a transparent UIView.
This animation is running every time the user is winning.
The question is, would you go for a sprite animation with a very large image as the source or would you go for a small video clip?
Remember that it has to be transparent - it is starts floating around.
Any input regarding directions is appreciated.
Thanks

I would use a sprite, loading a movie each time user wins is much more expensive than simply showing a sprite.
Besides, to show a video with transparent background you will have to iterato throught all player controller subviews and change backgroundColor like this

Related

Lottie animation gets scaled up

On the project I'm working on, a loader is made with Lottie (so it's an AnimationView that loads a json file).
When I put the app in background and enter foreground again, the loader goes from like 2x its size to its normal size, in like 0.5 secs. It's like an animation, but I have no idea where this scaling down animation comes from and why the loader is bigger when re-entering the app for a brief instant.
I've used KVO to listen to the view's contentScaleFactor, the layer.transform property, but nothing seems to change its scale.
The view bounds are not changing as well, just its content.
I've played the Lottie animation on online Lottie players, and the scaling isn't part of the animation.
Where this scaling could come from? How could I debug it? Any idea would be welcome, thanks!

How to animate background of a Sprite-Kit game just like the login screen of Instagram iOS app?

I am creating a game in Sprite-Kit and would want to animate the background in the similar fashion as Instagram does on its login screen.
Basically, I just want to know how to have a background in my game just like the Instagram app has on its login screen, i.e the pink colored screen which gradually changes to violet color and then to red with a very subtle flowing effect from right to left. I know how to animate the gradient but that subtle effect that I'm talking about which gives quite a view of a gas or stream flowing (I'm in love with that effect) doesn't seem to be happening.
You could use a framework such as BackgroundVideoiOS as seen on github

How can I detect if the Launch Storyboard happened?

does anyone know if there is a way to tell if the launch storyboard executed? Or is there a way to detect if the launch image was displayed?
Basically my app consists of just one view controller with some views (all created programmatically), plus the launch storyboard which I added to the project recently which seems to be working OK.
The reason why it would be useful for me to know if the launch storyboard happened is that my app is a game which basically consists of a big 2D scene that you can zoom into and pan around using the usual touch gestures. When the game starts for the first time it starts fully zoomed-out and centered on the scene: so that is what the launch image matches. But the player pans around and zooms-in on various things, so when they press the home button they could be zoomed into any part of the picture. So when they touch the app's icon to relaunch, if the launch storyboard happens it needs to put their pan/zoom position back to the initial centered zoomed-out position (otherwise as soon as the app gets going it would appear to the user to suddenly snap from the initial position represented in the launch image to where they were, not giving a smooth user experience).
What I do at the moment is -- if applicationDidEnterBackground: method gets called I assume that when the user relaunches the app, by touching the icon, that the launch storyboard will be executed. But the launch storyboard doesn't always happen after it hibernated via applicationDidEnterBackground:, especially if it is only a few minutes since the user pressed the home button.... and those times when the launch storyboard does not happen I need not inconvenience the player and put them back to the initial zoomed-out centered position, I could just let them carry on at the position they were.
I've not used storyboards before, but as I understand it launch storyboard are a special case where you can't make any connections to code because your app's not actually running yet, so I can't think of a way to set a variable, for example, to show the story board happened.
Anyone got any ideas?
Cheers,
Jon
Just use the viewDidLoad method provided by the UIViewController.
Just override the method in your ViewController and then you can perform the task you want when your View(Storyboard) is loaded.
Example:
#implementation MyViewController:UIViewController
-(void)viewDidLoad{
//Insert your code here
}
#end

Animation in Launch Screen in xcode 6

I want to animate a set of images in my Launch Screen, but I do not know how. I have seen some tutorials telling me to put code in the App Delegate (DidFinishLaunchingWithOptions) and nothing has worked.
Could someone help me animate my Launch Screen?
I am supposing that you do quite a bit of work on launch, and you do not want your user to stare at a static image while this work is going on. What you need to do is do the work in the background (using gcd). This way, the launch screen will be gone quickly. However, you are not ready of course: hence your need for animations. So what I do is add my own equivalent of the start screen on top of my first visible UIView, do my animations and then tear down my start up screen. If you want to see what I do in action, try it out with my App (The Opera Player)

Force rotation without user knowing

My app allows a user to create an invoice. Data can be input in either landscape or portrait.
The user is then able to save the quote and view saved quotes in a collection view. Similar to Pages on iOS. The size of the tiles are the aspect ratio of the device in portrait view.
So if the user saves a quote I generate a screen shot of the view and save it so that it can be viewed in the tiled view (like iOS pages). This works all fine if the user saves when the device is in portrait. If they save while landscape it sucks.
So my question is, there a way I can rotate the view behind the scenes, generate a UIImage from it all without the user knowing noticing any orientation change.
If you are running the code that rotates it and takes a screenshot in the same thread then as long as you rotate it back before the thread finishes running, the device's screen will not update. Simply rotate everything (or if you have too many objects to rotate, take a screenshot of it all then rotate that screenshot) now take a screenshot of your new rotated view (or if you took a screenshot and rotated it don't do anything, you're done) then rotate everything back (again unless you just took a screenshot then rotated that)... If you need a screenshot method that can run in 1 thread use the CGContext code.
(To answer your question, rotating is always behind the scenes, it only becomes "in front" of the scenes when your thread ends... so if you rotate it back before the end of your thread the user will never see it because the device's screen will not update until after it has been rotated twice, there and back again.... bingo!)

Resources