@@ -30,61 +30,59 @@ import { MathUtils } from '../math/MathUtils.js';
3030 * target group or directly, but not both.
3131 */
3232
33- function AnimationObjectGroup ( ) {
33+ class AnimationObjectGroup {
3434
35- this . uuid = MathUtils . generateUUID ( ) ;
35+ constructor ( ) {
3636
37- // cached objects followed by the active ones
38- this . _objects = Array . prototype . slice . call ( arguments ) ;
37+ this . uuid = MathUtils . generateUUID ( ) ;
3938
40- this . nCachedObjects_ = 0 ; // threshold
41- // note: read by PropertyBinding.Composite
39+ // cached objects followed by the active ones
40+ this . _objects = Array . prototype . slice . call ( arguments ) ;
4241
43- const indices = { } ;
44- this . _indicesByUUID = indices ; // for bookkeeping
42+ this . nCachedObjects_ = 0 ; // threshold
43+ // note: read by PropertyBinding.Composite
4544
46- for ( let i = 0 , n = arguments . length ; i !== n ; ++ i ) {
45+ const indices = { } ;
46+ this . _indicesByUUID = indices ; // for bookkeeping
4747
48- indices [ arguments [ i ] . uuid ] = i ;
48+ for ( let i = 0 , n = arguments . length ; i !== n ; ++ i ) {
4949
50- }
50+ indices [ arguments [ i ] . uuid ] = i ;
5151
52- this . _paths = [ ] ; // inside: string
53- this . _parsedPaths = [ ] ; // inside: { we don't care, here }
54- this . _bindings = [ ] ; // inside: Array< PropertyBinding >
55- this . _bindingsIndicesByPath = { } ; // inside: indices in these arrays
52+ }
5653
57- const scope = this ;
54+ this . _paths = [ ] ; // inside: string
55+ this . _parsedPaths = [ ] ; // inside: { we don't care, here }
56+ this . _bindings = [ ] ; // inside: Array< PropertyBinding >
57+ this . _bindingsIndicesByPath = { } ; // inside: indices in these arrays
5858
59- this . stats = {
59+ const scope = this ;
6060
61- objects : {
62- get total ( ) {
61+ this . stats = {
6362
64- return scope . _objects . length ;
63+ objects : {
64+ get total ( ) {
6565
66- } ,
67- get inUse ( ) {
66+ return scope . _objects . length ;
6867
69- return this . total - scope . nCachedObjects_ ;
68+ } ,
69+ get inUse ( ) {
7070
71- }
72- } ,
73- get bindingsPerObject ( ) {
71+ return this . total - scope . nCachedObjects_ ;
7472
75- return scope . _bindings . length ;
76-
77- }
73+ }
74+ } ,
75+ get bindingsPerObject ( ) {
7876
79- } ;
77+ return scope . _bindings . length ;
8078
81- }
79+ }
8280
83- Object . assign ( AnimationObjectGroup . prototype , {
81+ } ;
8482
85- isAnimationObjectGroup : true ,
83+ }
8684
87- add : function ( ) {
85+ add ( ) {
8886
8987 const objects = this . _objects ,
9088 indicesByUUID = this . _indicesByUUID ,
@@ -170,9 +168,9 @@ Object.assign( AnimationObjectGroup.prototype, {
170168
171169 this . nCachedObjects_ = nCachedObjects ;
172170
173- } ,
171+ }
174172
175- remove : function ( ) {
173+ remove ( ) {
176174
177175 const objects = this . _objects ,
178176 indicesByUUID = this . _indicesByUUID ,
@@ -219,10 +217,10 @@ Object.assign( AnimationObjectGroup.prototype, {
219217
220218 this . nCachedObjects_ = nCachedObjects ;
221219
222- } ,
220+ }
223221
224222 // remove & forget
225- uncache : function ( ) {
223+ uncache ( ) {
226224
227225 const objects = this . _objects ,
228226 indicesByUUID = this . _indicesByUUID ,
@@ -304,11 +302,11 @@ Object.assign( AnimationObjectGroup.prototype, {
304302
305303 this . nCachedObjects_ = nCachedObjects ;
306304
307- } ,
305+ }
308306
309307 // Internal interface used by befriended PropertyBinding.Composite:
310308
311- subscribe_ : function ( path , parsedPath ) {
309+ subscribe_ ( path , parsedPath ) {
312310
313311 // returns an array of bindings for the given path that is changed
314312 // according to the contained objects in the group
@@ -343,9 +341,9 @@ Object.assign( AnimationObjectGroup.prototype, {
343341
344342 return bindingsForPath ;
345343
346- } ,
344+ }
347345
348- unsubscribe_ : function ( path ) {
346+ unsubscribe_ ( path ) {
349347
350348 // tells the group to forget about a property path and no longer
351349 // update the array previously obtained with 'subscribe_'
@@ -377,7 +375,8 @@ Object.assign( AnimationObjectGroup.prototype, {
377375
378376 }
379377
380- } ) ;
378+ }
381379
380+ AnimationObjectGroup . prototype . isAnimationObjectGroup = true ;
382381
383382export { AnimationObjectGroup } ;
0 commit comments