-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
No example given for beginShape(TESS) #5125
Copy link
Copy link
Closed
Description
This issue has already been mentioned:
#3672
Most appropriate sub-area of p5.js?
- Accessibility (Web Accessibility)
- Build tools and processes
- Color
- Core/Environment/Rendering
- Data
- DOM
- Events
- Friendly error system
- Image
- IO (Input/Output)
- Localization
- Math
- Unit Testing
- Typography
- Utilities
- WebGL
- Other (specify if possible)
Details about the bug:
- p5.js version: p5.js v1.2.0 December 19, 2020
- Web browser and version: Microsoft Edge | 89.0.774.57
- Operating System: Windows 10
- Steps to reproduce this:
function setup() {
createCanvas(800, 800, WEBGL);
}
function mouseOnCanvas() {
return mouseX > 0 && mouseX < width && mouseY < height && mouseY > 0;
}
function makeSine(relStart = -width / 2, absEnd = height, amplitude = 200, wavelenght = 0.025, heightOffset = 0, resolution = 10) {
for (let i = 0 + relStart; i <= absEnd; i++) {
if (i % resolution === 0) vertex(i, Math.sin(i * wavelenght) * amplitude + heightOffset);
}
}
function makeSineReverse(absEnd, relStart, amplitude, wavelenght, heightOffset, resolution = 10) {
for (let i = 0 + relStart; i >= absEnd; i--) {
if (i % resolution === 0) vertex(i, Math.sin(i * wavelenght) * amplitude + heightOffset);
}
}
function drawShape() {
let relStart = -200,
absEnd = 300,
amplitude = 50,
wavelenght = 0.017,
top = -150,
bottom = 150,
resolution = 20; // the lower the better
beginShape();
makeSine(relStart, absEnd, amplitude, wavelenght, top, resolution);
makeSineReverse(relStart, absEnd, amplitude, wavelenght, bottom, resolution);
endShape(CLOSE);
}
function draw() {
background(0);
strokeWeight(4);
stroke(255);
noFill();
// noStroke();
fill(255, 0, 0);
drawShape();
}
Reactions are currently unavailable
