@lijuhong1981/jsgif 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +34 -3
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -461,9 +461,13 @@ function GifPlayer(options = {}) {
|
|
|
461
461
|
CANVAS_CTX.drawImage(TEMP_CANVAS, 0, 0);
|
|
462
462
|
}
|
|
463
463
|
|
|
464
|
-
function
|
|
464
|
+
function drawCurrentFrame() {
|
|
465
465
|
const frame = FRAME_LIST[currentFrameIndex];
|
|
466
466
|
drawFrame(frame);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
function doFrame() {
|
|
470
|
+
drawCurrentFrame();
|
|
467
471
|
if (typeof options.onFrameChanged === 'function') {
|
|
468
472
|
options.onFrameChanged(currentFrameIndex, frame);
|
|
469
473
|
}
|
|
@@ -471,7 +475,7 @@ function GifPlayer(options = {}) {
|
|
|
471
475
|
if (!isPlaying)
|
|
472
476
|
return;
|
|
473
477
|
currentFrameIndex = getNextFrameIndex();
|
|
474
|
-
|
|
478
|
+
doFrame();
|
|
475
479
|
}, frame.delayTime * options.timeScale * 10);
|
|
476
480
|
}
|
|
477
481
|
|
|
@@ -482,7 +486,7 @@ function GifPlayer(options = {}) {
|
|
|
482
486
|
|
|
483
487
|
isPlaying = true;
|
|
484
488
|
|
|
485
|
-
|
|
489
|
+
doFrame();
|
|
486
490
|
|
|
487
491
|
return player;
|
|
488
492
|
}
|
|
@@ -497,6 +501,7 @@ function GifPlayer(options = {}) {
|
|
|
497
501
|
isPlaying = false;
|
|
498
502
|
|
|
499
503
|
currentFrameIndex = 0;
|
|
504
|
+
drawCurrentFrame();
|
|
500
505
|
|
|
501
506
|
return player;
|
|
502
507
|
}
|
|
@@ -548,43 +553,58 @@ function GifPlayer(options = {}) {
|
|
|
548
553
|
value: loadData,
|
|
549
554
|
},
|
|
550
555
|
loadUrl: {
|
|
556
|
+
configurable: true,
|
|
557
|
+
writable: true,
|
|
551
558
|
value: loadUrl,
|
|
552
559
|
},
|
|
553
560
|
play: {
|
|
561
|
+
configurable: true,
|
|
562
|
+
writable: true,
|
|
554
563
|
value: playGif,
|
|
555
564
|
},
|
|
556
565
|
pause: {
|
|
566
|
+
configurable: true,
|
|
567
|
+
writable: true,
|
|
557
568
|
value: pauseGif,
|
|
558
569
|
},
|
|
559
570
|
stop: {
|
|
571
|
+
configurable: true,
|
|
572
|
+
writable: true,
|
|
560
573
|
value: stopGif,
|
|
561
574
|
},
|
|
562
575
|
canvas: {
|
|
576
|
+
configurable: true,
|
|
563
577
|
get: function () {
|
|
564
578
|
return CANVAS;
|
|
565
579
|
},
|
|
566
580
|
},
|
|
567
581
|
atlasCanvas: {
|
|
582
|
+
configurable: true,
|
|
568
583
|
get: function () {
|
|
569
584
|
return ATLAS_CANVAS;
|
|
570
585
|
},
|
|
571
586
|
},
|
|
572
587
|
frameWidth: {
|
|
588
|
+
configurable: true,
|
|
573
589
|
get: function () {
|
|
574
590
|
return CANVAS.width;
|
|
575
591
|
}
|
|
576
592
|
},
|
|
577
593
|
frameHeight: {
|
|
594
|
+
configurable: true,
|
|
578
595
|
get: function () {
|
|
579
596
|
return CANVAS.height;
|
|
580
597
|
}
|
|
581
598
|
},
|
|
582
599
|
framesNumber: {
|
|
600
|
+
configurable: true,
|
|
583
601
|
get: function () {
|
|
584
602
|
return FRAME_LIST.length;
|
|
585
603
|
}
|
|
586
604
|
},
|
|
587
605
|
currentFrameIndex: {
|
|
606
|
+
configurable: true,
|
|
607
|
+
writable: true,
|
|
588
608
|
set: function (value) {
|
|
589
609
|
if (!FRAME_LIST[value])
|
|
590
610
|
throw new Error('illegal index: ' + value);
|
|
@@ -595,11 +615,14 @@ function GifPlayer(options = {}) {
|
|
|
595
615
|
}
|
|
596
616
|
},
|
|
597
617
|
frameList: {
|
|
618
|
+
configurable: true,
|
|
598
619
|
get: function () {
|
|
599
620
|
return FRAME_LIST;
|
|
600
621
|
}
|
|
601
622
|
},
|
|
602
623
|
reverse: {
|
|
624
|
+
configurable: true,
|
|
625
|
+
writable: true,
|
|
603
626
|
set: function (value) {
|
|
604
627
|
Check.typeOf.bool('reverse', value);
|
|
605
628
|
options.reverse = value;
|
|
@@ -609,6 +632,8 @@ function GifPlayer(options = {}) {
|
|
|
609
632
|
}
|
|
610
633
|
},
|
|
611
634
|
timeScale: {
|
|
635
|
+
configurable: true,
|
|
636
|
+
writable: true,
|
|
612
637
|
set: function (value) {
|
|
613
638
|
Check.typeOf.number.greaterThan('timeScale', value, 0);
|
|
614
639
|
options.timeScale = value;
|
|
@@ -618,6 +643,8 @@ function GifPlayer(options = {}) {
|
|
|
618
643
|
}
|
|
619
644
|
},
|
|
620
645
|
onFrameChanged: {
|
|
646
|
+
configurable: true,
|
|
647
|
+
writable: true,
|
|
621
648
|
set: function (value) {
|
|
622
649
|
options.onFrameChanged = value;
|
|
623
650
|
},
|
|
@@ -626,11 +653,15 @@ function GifPlayer(options = {}) {
|
|
|
626
653
|
}
|
|
627
654
|
},
|
|
628
655
|
isDestroyed: {
|
|
656
|
+
configurable: true,
|
|
657
|
+
writable: true,
|
|
629
658
|
value: function () {
|
|
630
659
|
return false;
|
|
631
660
|
},
|
|
632
661
|
},
|
|
633
662
|
destroy: {
|
|
663
|
+
configurable: true,
|
|
664
|
+
writable: true,
|
|
634
665
|
value: destroyGif,
|
|
635
666
|
},
|
|
636
667
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lijuhong1981/jsgif",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "lijuhong1981",
|
|
6
6
|
"homepage": "https://github.com/lijuhong1981/jslibs#readme",
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
"bugs": {
|
|
19
19
|
"url": "https://github.com/lijuhong1981/jslibs/issues"
|
|
20
20
|
},
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "41eaaf2e07770b704c80b27f40b0f033e80dfe9e"
|
|
22
22
|
}
|