@@ -45,35 +45,34 @@ export class ArraySpreadAnimation extends Animatable {
4545 this . endX = stashItem ! . x ( ) + stashItem ! . width ( ) ;
4646 this . controlInstrAnimation = new AnimatedTextbox (
4747 controlInstrItem . text ,
48- getNodePosition ( controlInstrItem ) ,
48+ getNodePosition ( controlInstrItem ) ,
4949 { rectProps : { stroke : defaultActiveColor ( ) } }
5050 ) ;
5151 this . stashItemAnimation = new AnimatedTextbox ( stashItem . text , getNodePosition ( stashItem ) , {
52- rectProps : {
53- stroke : defaultDangerColor ( )
54- }
55- } ) ;
52+ rectProps : {
53+ stroke : defaultDangerColor ( )
54+ }
55+ } ) ;
5656
5757 // call instr above
5858 this . prevCallInstrAnimation = new AnimatedTextbox (
5959 this . prevCallInstrItem . text ,
60- { ...getNodePosition ( this . prevCallInstrItem ) ,
61- opacity : 0 } ,
60+ { ...getNodePosition ( this . prevCallInstrItem ) , opacity : 0 } ,
6261 { rectProps : { stroke : defaultActiveColor ( ) } }
6362 ) ;
6463
6564 this . currCallInstrAnimation = new AnimatedTextbox (
6665 this . currCallInstrItem . text ,
67- { ...getNodePosition ( this . currCallInstrItem ) ,
68- opacity : 0 } ,
66+ { ...getNodePosition ( this . currCallInstrItem ) , opacity : 0 } ,
6967 { rectProps : { stroke : defaultActiveColor ( ) } }
7068 ) ;
7169
7270 this . resultAnimations = resultItems . map ( item => {
7371 return new AnimatedTextbox ( item . text , {
74- ...getNodePosition ( item ) ,
75- opacity : 0
76- } ) } ) ;
72+ ...getNodePosition ( item ) ,
73+ opacity : 0
74+ } ) ;
75+ } ) ;
7776 if ( stashItem . arrow ) {
7877 this . arrowAnimation = new AnimatedGenericArrow ( stashItem . arrow , { opacity : 0 } ) ;
7978 }
@@ -103,10 +102,8 @@ export class ArraySpreadAnimation extends Animatable {
103102 const fadeDuration = ( ( animationConfig ?. duration ?? 1 ) * 3 ) / 4 ;
104103 const fadeInDelay = ( animationConfig ?. delay ?? 0 ) + ( animationConfig ?. duration ?? 1 ) / 4 ;
105104
106-
107105 // Move spread instruction next to stash item (array pointer)
108106 await Promise . all ( [
109-
110107 // Show change in call arity
111108 this . prevCallInstrAnimation . animateTo (
112109 { scaleX : 1.1 , scaleY : 1.1 , opacity : 0 } ,
@@ -118,35 +115,24 @@ export class ArraySpreadAnimation extends Animatable {
118115 { duration : 0.3 , easing : Easings . StrongEaseOut }
119116 ) ,
120117
121-
122-
123118 ...this . resultAnimations . flatMap ( a => [
124-
125- a . animateTo (
126- { x : startX + ( this . endX - startX ) / 2 - this . resultItems [ 0 ] ?. width ( ) / 2 } ,
127- { duration : 0 }
128- )
129- ] ) ,
119+ a . animateTo (
120+ { x : startX + ( this . endX - startX ) / 2 - this . resultItems [ 0 ] ?. width ( ) / 2 } ,
121+ { duration : 0 }
122+ )
123+ ] ) ,
130124 this . controlInstrAnimation . animateRectTo ( { stroke : defaultStrokeColor ( ) } , animationConfig ) ,
131125 this . controlInstrAnimation . animateTo (
132126 {
133127 x : startX ,
134- y :
135- resultY +
136- ( this . resultItems [ 0 ] ?. height ( ) ?? this . stashItem . height ( ) ) ,
128+ y : resultY + ( this . resultItems [ 0 ] ?. height ( ) ?? this . stashItem . height ( ) ) ,
137129 width : minInstrWidth
138130 } ,
139131 animationConfig
140132 ) ,
141133 this . stashItemAnimation . animateRectTo ( { stroke : defaultDangerColor ( ) } , animationConfig )
142-
143134 ] ) ;
144135
145-
146-
147-
148-
149-
150136 animationConfig = { ...animationConfig , delay : 0 } ;
151137 // Merge all elements together to form the result
152138 await Promise . all ( [
@@ -156,20 +142,21 @@ export class ArraySpreadAnimation extends Animatable {
156142 { ...animationConfig , duration : fadeDuration }
157143 ) ,
158144 this . stashItemAnimation . animateTo ( { x : resultX ( 0 ) } , animationConfig ) ,
159- this . stashItemAnimation . animateTo ( { opacity : 0 } , { ...animationConfig , duration : fadeDuration } ) ,
145+ this . stashItemAnimation . animateTo (
146+ { opacity : 0 } ,
147+ { ...animationConfig , duration : fadeDuration }
148+ ) ,
160149
161150 ...this . resultAnimations . flatMap ( ( a , idx ) => [
162151 a . animateTo ( { x : resultX ( idx ) } , animationConfig ) ,
163152 a . animateRectTo ( { stroke : defaultDangerColor ( ) } , animationConfig ) ,
164- a . animateTo (
165- { opacity : 1 } ,
166- { ...animationConfig , duration : fadeDuration , delay : fadeInDelay }
167- ) ,
168- ] ) ,
169-
153+ a . animateTo (
154+ { opacity : 1 } ,
155+ { ...animationConfig , duration : fadeDuration , delay : fadeInDelay }
156+ )
157+ ] )
170158 ] ) ;
171159
172-
173160 this . destroy ( ) ;
174161 }
175162
0 commit comments