Skip to content

Instantly share code, notes, and snippets.

@tado
Created May 7, 2024 06:30
Show Gist options
  • Save tado/92b73d8e873dcc6b08489933f608b868 to your computer and use it in GitHub Desktop.
Save tado/92b73d8e873dcc6b08489933f608b868 to your computer and use it in GitHub Desktop.
openFrameworks Animation Basic Template
#include "ofApp.h"
void ofApp::setup() {
locationX = ofGetWidth() / 2.0;
locationY = ofGetHeight() / 2.0;
velocityX = ofRandom(-10, 10);
velocityY = ofRandom(-10, 10);
}
void ofApp::update() {
locationX += velocityX;
locationY += velocityY;
}
void ofApp::draw() {
ofSetColor(255);
ofDrawCircle(locationX, locationY, 20);
}
#pragma once
#include "ofMain.h"
class ofApp : public ofBaseApp {
public:
void setup();
void update();
void draw();
float locationX;
float locationY;
float velocityX;
float velocityY;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment