Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Dec 5, 2018. It is now read-only.

clear() is not defined #261

Open
JamesWClark opened this issue Sep 1, 2016 · 2 comments
Open

clear() is not defined #261

JamesWClark opened this issue Sep 1, 2016 · 2 comments

Comments

@JamesWClark
Copy link

The clear() function clears a pixels buffer. Even if this buffers concept doesn't exist in Processing.js, adding a function that does nothing will be better than having code examples that won't run.

clear() is not defined

https://processing.org/reference/clear_.html

@Pomax
Copy link
Member

Pomax commented Sep 4, 2016

odd that it's not in already, given that PGraphics is supported (at least the Processing 2.0 API version). Marking as good first bug.

@JamesWClark
Copy link
Author

JamesWClark commented Sep 4, 2016

This is the code snippet I was looking at.

background(500);
clear();
rect(50, 60, 70, 100);
size(100, 100);
arc(50, 60, 90, 80, 80, 100);

In the above example, I can try to instantiate a Processing object and catch its error and use it on my page.

try {
    new Processing(canvas, code);
} catch (err) {
    $('#error-message').html(err);
}

Then used in setup and draw as below, an error message is not thrown that I can catch. The error message generated below is logged in the browser console from processing.min.js:896, version 1.6.0. I am not able to catch this one using the same code as above.

void setup() {
    size(200,200,P3D);
}
void draw() {
    clear();
    box(125,125,125);
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants