Skip to content

Commit 5fea07e

Browse files
author
Danny
committed
Setup p5 Canvas with shapes
1 parent cc5cc85 commit 5fea07e

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

app.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
function setup() {
2+
createCanvas(640, 480);
3+
4+
}
5+
function draw () {
6+
noStroke();
7+
fill(0,255,0);
8+
rect(320, 240, 20, 20);
9+
10+
fill(255,0,0);
11+
circle(500, 100, 20)
12+
13+
stroke(0,0,255);
14+
strokeWeight(3);
15+
line(0, 40, 640, 40);
16+
}

index.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Intro to JavaScript</title>
8+
<style> canvas { border: 1px solid black;}</style>
9+
</head>
10+
<body>
11+
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.9.0/p5.min.js
12+
"></script> <script src="app.js"></script>
13+
</body>
14+
</html>

0 commit comments

Comments
 (0)