@@ -113,7 +113,8 @@ export class MotionState {
113113 }
114114
115115 // Update visual element with new options
116- updateOptions ( ) {
116+ updateOptions ( options : Options ) {
117+ this . options = options
117118 this . visualElement ?. update ( {
118119 ...this . options as any ,
119120 whileTap : this . options . whilePress ,
@@ -135,9 +136,7 @@ export class MotionState {
135136 'Animation state must be mounted with valid Element' ,
136137 )
137138 this . element = element
138- this . options = options
139-
140- this . updateOptions ( )
139+ this . updateOptions ( options )
141140
142141 // Mount features in parent-to-child order
143142 this . featureManager . mount ( )
@@ -195,14 +194,11 @@ export class MotionState {
195194 mountedStates . delete ( this . element )
196195 this . featureManager . unmount ( )
197196 this . visualElement ?. unmount ( )
197+ // clear animation
198+ this . clearAnimation ( )
198199 }
199200 // Delay unmount if needed for layout animations
200- if ( shouldDelay ) {
201- Promise . resolve ( ) . then ( unmountState )
202- }
203- else {
204- unmountState ( )
205- }
201+ shouldDelay ? Promise . resolve ( ) . then ( unmountState ) : unmountState ( )
206202 }
207203
208204 unmount ( )
@@ -220,8 +216,7 @@ export class MotionState {
220216 // Update motion state with new options
221217 update ( options : Options ) {
222218 const hasAnimateChange = isAnimateChanged ( this . options , options )
223- this . options = options
224- this . updateOptions ( )
219+ this . updateOptions ( options )
225220 // Update features in parent-to-child order
226221 this . featureManager . update ( )
227222
0 commit comments