Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/framer-motion/src/frameloop/render-step.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ export function createRenderStep(runNextFrame: () => void): Step {

isProcessing = true

// Swap this frame and the next to avoid GC
;[thisFrame, nextFrame] = [nextFrame, thisFrame]
// Swap this frame and the next to avoid GC
;[thisFrame, nextFrame] = [nextFrame, thisFrame]

// Clear the next frame queue
nextFrame.clear()
Expand All @@ -111,6 +111,7 @@ export function createRenderStep(runNextFrame: () => void): Step {

callback(frameData)
}
thisFrame.clear()
}

isProcessing = false
Expand Down
14 changes: 8 additions & 6 deletions packages/framer-motion/src/render/VisualElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,16 +441,18 @@ export abstract class VisualElement<

this.values.forEach((value, key) => this.bindToMotionValue(key, value))

if (!hasReducedMotionListener.current) {
const isAutoConfig = this.reducedMotionConfig !== "never" && this.reducedMotionConfig !== "always";

if (isAutoConfig && !hasReducedMotionListener.current) {
initPrefersReducedMotion()
}

this.shouldReduceMotion =
this.reducedMotionConfig === "never"
? false
: this.reducedMotionConfig === "always"
? true
: prefersReducedMotion.current
? true
: prefersReducedMotion.current

if (process.env.NODE_ENV !== "production") {
warnOnce(
Expand Down Expand Up @@ -745,8 +747,8 @@ export abstract class VisualElement<
return this.isVariantNode
? this
: this.parent
? this.parent.getClosestVariantNode()
: undefined
? this.parent.getClosestVariantNode()
: undefined
}

getVariantContext(startAtParent = false): undefined | VariantStateContext {
Expand Down Expand Up @@ -862,7 +864,7 @@ export abstract class VisualElement<
this.latestValues[key] !== undefined || !this.current
? this.latestValues[key]
: this.getBaseTargetFromProps(this.props, key) ??
this.readValueFromInstance(this.current, key, this.options)
this.readValueFromInstance(this.current, key, this.options)

if (value !== undefined && value !== null) {
if (
Expand Down