Skip to content

Commit

Permalink
adds light example
Browse files Browse the repository at this point in the history
  • Loading branch information
Maoyeedy committed Oct 5, 2024
1 parent 7dd77b3 commit 01f760d
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lights.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Maoyeedy Gamejam</title>
<link rel="icon" href="public/favicon.webp" type="image/x-icon">
<!-- <link rel="icon" href="public/faviconRound.webp" type="image/x-icon"> -->
<link rel="stylesheet" href="style.css">

<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.10.0/p5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.10.0/addons/p5.sound.min.js"></script>
</head>

<body>
<script src="lights.js"></script>
</body>

</html>
32 changes: 32 additions & 0 deletions lights.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Click and drag the mouse to view the scene from different angles.

function setup () {

document.oncontextmenu = () => false
cvs = createCanvas(windowWidth, windowHeight, WEBGL)

describe('A white box drawn against a gray background.')
}

function draw () {
background(50)
// Enable orbiting with the mouse.
orbitControl()

// Turn on the lights.
ambientLight(128, 128, 128)
directionalLight(128, 128, 128, 0, 0, -1)

// Draw the box.
box(50)

//draw a plane under the box
push()
rotateX(HALF_PI)
translate(0, 0, -25)
plane(200, 200)
// translate(0, 0, -50)
// box(200, 200, 50)
pop()

}

0 comments on commit 01f760d

Please sign in to comment.