canvas fake 3D

pixgram·2022년 2월 8일
0

focus length

const ctx = canvas.getContext('2d');
const focusLength = 300;
const pos = { x: 200, y: 200, z: 200 };
const perspective = focusLength / (focusLength + pos.z);
ctx.translate(pos.x * perspective, pos.y * perspective);
ctx.scale(perspective, perspective);
profile
Interactive Front-end Developer and WebGL Artist

0개의 댓글