Ahh, there’s a jitter when moving. Try creating an async dispatch to a background thread in a block.
> On May 13, 2020, at 3:34 PM, Gabriel Zachmann <z...@cs.uni-bremen.de> wrote: > >> >> Care to post a video on a Google drive so that we can see it? > > Good idea - here is the video: > > https://owncloud.informatik.uni-bremen.de/index.php/s/TTGG6bKCMFLqY4g > > (encoded in H265/HEVC for saving file size) > > I think, you can see clearly the stuttering. Sometimes it is more subtle, > sometimes, the stuttering pauses the animation for a second. > Sometimes, it occurs when the background thread is prefetching the next image > (usually happens directly after the switch to a new image), sometimes, it > happens when the new image is beginning to show (i.e., when it's CALayer is > added to the layer hierarchy). > > I made another experiment, which puzzles me even more. > I am storing a history of the CGImageRef's that had been displayed so far. > When I go back through that history, I use those stored CGImageRef's to > create new CALayers which I then add to the layer hierarchy (the image that > had been shown until then is just removed from the layer hierarchy, or rather > its CALayer). > The funny thing is that when I do that (using older CGImageRef's) the switch > from one image to the next one is instantaneous and there is no stuttering at > all. > > You can see that in the video starting at 1:19. > > It seems as if some more processing is going on when a CGImage is assigned to > a CALayer, > which CGImageSourceCreateThumbnailAtIndex() and all the other functions I > listed below do not do. > Or it happens at the point when an animation is added. > And the result of that is stored inside the CGImage! > But how can I force that in the background thread? > (without making the animation of the foreground thread stutter.) > > I made another little experiment. > I keep (kinetically) scrolling through the source code in Xcode with high > velocity while my app is running in the foreground. > And when it switches images there is sometimes even a stuttering in that > scrolling. > >> >> One of my tricks (not just mine) is to have a 3 slots of for images, not >> just 2. When a new image loads, take the foreground one that is blended in >> to 100%, put an identical one ahead of it. Make the changes to the new and >> old images behind it, then hide that foreground image. > > Sorry, I didn't get how that would work with my animations. > Maybe, you can describe it again once you've seen the video. > > > > Best, Gab. > > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com