Add completed perspective
This commit is contained in:
@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script src="p5.min.js"></script>
|
||||
<script src="sketch.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
3
CM2030 Graphics Programming/Topic 11/11.2.1 Perspective/p5.min.js
vendored
Normal file
3
CM2030 Graphics Programming/Topic 11/11.2.1 Perspective/p5.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,22 @@
|
||||
function setup() {
|
||||
createCanvas(900, 600, WEBGL);
|
||||
angleMode(DEGREES);
|
||||
}
|
||||
|
||||
function draw() {
|
||||
background(125);
|
||||
normalMaterial();
|
||||
camera(0, -200, height, 0, 0, 0, 0, 1, 0);
|
||||
// fit more objects
|
||||
perspective(100);
|
||||
// changing aspect ratio
|
||||
perspective(100, width/height, mouseY, mouseX);
|
||||
|
||||
for(let i=-600; i<=600; i+=100)
|
||||
{
|
||||
push();
|
||||
translate(i, 0, 0);
|
||||
box(80, 80, 500);
|
||||
pop();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user