@@ -13,7 +13,6 @@ define( require => {
13
13
const Atom = require ( 'NITROGLYCERIN/Atom' ) ;
14
14
const BooleanProperty = require ( 'AXON/BooleanProperty' ) ;
15
15
const buildAMolecule = require ( 'BUILD_A_MOLECULE/buildAMolecule' ) ;
16
- const Easing = require ( 'TWIXT/Easing' ) ;
17
16
const Emitter = require ( 'AXON/Emitter' ) ;
18
17
const Rectangle = require ( 'DOT/Rectangle' ) ;
19
18
const Strings = require ( 'BUILD_A_MOLECULE/Strings' ) ;
@@ -44,13 +43,6 @@ define( require => {
44
43
this . isAnimatingProperty = new BooleanProperty ( false ) ;
45
44
this . isSeparatingProperty = new BooleanProperty ( false ) ;
46
45
47
- // @private {Vector2|null} Used for animating the molecules to a position constrained in play area bounds
48
- this . animationStartPosition = null ;
49
- this . animationEndPosition = null ;
50
-
51
- // @private {number} Valid values 0 <= x <= 1. Used to adjust rate of animation completion.
52
- this . animationProgress = 0 ;
53
-
54
46
// @public {Emitter}
55
47
this . grabbedByUserEmitter = new Emitter ( { parameters : [ { valueType : Atom2 } ] } ) ;
56
48
this . droppedByUserEmitter = new Emitter ( { parameters : [ { valueType : Atom2 } ] } ) ;
@@ -79,9 +71,6 @@ define( require => {
79
71
this . userControlledProperty . lazyLink ( controlled => {
80
72
if ( controlled ) {
81
73
this . grabbedByUserEmitter . emit ( this ) ;
82
-
83
- // Interrupt animation process
84
- this . interruptAnimation ( controlled ) ;
85
74
}
86
75
else {
87
76
this . droppedByUserEmitter . emit ( this ) ;
@@ -106,41 +95,6 @@ define( require => {
106
95
if ( this . isSeparatingProperty . value ) {
107
96
this . stepAtomTowardsDestination ( dt ) ;
108
97
}
109
-
110
- // Handle animation process
111
- if ( this . isAnimatingProperty . value ) {
112
- this . animate ( dt ) ;
113
- }
114
- }
115
-
116
- /**
117
- * Handle animating returning atoms to a position constrained within play area.
118
- *
119
- * @param {number } dt
120
- * @private
121
- */
122
- animate ( dt ) {
123
- const distance = this . animationStartPosition . distance ( this . animationEndPosition ) ;
124
- if ( distance > 0 ) {
125
-
126
- // Responsible for the tempo of the animation.
127
- this . animationProgress = Math . min ( 1 , this . animationProgress + dt * 2 ) ;
128
- const ratio = Easing . CUBIC_IN_OUT . value ( this . animationProgress ) ;
129
-
130
- // Update the position of the atom
131
- this . positionProperty . set ( this . animationStartPosition . blend ( this . animationEndPosition , ratio ) ) ;
132
- }
133
-
134
- // At this point the animation has completed
135
- else {
136
- this . animationProgress = 1 ;
137
- this . destinationProperty . value = this . positionProperty . value ;
138
- }
139
- if ( this . animationProgress === 1 ) {
140
- this . isAnimatingProperty . set ( false ) ;
141
- this . animationProgress = 0 ;
142
- this . separateMoleculeEmitter . emit ( ) ;
143
- }
144
98
}
145
99
146
100
/**
@@ -178,16 +132,6 @@ define( require => {
178
132
}
179
133
}
180
134
181
- /**
182
- * Interrupt and reset the animation progress if a user controls an atom.
183
- *
184
- * @param {boolean } userControlled - User is controlling the atom
185
- */
186
- interruptAnimation ( userControlled ) {
187
- this . isAnimatingProperty . set ( ! userControlled ) ;
188
- this . animationProgress = 0 ;
189
- }
190
-
191
135
setPosition ( x , y ) {
192
136
this . positionProperty . value = new Vector2 ( x , y ) ;
193
137
}
@@ -213,9 +157,6 @@ define( require => {
213
157
this . visibleProperty . reset ( ) ;
214
158
this . addedToModelProperty . reset ( ) ;
215
159
this . destinationProperty . value = this . positionProperty . value ;
216
-
217
- // Treat animation interruption as if it is userControlled.
218
- this . interruptAnimation ( true ) ;
219
160
}
220
161
}
221
162
0 commit comments