Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

To make the motion of a waveform with a circle

$
0
0

@jewel wrote:

I’d like to make a circle. But the circle is moving too fast. How can we solve this?

#include "ofApp.h"

    //--------------------------------------------------------------
 void ofApp::setup(){
amplitude = 300;
period = 240;
angle = 0;
Avelocity = 0.05;
startAngle = 0.02;

}
//--------------------------------------------------------------

void ofApp::update(){
	

}



//--------------------------------------------------------------                                
void ofApp::draw() {
for (int i = 0; i < ofGetWidth(); i += 24) {	
	y =ofMap(sin(angle),-1,1,0,ofGetHeight());
	ofDrawCircle(i, y , 10);
	angle += Avelocity;
}
}

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles