@cuinjune wrote:
Hi, I'm trying to replicate this Processing example.
https://processing.org/examples/pattern.htmlAnd here's the code I wrote in OF.
//-------------------------------------------------------------- void ofApp::setup(){ ofSetBackgroundColor(102); ofSetCircleResolution(50); ofSetLineWidth(2); fbo.allocate(ofGetWidth(), ofGetHeight(), GL_RGB); fbo.begin(); ofClear(102,102,102); fbo.end(); } //-------------------------------------------------------------- void ofApp::update(){ fbo.begin(); variableEllipse(mouseX, mouseY, pmouseX, pmouseY); fbo.end(); } //-------------------------------------------------------------- void ofApp::draw(){ fbo.draw(0, 0); } void ofApp::variableEllipse(int x, int y, int px, int py) { float speed = abs(x-px) + abs(y-py); ofSetColor(0); ofNoFill(); ofDrawEllipse(x, y, speed, speed); ofSetColor(255); ofFill(); ofDrawEllipse(x, y, speed, speed); pmouseX = mouseX; pmouseY = mouseY; }
But currently, there are 2 problems with my code.
- A huge circle is drawn in the beginning when I start to move the mouse on OF window.
- The stroke is not as soft/clean as Processing's.
I would appreciate if any advice to fix the issues and also would like to hear if there's any better/simpler way to replicate the Processing example.
Posts: 1
Participants: 1