-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Play "reduced motion" marker if `UIAccessibility.isReduceMotionEnable…
…d` is true (#2110)
- Loading branch information
Showing
7 changed files
with
289 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Created by Cal Stephens on 7/14/23. | ||
// Copyright © 2023 Airbnb Inc. All rights reserved. | ||
|
||
/// How animation files should be decoded | ||
public enum DecodingStrategy: Hashable { | ||
/// Use Codable. This is was the default strategy introduced on Lottie 3, but should be rarely | ||
/// used as it's slower than `dictionaryBased`. Kept here for any possible compatibility issues | ||
/// that may come up, but consider it soft-deprecated. | ||
case legacyCodable | ||
|
||
/// Manually deserialize a dictionary into an Animation. | ||
/// This should be at least 2-3x faster than using Codable and due to that | ||
/// it's the default as of Lottie 4.x. | ||
case dictionaryBased | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Created by Cal Stephens on 12/13/21. | ||
// Copyright © 2021 Airbnb Inc. All rights reserved. | ||
|
||
import QuartzCore | ||
|
||
/// Global configuration options for Lottie animations | ||
public struct LottieConfiguration: Hashable { | ||
|
||
// MARK: Lifecycle | ||
|
||
public init( | ||
renderingEngine: RenderingEngineOption = .automatic, | ||
decodingStrategy: DecodingStrategy = .dictionaryBased, | ||
colorSpace: CGColorSpace = CGColorSpaceCreateDeviceRGB(), | ||
reducedMotionOption: ReducedMotionOption = .reducedMotion) | ||
{ | ||
self.renderingEngine = renderingEngine | ||
self.decodingStrategy = decodingStrategy | ||
self.colorSpace = colorSpace | ||
self.reducedMotionOption = reducedMotionOption | ||
} | ||
|
||
// MARK: Public | ||
|
||
/// The global configuration of Lottie, | ||
/// which applies to all `LottieAnimationView`s by default. | ||
public static var shared = LottieConfiguration() | ||
|
||
/// The rendering engine implementation to use when displaying an animation | ||
/// - Defaults to `RenderingEngineOption.automatic`, which uses the | ||
/// Core Animation rendering engine for supported animations, and | ||
/// falls back to using the Main Thread rendering engine for | ||
/// animations that use features not supported by the Core Animation engine. | ||
public var renderingEngine: RenderingEngineOption | ||
|
||
/// The decoding implementation to use when parsing an animation JSON file | ||
public var decodingStrategy: DecodingStrategy | ||
|
||
/// Options for controlling animation behavior in response to user / system "reduced motion" configuration. | ||
/// - Defaults to `ReducedMotionOption.systemReducedMotionToggle`, which returns `.reducedMotion` | ||
/// when the system `UIAccessibility.isReduceMotionEnabled` option is `true`. | ||
public var reducedMotionOption: ReducedMotionOption | ||
|
||
/// The color space to be used for rendering | ||
/// - Defaults to `CGColorSpaceCreateDeviceRGB()` | ||
public var colorSpace: CGColorSpace | ||
} |
Oops, something went wrong.