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!
Related
I have a UIView that sets a timer and each firing it generates a UIImage on a background queue (priority .userInitiated), and when finished (measured to take between 1-2 milliseconds, it pushes to the main queue and updates a UIImageView's image.
This creates a smooth animation effect (e.g. if the Timer is configured to fire 30 times per second). Touching the screen however either slows down or completely shuts down the updating. I removed my overrides of touchesBegan,Moved,Ended and any GestureRecognizers to ensure that I wasn't doing anything expensive. Simply touching the screen (especially dragging quickly) prevents the UI updating.
I watched this and googled as many SO posts as I can but I'm completely stuck on this.
Here is a reproduction of the problem. Run the app and it will display a stripped down rendering of a basic project. From there, you can drag/touch the screen and notice the frames will either slow down to a crawl or completely stop.
Github Repro
I have a splash animation that is being cut into for the first ~0.4 seconds by the launch screen. I do not want to remove the launch screen. I was wondering if I could set the splash animation to play only after the launch screen closes. I would rather not hardcode a delay of 0.4 seconds if possible, as it feels like a hack.
Yes you can. The best place to do so is in your main view controller's viewWillAppear method. You can put a trigger in there or launch the animation directly. Hardcoding a delay is indeed not a good idea because besides device configuration like processor speed etc there are a lot of other contributing factors to the time the launch screen takes.
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)
There's a CAReplicatorLayer with a bunch of replicated CAShapeLayers on the screen.
They are just shown, they don't move, nor are they supposed to do anything but be visible.
I'm running an animation to move some other CAShapeLayers around on the screen. As soon as the animation starts (the first time), the CAReplicatorLayer(with all its replications) gets redrawn. I see that due to the CoreAnimation profiler with "flash updated regions".
Those two things are absolutely not related at all, and though the CAReplicatorLayer with all its replications gets redrawn.
I've got a test project here, that shows exactly the problem. Press one of the two animation buttons to run the animation and watch the screen regions being flashed, with the CoreAnimation profiler active.
https://dl.dropboxusercontent.com/u/40859730/AnimationLagTest.zip
There's a very noticable lag but only very first time the animation is run. When pressing reset, the lag begins again. On pressing reset the CAShapeLayers that are used for the animation are recreated.
I'm using an iPad 3 Retina to test this, if you have a never / faster device than me, you maybe have to increase the instanceCount of the CAReplicatorLayer to 300-1000, to see the initial lag when starting the animation.
What can I do, to stop that unnecessary re-rendering of screen regions, that obviously don't need a re-render?
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