Skip to content

Commit

Permalink
#147 feat: Videoのタイムラインとスクリーンの連動を改修
Browse files Browse the repository at this point in the history
  • Loading branch information
ienaga committed Jul 21, 2024
1 parent 358393c commit 9e05d71
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const execute = (
return canvas;
}

console.log(video.duration);
video.currentTime = sec;
context.drawImage(video, 0, 0, width, height);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ export const execute = async (
): Promise<HTMLDivElement> => {

const movieClip = work_space.scene;
const sec = Math.min(
const sec = Math.min(instance.duration, Math.min(
character.endFrame,
movieClip.currentFrame - 1
) / work_space.stage.fps;
) / work_space.stage.fps);

const cacheKey = character.cacheKey + "_" + sec;
let canvas = $getCacheCanvas(work_space.id, instance.id, cacheKey);
Expand Down
12 changes: 12 additions & 0 deletions src/js/core/domain/model/Video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,18 @@ export class Video extends Instance
}
}

/**
* @description 映像の幅を返却
* Returns the width of the image
*
* @member {number}
* @public
*/
get duration (): number
{
return this._$video ? this._$video.duration : 0;
}

/**
* @description データを読み込み、再生可能になったら完了
* When data is loaded and ready for playback, it is done.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,5 @@ export const execute = async (event: PointerEvent): Promise<void> =>
const x = left - $getScreenOffsetLeft();
const y = top - $getScreenOffsetTop();

console.log(x, $getScrollLimitY);
console.log(x, y);
};

0 comments on commit 9e05d71

Please sign in to comment.