Skip to content

Commit

Permalink
Disable implicit layer animations while rendering frames
Browse files Browse the repository at this point in the history
  • Loading branch information
NickEntin committed Oct 4, 2024
1 parent a50ff45 commit 6a832f3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Sources/Stagehand/AnimationInstance/Renderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
//

import Foundation
import QuartzCore

internal final class Renderer<ElementType: AnyObject>: AnyRenderer {

Expand Down Expand Up @@ -55,7 +56,13 @@ internal final class Renderer<ElementType: AnyObject>: AnyRenderer {
return
}

// Disable implicit layer animations while rendering the frame. Otherwise animations that include keyframes for animatable layer properties will not animate those properties in sync with the rest of the animation.
CATransaction.begin()
CATransaction.setDisableActions(true)

animation.apply(to: &element, at: relativeTimestamp, initialValues: initialValues)

CATransaction.commit()
}

func renderInitialFrame() {
Expand Down

0 comments on commit 6a832f3

Please sign in to comment.