File tree Expand file tree Collapse file tree 2 files changed +2
-32
lines changed
packages/motion/src/state Expand file tree Collapse file tree 2 files changed +2
-32
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import type { MotionStateContext, Options } from '@/types'
2
2
import { invariant } from 'hey-listen'
3
3
import type { DOMKeyframesDefinition , VisualElement } from 'framer-motion'
4
4
import { cancelFrame , frame , noop } from 'framer-motion/dom'
5
- import { isAnimateChanged , isSVGElement , resolveVariant } from '@/state/utils'
5
+ import { isSVGElement , resolveVariant } from '@/state/utils'
6
6
import type { Feature , StateType } from '@/features'
7
7
import { FeatureManager } from '@/features'
8
8
import type { PresenceContext } from '@/components/animate-presence/presence'
@@ -212,14 +212,11 @@ export class MotionState {
212
212
213
213
// Update motion state with new options
214
214
update ( options : Options ) {
215
- const hasAnimateChange = isAnimateChanged ( this . options , options )
216
215
this . updateOptions ( options )
217
216
// Update features in parent-to-child order
218
217
this . featureManager . update ( )
219
218
220
- if ( hasAnimateChange ) {
221
- this . startAnimation ( )
222
- }
219
+ this . startAnimation ( )
223
220
}
224
221
225
222
// Set animation state active status and propagate to children
Original file line number Diff line number Diff line change @@ -133,30 +133,3 @@ const svgElementSet = new Set(svgElements)
133
133
export function isSVGElement ( as : AsTag ) : as is SVGElements {
134
134
return svgElementSet . has ( as as SVGElements )
135
135
}
136
-
137
- export function isAnimateChanged ( oldOptions : Options , newOptions : Options ) : boolean {
138
- const oldAnimate = oldOptions . animate
139
- const newAnimate = newOptions . animate
140
- if ( oldAnimate === newAnimate )
141
- return false
142
- if ( ! oldAnimate || ! newAnimate ) {
143
- return true
144
- }
145
-
146
- if ( typeof oldAnimate === 'object' || typeof newAnimate === 'object' ) {
147
- // Compare object keys and values
148
- const oldKeys = Object . keys ( oldAnimate )
149
- const newKeys = Object . keys ( newAnimate )
150
-
151
- if ( oldKeys . length !== newKeys . length )
152
- return true
153
- return oldKeys . some ( ( key ) => {
154
- if ( key === 'transition' )
155
- return false
156
- const oldVal = oldAnimate [ key ]
157
- const newVal = newAnimate [ key ]
158
- return oldVal !== newVal
159
- } )
160
- }
161
- return oldAnimate !== newAnimate
162
- }
You can’t perform that action at this time.
0 commit comments