Hi everyone,
I am new to OpenFrameworks and am learning the basics. I was wondering how to create a mouse following circle with easing using the ofxTween library.
I have hacked something together based on the example comes with ofxTween. But it doesn’t work.
Below is the my code.
#include “ofApp.h”
int xPos, yPos;
//--------------------------------------------------------------
void ofApp::setup(){
ofBackground(30);
ofSetCircleResolution(64);
xPos = ofGetWidth()/2;
yPos = ofGetHeight()/2;
unsigned delay = 0;
unsigned duration = 5000;
tweenquad.setParameters(8,easingquad,ofxTween::easeInOut,xPos,mouseX,duration,delay);
ofSetColor(255, 0, 0);
}
//--------------------------------------------------------------
void ofApp::update(){
}
//--------------------------------------------------------------
void ofApp::draw(){
// ofRect(20,260,tweenquad.update(),20);
// ofCircle(x, y, tweenquad.update());
ofCircle(xPos, yPos, 80);
}
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
}
//--------------------------------------------------------------
void ofApp::keyReleased(int key){
}
//--------------------------------------------------------------
void ofApp::mouseMoved(int x, int y ){
xPos = x;
yPos = y;
}
Thank you for your time in advance.
-Frank