|
@@ -98,9 +98,16 @@ export class CanvasPlayer extends Mitt {
|
|
};
|
|
};
|
|
this.clips.push(clip);
|
|
this.clips.push(clip);
|
|
for (let key = 0; key < item.total; key++) {
|
|
for (let key = 0; key < item.total; key++) {
|
|
- const padLength = item.total.toString().length + 1;
|
|
|
|
- let imgIndex = String(key).padStart(padLength, "0");
|
|
|
|
|
|
+ let imgIndex;
|
|
|
|
+ // const padLength = item.total.toString().length;
|
|
|
|
+ if (key < 1000) {
|
|
|
|
+ imgIndex = String(key).padStart(4, "0");
|
|
|
|
+ } else {
|
|
|
|
+ imgIndex = key;
|
|
|
|
+ }
|
|
|
|
+
|
|
let url = `${item.imageUrl}/${imgIndex}.webp`;
|
|
let url = `${item.imageUrl}/${imgIndex}.webp`;
|
|
|
|
+ // console.log("url", url);
|
|
const res = this.loadImage(url).then((image) => {
|
|
const res = this.loadImage(url).then((image) => {
|
|
if (image) {
|
|
if (image) {
|
|
const frame = {
|
|
const frame = {
|
|
@@ -403,8 +410,7 @@ export class CanvasPlayer extends Mitt {
|
|
const frameItem = this.frames.find(
|
|
const frameItem = this.frames.find(
|
|
(item) => item.id == this.currentType && item.index == 1
|
|
(item) => item.id == this.currentType && item.index == 1
|
|
);
|
|
);
|
|
- this.context.clearRect(0, 0, this.vw, this.vh);
|
|
|
|
- this.context.drawImage(frameItem.image, 0, 0, this.vw, this.vh);
|
|
|
|
|
|
+ this.reDraw(this.currentFrame, this.currentType);
|
|
this.initClipScrollheight();
|
|
this.initClipScrollheight();
|
|
this.scrollAni = gsap.timeline();
|
|
this.scrollAni = gsap.timeline();
|
|
let doneScroll = () => {
|
|
let doneScroll = () => {
|
|
@@ -443,29 +449,8 @@ export class CanvasPlayer extends Mitt {
|
|
);
|
|
);
|
|
if (frameItem && frameItem.index <= frameItem.total) {
|
|
if (frameItem && frameItem.index <= frameItem.total) {
|
|
this.context.clearRect(0, 0, this.vw, this.vh);
|
|
this.context.clearRect(0, 0, this.vw, this.vh);
|
|
- if (isMobile()) {
|
|
|
|
- // var hRatio = this.vw / this.imageW;
|
|
|
|
- // var vRatio = this.vh / this.imageH;
|
|
|
|
- // var ratio = Math.min(hRatio, vRatio);
|
|
|
|
- // var centerShift_x = (this.vw - this.imageW * ratio) / 2;
|
|
|
|
- // var centerShift_y = (this.vh - this.imageH * ratio) / 2;
|
|
|
|
- // this.context.drawImage(
|
|
|
|
- // frameItem.image,
|
|
|
|
- // 0,
|
|
|
|
- // 0,
|
|
|
|
- // this.imageW,
|
|
|
|
- // this.imageH,
|
|
|
|
- // centerShift_x,
|
|
|
|
- // centerShift_y,
|
|
|
|
- // this.imageW * ratio,
|
|
|
|
- // this.imageH * ratio
|
|
|
|
- // );
|
|
|
|
-
|
|
|
|
- // var ratio =
|
|
|
|
- // frameItem.image.naturalWidth / frameItem.image.naturalHeight;
|
|
|
|
- // var width = this.vw;
|
|
|
|
- // var height = width / ratio;
|
|
|
|
|
|
|
|
|
|
+ if (isMobile()) {
|
|
const { offsetX, offsetY, width, height } = cover(
|
|
const { offsetX, offsetY, width, height } = cover(
|
|
this.vw,
|
|
this.vw,
|
|
this.vh,
|
|
this.vh,
|