@@ -32,8 +32,6 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
32
32
33
33
function _inherits ( subClass , superClass ) { if ( typeof superClass !== "function" && superClass !== null ) { throw new TypeError ( "Super expression must either be null or a function, not " + typeof superClass ) ; } subClass . prototype = Object . create ( superClass && superClass . prototype , { constructor : { value : subClass , enumerable : false , writable : true , configurable : true } } ) ; if ( superClass ) Object . setPrototypeOf ? Object . setPrototypeOf ( subClass , superClass ) : subClass . __proto__ = superClass ; }
34
34
35
- console . log ( _tween2 . default ) ;
36
-
37
35
var EASING = {
38
36
'ease' : _tween2 . default . Easing . Quadratic . InOut ,
39
37
'ease-in' : _tween2 . default . Easing . Cubic . In ,
@@ -52,12 +50,12 @@ var MtSvgLines = function (_React$Component) {
52
50
53
51
var _this = _possibleConstructorReturn ( this , ( MtSvgLines . __proto__ || Object . getPrototypeOf ( MtSvgLines ) ) . call ( this , props ) ) ;
54
52
55
- _this . _onTweenUpdate = function ( ) {
56
- _this . _setStrokeDashoffset ( _this . _pathElems , _this . _tweenData ) ;
57
- _this . _animate ( ) ; // go again..
53
+ _this . onTweenUpdate = function ( ) {
54
+ _this . setStrokeDashoffset ( _this . _pathElems , _this . _tweenData ) ;
55
+ _this . animate ( ) ; // go again..
58
56
} ;
59
57
60
- _this . _onAnimComplete = function ( ) {
58
+ _this . onAnimComplete = function ( ) {
61
59
_this . props . callback ( ) ;
62
60
_this . _animStart = 0 ;
63
61
} ;
@@ -95,12 +93,12 @@ var MtSvgLines = function (_React$Component) {
95
93
} , {
96
94
key : 'componentDidMount' ,
97
95
value : function componentDidMount ( ) {
98
- this . _animate ( ) ;
96
+ this . animate ( ) ;
99
97
}
100
98
} , {
101
99
key : 'componentDidUpdate' ,
102
100
value : function componentDidUpdate ( ) {
103
- this . _animate ( ) ;
101
+ this . animate ( ) ;
104
102
}
105
103
} , {
106
104
key : 'render' ,
@@ -156,8 +154,8 @@ var MtSvgLines = function (_React$Component) {
156
154
*/
157
155
158
156
} , {
159
- key : '_animate ' ,
160
- value : function _animate ( ) {
157
+ key : 'animate ' ,
158
+ value : function animate ( ) {
161
159
var _this3 = this ;
162
160
163
161
if ( typeof window === 'undefined' ) {
@@ -185,7 +183,7 @@ var MtSvgLines = function (_React$Component) {
185
183
186
184
// parse out vars common for both modes
187
185
var startDelay = typeof animate === 'number' ? animate : 0 ; // if numeric, treat as delay (ms)
188
- var numOfRepeats = parseInt ( playback , 10 ) || 0 ;
186
+ var numOfRepeats = parseInt ( playback , 10 ) || 1 ;
189
187
190
188
/* ----- JS MODE ----- */
191
189
if ( isAnimJS ) {
@@ -199,8 +197,8 @@ var MtSvgLines = function (_React$Component) {
199
197
var isYoYo = playback . includes ( 'alternate' ) ;
200
198
201
199
// acquire path elems and generate to/from data sets
202
- this . _pathElems = this . _selectPathElems ( ) ;
203
- var pathData = this . _getPathData ( this . _pathElems ) ;
200
+ this . _pathElems = this . selectPathElems ( ) ;
201
+ var pathData = this . getPathData ( this . _pathElems ) ;
204
202
this . _pathDataFrom = pathData . from ;
205
203
this . _pathDataTo = pathData . to ;
206
204
@@ -210,11 +208,11 @@ var MtSvgLines = function (_React$Component) {
210
208
this . _tweenData = _extends ( { } , this . _pathDataFrom ) ;
211
209
212
210
// set paths' offsets to start positions
213
- this . _setStrokeDasharray ( this . _pathElems , this . _pathDataFrom ) ;
214
- this . _setStrokeDashoffset ( this . _pathElems , this . _tweenData ) ;
211
+ this . setStrokeDasharray ( this . _pathElems , this . _pathDataFrom ) ;
212
+ this . setStrokeDashoffset ( this . _pathElems , this . _tweenData ) ;
215
213
216
214
// init the tweener..
217
- var tween = new _tween2 . default . Tween ( this . _tweenData ) . to ( this . _pathDataTo , duration ) . easing ( EASING [ timing ] ) . repeat ( numOfRepeats ) . yoyo ( isYoYo ) . onUpdate ( this . _onTweenUpdate ) . onComplete ( this . _onAnimComplete ) ;
215
+ var tween = new _tween2 . default . Tween ( this . _tweenData ) . to ( this . _pathDataTo , duration ) . easing ( EASING [ timing ] ) . repeat ( numOfRepeats ) . yoyo ( isYoYo ) . onUpdate ( this . onTweenUpdate ) . onComplete ( this . onAnimComplete ) ;
218
216
219
217
// kick off JS tweening..
220
218
var t = setTimeout ( function ( ) {
@@ -228,7 +226,7 @@ var MtSvgLines = function (_React$Component) {
228
226
var css = '' ;
229
227
230
228
// 1) determine number of path elems in svg
231
- var pathLenghts = this . _getPathLengths ( ) ;
229
+ var pathLenghts = this . getPathLengths ( ) ;
232
230
var pathQty = pathLenghts . length || 1 ;
233
231
234
232
// 2) calc all timing values
@@ -238,13 +236,13 @@ var MtSvgLines = function (_React$Component) {
238
236
239
237
// 3) concat generated CSS, one path at a time..
240
238
pathLenghts . forEach ( function ( length , index ) {
241
- css += _this3 . _getPathCSS ( index , length , startDelay , pathStaggerDelay , pathDrawDuration ) ;
239
+ css += _this3 . getPathCss ( index , length , startDelay , pathStaggerDelay , pathDrawDuration ) ;
242
240
} ) ;
243
241
244
242
// set up on-complete timer
245
243
var _t = setTimeout ( function ( ) {
246
244
clearTimeout ( _t ) ;
247
- _this3 . _onAnimComplete ( ) ;
245
+ _this3 . onAnimComplete ( ) ;
248
246
} , startDelay + duration * numOfRepeats ) ;
249
247
250
248
// set state (re-render)
@@ -274,13 +272,13 @@ var MtSvgLines = function (_React$Component) {
274
272
*/
275
273
276
274
} , {
277
- key : '_selectPathElems ' ,
275
+ key : 'selectPathElems ' ,
278
276
279
277
280
278
/*
281
279
* Acquire selection of SVG 'path' elems contained within
282
280
*/
283
- value : function _selectPathElems ( ) {
281
+ value : function selectPathElems ( ) {
284
282
var svgEl = this . _svgWrapper . getElementsByTagName ( 'svg' ) [ 0 ] ;
285
283
return svgEl ? svgEl . querySelectorAll ( 'path' ) : [ ] ;
286
284
}
@@ -293,14 +291,14 @@ var MtSvgLines = function (_React$Component) {
293
291
*/
294
292
295
293
} , {
296
- key : '_getPathData ' ,
297
- value : function _getPathData ( pathElems ) {
294
+ key : 'getPathData ' ,
295
+ value : function getPathData ( pathElems ) {
298
296
var _this4 = this ;
299
297
300
298
var pathData = { from : { } , to : { } } ;
301
299
302
300
[ ] . forEach . call ( pathElems , function ( pathEl , i ) {
303
- if ( ! _this4 . _hasSkipAttr ( pathEl . attributes ) ) {
301
+ if ( ! _this4 . hasSkipAttr ( pathEl . attributes ) ) {
304
302
var pathLengh = ( 0 , _utils . trimFloat ) ( pathEl . getTotalLength ( ) || 0 ) ;
305
303
pathData . to [ i ] = 0 ;
306
304
pathData . from [ i ] = pathLengh ;
@@ -315,8 +313,8 @@ var MtSvgLines = function (_React$Component) {
315
313
*/
316
314
317
315
} , {
318
- key : '_hasSkipAttr ' ,
319
- value : function _hasSkipAttr ( attributes ) {
316
+ key : 'hasSkipAttr ' ,
317
+ value : function hasSkipAttr ( attributes ) {
320
318
var result = false ;
321
319
322
320
// path.attributes is an obj with indexed keys, so we must iterate over them
@@ -340,8 +338,8 @@ var MtSvgLines = function (_React$Component) {
340
338
*/
341
339
342
340
} , {
343
- key : '_setStrokeDasharray ' ,
344
- value : function _setStrokeDasharray ( pathElems , pathData ) {
341
+ key : 'setStrokeDasharray ' ,
342
+ value : function setStrokeDasharray ( pathElems , pathData ) {
345
343
[ ] . forEach . call ( pathElems , function ( pathEl , i ) {
346
344
if ( pathData [ i ] ) {
347
345
pathEl . style . strokeDasharray = pathData [ i ] ;
@@ -354,8 +352,8 @@ var MtSvgLines = function (_React$Component) {
354
352
*/
355
353
356
354
} , {
357
- key : '_setStrokeDashoffset ' ,
358
- value : function _setStrokeDashoffset ( pathElems , pathData ) {
355
+ key : 'setStrokeDashoffset ' ,
356
+ value : function setStrokeDashoffset ( pathElems , pathData ) {
359
357
[ ] . forEach . call ( pathElems , function ( pathEl , i ) {
360
358
if ( pathData [ i ] ) {
361
359
pathEl . style . strokeDashoffset = pathData [ i ] ;
@@ -368,13 +366,13 @@ var MtSvgLines = function (_React$Component) {
368
366
*/
369
367
370
368
} , {
371
- key : '_getPathLengths ' ,
372
- value : function _getPathLengths ( ) {
369
+ key : 'getPathLengths ' ,
370
+ value : function getPathLengths ( ) {
373
371
var _this5 = this ;
374
372
375
- var pathElems = this . _selectPathElems ( ) ;
373
+ var pathElems = this . selectPathElems ( ) ;
376
374
return [ ] . map . call ( pathElems , function ( pathEl ) {
377
- return _this5 . _hasSkipAttr ( pathEl . attributes ) ? 0 : ( 0 , _utils . trimFloat ) ( pathEl . getTotalLength ( ) || 0 ) ;
375
+ return _this5 . hasSkipAttr ( pathEl . attributes ) ? 0 : ( 0 , _utils . trimFloat ) ( pathEl . getTotalLength ( ) || 0 ) ;
378
376
} ) ;
379
377
}
380
378
@@ -383,8 +381,8 @@ var MtSvgLines = function (_React$Component) {
383
381
*/
384
382
385
383
} , {
386
- key : '_getPathCSS ' ,
387
- value : function _getPathCSS ( index , length , startDelay , staggerDelay , duration ) {
384
+ key : 'getPathCss ' ,
385
+ value : function getPathCss ( index , length , startDelay , staggerDelay , duration ) {
388
386
var classKey = this . state . classKey ;
389
387
var _props3 = this . props ,
390
388
timing = _props3 . timing ,
0 commit comments