Skip to content

OskarGroth/AuroraView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AuroraView

Showcasing a technique used to create performant Aurora gradients (blurred blobs) in SwiftUI on macOS.

Aurora View

Problem

To achieve this effect in SwiftUI, you would typically create Shapes and using the .blur modifier. This would incur a heavy performance penalty while animating (up to 50% CPU).

Solution

By using a CALayer and Core Animation to animate the blobs, we can offload all the work to the WindowServer & GPU. The result is an app CPU utilization of 0%. A CALayer overlay is also used as a noise filter to smooth out the banding artifacts that are common in blurred color gradients. A NSViewRepresentable is used to make everything accessible from SwiftUI.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published