1
1
/*!
2
2
:: mo · js :: motion graphics toolbelt for the web
3
3
Oleg Solomka @LegoMushroom 2015 MIT
4
- 0.117.5
4
+ 0.119.0
5
5
*/
6
6
7
7
( function ( f ) {
@@ -525,7 +525,7 @@ Burst = (function(superClass) {
525
525
526
526
module . exports = Burst ;
527
527
528
- } , { "./h" :4 , "./shapes/bitsMap" :11 , "./swirl" :20 , "./transit" :21 , "./tween/tween" :23 } ] , 3 :[ function ( require , module , exports ) {
528
+ } , { "./h" :4 , "./shapes/bitsMap" :11 , "./swirl" :21 , "./transit" :22 , "./tween/tween" :24 } ] , 3 :[ function ( require , module , exports ) {
529
529
var Easing , PathEasing , bezier , easing ;
530
530
531
531
bezier = require ( './bezier-easing' ) ;
@@ -1316,7 +1316,7 @@ module.exports = h;
1316
1316
var mojs ;
1317
1317
1318
1318
mojs = {
1319
- revision : '0.117.5 ' ,
1319
+ revision : '0.119.0 ' ,
1320
1320
isDebug : true ,
1321
1321
helpers : require ( './h' ) ,
1322
1322
Bit : require ( './shapes/bit' ) ,
@@ -1332,6 +1332,7 @@ mojs = {
1332
1332
Transit : require ( './transit' ) ,
1333
1333
Swirl : require ( './swirl' ) ,
1334
1334
Stagger : require ( './stagger' ) ,
1335
+ Spriter : require ( './spriter' ) ,
1335
1336
MotionPath : require ( './motion-path' ) ,
1336
1337
Timeline : require ( './tween/timeline' ) ,
1337
1338
Tween : require ( './tween/tween' ) ,
@@ -1355,7 +1356,7 @@ if ((typeof module === "object") && (typeof module.exports === "object")) {
1355
1356
1356
1357
return typeof window !== "undefined" && window !== null ? window . mojs = mojs : void 0 ;
1357
1358
1358
- } , { "./burst" :2 , "./easing" :3 , "./h" :4 , "./motion-path" :6 , "./shapes/bit" :10 , "./shapes/bitsMap" :11 , "./shapes/circle" :12 , "./shapes/cross" :13 , "./shapes/equal" :14 , "./shapes/line" :15 , "./shapes/polygon" :16 , "./shapes/rect" :17 , "./shapes/zigzag" :18 , "./stagger " :19 , "./swirl " :20 , "./transit " :21 , "./tween/timeline" :22 , "./tween/tween" :23 , "./tween/tweener" :24 } ] , 6 :[ function ( require , module , exports ) {
1359
+ } , { "./burst" :2 , "./easing" :3 , "./h" :4 , "./motion-path" :6 , "./shapes/bit" :10 , "./shapes/bitsMap" :11 , "./shapes/circle" :12 , "./shapes/cross" :13 , "./shapes/equal" :14 , "./shapes/line" :15 , "./shapes/polygon" :16 , "./shapes/rect" :17 , "./shapes/zigzag" :18 , "./spriter " :19 , "./stagger " :20 , "./swirl " :21 , "./transit" : 22 , "./ tween/timeline" :23 , "./tween/tween" :24 , "./tween/tweener" :25 } ] , 6 :[ function ( require , module , exports ) {
1359
1360
var MotionPath , Timeline , Tween , easing , h , resize ,
1360
1361
bind = function ( fn , me ) { return function ( ) { return fn . apply ( me , arguments ) ; } ; } ;
1361
1362
@@ -1855,7 +1856,7 @@ MotionPath = (function() {
1855
1856
1856
1857
module . exports = MotionPath ;
1857
1858
1858
- } , { "./easing" :3 , "./h" :4 , "./tween/timeline" :22 , "./tween/tween" :23 , "./vendor/resize" :25 } ] , 7 :[ function ( require , module , exports ) {
1859
+ } , { "./easing" :3 , "./h" :4 , "./tween/timeline" :23 , "./tween/tween" :24 , "./vendor/resize" :26 } ] , 7 :[ function ( require , module , exports ) {
1859
1860
var PathEasing , h ;
1860
1861
1861
1862
h = require ( './h' ) ;
@@ -2557,6 +2558,132 @@ Zigzag = (function(superClass) {
2557
2558
module . exports = Zigzag ;
2558
2559
2559
2560
} , { "./bit" :10 } ] , 19 :[ function ( require , module , exports ) {
2561
+ var Spriter , Timeline , Tween , h ;
2562
+
2563
+ h = require ( './h' ) ;
2564
+
2565
+ Timeline = require ( './tween/timeline' ) ;
2566
+
2567
+ Tween = require ( './tween/tween' ) ;
2568
+
2569
+ Spriter = ( function ( ) {
2570
+ Spriter . prototype . _defaults = {
2571
+ duration : 500 ,
2572
+ delay : 0 ,
2573
+ easing : 'linear.none' ,
2574
+ repeat : 0 ,
2575
+ yoyo : false ,
2576
+ isRunLess : false ,
2577
+ isShowEnd : false ,
2578
+ onStart : null ,
2579
+ onUpdate : null ,
2580
+ onComplete : null
2581
+ } ;
2582
+
2583
+ function Spriter ( o1 ) {
2584
+ this . o = o1 != null ? o1 : { } ;
2585
+ if ( this . o . el == null ) {
2586
+ return h . error ( 'No "el" option specified, aborting' ) ;
2587
+ }
2588
+ this . _vars ( ) ;
2589
+ this . _extendDefaults ( ) ;
2590
+ this . _parseFrames ( ) ;
2591
+ if ( this . _frames . length <= 2 ) {
2592
+ h . warn ( "Spriter: only " + this . _frames . length + " frames found" ) ;
2593
+ }
2594
+ if ( this . _frames . length < 1 ) {
2595
+ h . error ( "Spriter: there is no frames to animate, aborting" ) ;
2596
+ }
2597
+ this . _createTween ( ) ;
2598
+ this ;
2599
+ }
2600
+
2601
+ Spriter . prototype . _vars = function ( ) {
2602
+ this . _props = h . cloneObj ( this . o ) ;
2603
+ this . el = this . o . el ;
2604
+ return this . _frames = [ ] ;
2605
+ } ;
2606
+
2607
+ Spriter . prototype . run = function ( o ) {
2608
+ return this . _tween . start ( ) ;
2609
+ } ;
2610
+
2611
+ Spriter . prototype . _extendDefaults = function ( ) {
2612
+ return h . extend ( this . _props , this . _defaults ) ;
2613
+ } ;
2614
+
2615
+ Spriter . prototype . _parseFrames = function ( ) {
2616
+ var frame , i , j , len , ref ;
2617
+ this . _frames = Array . prototype . slice . call ( this . el . children , 0 ) ;
2618
+ ref = this . _frames ;
2619
+ for ( i = j = 0 , len = ref . length ; j < len ; i = ++ j ) {
2620
+ frame = ref [ i ] ;
2621
+ frame . style . opacity = 0 ;
2622
+ }
2623
+ return this . _frameStep = 1 / this . _frames . length ;
2624
+ } ;
2625
+
2626
+ Spriter . prototype . _createTween = function ( ) {
2627
+ this . _timeline = new Timeline ( {
2628
+ duration : this . _props . duration ,
2629
+ delay : this . _props . delay ,
2630
+ yoyo : this . _props . yoyo ,
2631
+ repeat : this . _props . repeat ,
2632
+ easing : this . _props . easing ,
2633
+ onStart : ( function ( _this ) {
2634
+ return function ( ) {
2635
+ var base ;
2636
+ return typeof ( base = _this . _props ) . onStart === "function" ? base . onStart ( ) : void 0 ;
2637
+ } ;
2638
+ } ) ( this ) ,
2639
+ onComplete : ( function ( _this ) {
2640
+ return function ( ) {
2641
+ var base ;
2642
+ return typeof ( base = _this . _props ) . onComplete === "function" ? base . onComplete ( ) : void 0 ;
2643
+ } ;
2644
+ } ) ( this ) ,
2645
+ onUpdate : ( function ( _this ) {
2646
+ return function ( p ) {
2647
+ return _this . _setProgress ( p ) ;
2648
+ } ;
2649
+ } ) ( this )
2650
+ } ) ;
2651
+ this . _tween = new Tween ;
2652
+ this . _tween . add ( this . _timeline ) ;
2653
+ return ! this . _props . isRunLess && this . _startTween ( ) ;
2654
+ } ;
2655
+
2656
+ Spriter . prototype . _startTween = function ( ) {
2657
+ return setTimeout ( ( ( function ( _this ) {
2658
+ return function ( ) {
2659
+ return _this . _tween . start ( ) ;
2660
+ } ;
2661
+ } ) ( this ) ) , 1 ) ;
2662
+ } ;
2663
+
2664
+ Spriter . prototype . _setProgress = function ( p ) {
2665
+ var base , currentNum , proc , ref , ref1 ;
2666
+ proc = Math . floor ( p / this . _frameStep ) ;
2667
+ if ( this . _prevFrame !== this . _frames [ proc ] ) {
2668
+ if ( ( ref = this . _prevFrame ) != null ) {
2669
+ ref . style . opacity = 0 ;
2670
+ }
2671
+ currentNum = p === 1 && this . _props . isShowEnd ? proc - 1 : proc ;
2672
+ if ( ( ref1 = this . _frames [ currentNum ] ) != null ) {
2673
+ ref1 . style . opacity = 1 ;
2674
+ }
2675
+ this . _prevFrame = this . _frames [ proc ] ;
2676
+ }
2677
+ return typeof ( base = this . _props ) . onUpdate === "function" ? base . onUpdate ( p ) : void 0 ;
2678
+ } ;
2679
+
2680
+ return Spriter ;
2681
+
2682
+ } ) ( ) ;
2683
+
2684
+ module . exports = Spriter ;
2685
+
2686
+ } , { "./h" :4 , "./tween/timeline" :23 , "./tween/tween" :24 } ] , 20 :[ function ( require , module , exports ) {
2560
2687
2561
2688
var Stagger , Timeline , Transit , Tween , h ,
2562
2689
extend = function ( child , parent ) { for ( var key in parent ) { if ( hasProp . call ( parent , key ) ) child [ key ] = parent [ key ] ; } function ctor ( ) { this . constructor = child ; } ctor . prototype = parent . prototype ; child . prototype = new ctor ( ) ; child . __super__ = parent . prototype ; return child ; } ,
@@ -2694,7 +2821,7 @@ Stagger = (function(superClass) {
2694
2821
2695
2822
module . exports = Stagger ;
2696
2823
2697
- } , { "./h" :4 , "./transit" :21 , "./tween/timeline" :22 , "./tween/tween" :23 } ] , 20 :[ function ( require , module , exports ) {
2824
+ } , { "./h" :4 , "./transit" :22 , "./tween/timeline" :23 , "./tween/tween" :24 } ] , 21 :[ function ( require , module , exports ) {
2698
2825
2699
2826
var Swirl , Transit ,
2700
2827
extend = function ( child , parent ) { for ( var key in parent ) { if ( hasProp . call ( parent , key ) ) child [ key ] = parent [ key ] ; } function ctor ( ) { this . constructor = child ; } ctor . prototype = parent . prototype ; child . prototype = new ctor ( ) ; child . __super__ = parent . prototype ; return child ; } ,
@@ -2807,7 +2934,7 @@ Swirl = (function(superClass) {
2807
2934
2808
2935
module . exports = Swirl ;
2809
2936
2810
- } , { "./transit" :21 } ] , 21 :[ function ( require , module , exports ) {
2937
+ } , { "./transit" :22 } ] , 22 :[ function ( require , module , exports ) {
2811
2938
2812
2939
var Timeline , Transit , Tween , bitsMap , h ,
2813
2940
extend = function ( child , parent ) { for ( var key in parent ) { if ( hasProp . call ( parent , key ) ) child [ key ] = parent [ key ] ; } function ctor ( ) { this . constructor = child ; } ctor . prototype = parent . prototype ; child . prototype = new ctor ( ) ; child . __super__ = parent . prototype ; return child ; } ,
@@ -3476,7 +3603,7 @@ Transit = (function(superClass) {
3476
3603
3477
3604
module . exports = Transit ;
3478
3605
3479
- } , { "./h" :4 , "./shapes/bitsMap" :11 , "./tween/timeline" :22 , "./tween/tween" :23 } ] , 22 :[ function ( require , module , exports ) {
3606
+ } , { "./h" :4 , "./shapes/bitsMap" :11 , "./tween/timeline" :23 , "./tween/tween" :24 } ] , 23 :[ function ( require , module , exports ) {
3480
3607
var Timeline , easingModule , h ;
3481
3608
3482
3609
easingModule = require ( '../easing' ) ;
@@ -3675,7 +3802,7 @@ Timeline = (function() {
3675
3802
3676
3803
module . exports = Timeline ;
3677
3804
3678
- } , { "../easing" :3 , "../h" :4 } ] , 23 :[ function ( require , module , exports ) {
3805
+ } , { "../easing" :3 , "../h" :4 } ] , 24 :[ function ( require , module , exports ) {
3679
3806
var Tween , h , t ;
3680
3807
3681
3808
h = require ( '../h' ) ;
@@ -3870,7 +3997,7 @@ Tween = (function() {
3870
3997
3871
3998
module . exports = Tween ;
3872
3999
3873
- } , { "../h" :4 , "./tweener" :24 } ] , 24 :[ function ( require , module , exports ) {
4000
+ } , { "../h" :4 , "./tweener" :25 } ] , 25 :[ function ( require , module , exports ) {
3874
4001
var Tweener , h , i , t ;
3875
4002
3876
4003
require ( '../polyfills/raf' ) ;
@@ -3957,7 +4084,7 @@ t = new Tweener;
3957
4084
3958
4085
module . exports = t ;
3959
4086
3960
- } , { "../h" :4 , "../polyfills/performance" :8 , "../polyfills/raf" :9 } ] , 25 :[ function ( require , module , exports ) {
4087
+ } , { "../h" :4 , "../polyfills/performance" :8 , "../polyfills/raf" :9 } ] , 26 :[ function ( require , module , exports ) {
3961
4088
3962
4089
/*!
3963
4090
LegoMushroom @legomushroom http://legomushroom.com
0 commit comments