-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: turned P5.JS sketch into simple drawing app to test funtionality
- Loading branch information
Christian Alexander Loizou
committed
Jan 15, 2021
1 parent
39a5a5c
commit c7695a7
Showing
3 changed files
with
29 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,31 @@ | ||
// What to do here... | ||
const ELLIPSE_SIZE = 25; | ||
|
||
var positions; | ||
|
||
|
||
function setup() { | ||
createCanvas(800, 800); | ||
positions = []; | ||
} | ||
|
||
function draw() { | ||
background(51); | ||
rectMode(CENTER); | ||
ellipse(mouseX, mouseY, 75, 75, 15); | ||
noStroke(); | ||
fill(120); | ||
positions.forEach(function (vector, index) { | ||
ellipse(vector.x, vector.y, ELLIPSE_SIZE); | ||
}); | ||
fill(118, 118, 125); | ||
ellipse(mouseX, mouseY, ELLIPSE_SIZE); | ||
|
||
} | ||
|
||
function mousePressed() { | ||
position = createVector(mouseX, mouseY); | ||
positions.push(position); | ||
} | ||
|
||
function mouseDragged() { | ||
position = createVector(mouseX, mouseY); | ||
positions.push(position); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
body { | ||
padding: 0; | ||
margin: 0; | ||
width: 100%; | ||
height: auto; | ||
background-color: #436445; | ||
} | ||
|
||
a { | ||
color: #000000; | ||
font-family: Arial, Helvetica, sans-serif; | ||
text-decoration: none; | ||
margin: 20px 30px; | ||
|
||
outline: 2px dashed black; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<script src= {{ url_for('static', filename='/js/sketch.js')}}></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/p5.js"></script> | ||
<style> {{ _style }} </style> | ||
<title>P5.JS Sketch</title> | ||
</head> | ||
|
||
|