跳到主要内容

翻转

2024年06月19日
柏拉文
越努力,越幸运

一、认识


二、实现


const canvas = document.getElementById("canvas");
const context = canvas.getContext('2d');

function draw(){
context.clearRect(0, 0, canvas.width, canvas.height);
context.save();
context.translate(canvas.width, 0);
context.scale(-1, 1);
context.drawImage(image/video, 0, 0, targetWidth, targetHeight);
context.restore();
requestAnimationFrame(draw);
}