-
Notifications
You must be signed in to change notification settings - Fork 0
/
ofApp.cpp
55 lines (37 loc) · 1.2 KB
/
ofApp.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup() {
ofSetFrameRate(25);
ofSetWindowTitle("openFrameworks");
ofBackground(239);
ofEnableDepthTest();
}
//--------------------------------------------------------------
void ofApp::update() {
}
//--------------------------------------------------------------
void ofApp::draw() {
this->cam.begin();
ofRotateX(15);
auto radius = 230;
ofColor color;
for (int y = 0; y <= 1200; y += 30) {
auto param = ofGetFrameNum() * 5 + y;
for (int deg_start = param; deg_start < param + 360; deg_start += 90)
{
for (int deg = deg_start; deg < deg_start + 30; deg++) {
auto alpha = ofMap(deg, deg_start, deg_start + 45, 0, 255);
auto hue = ofMap(y % 100, 0, 100, 0, 255);
color.setHsb(hue, 150, 255, alpha);
ofSetColor(color);
ofDrawSphere(radius * cos(deg * DEG_TO_RAD), y - 600, radius * sin(deg * DEG_TO_RAD), ofMap(deg, deg_start, deg_start + 30, 1, 7));
}
}
}
this->cam.end();
}
//--------------------------------------------------------------
int main() {
ofSetupOpenGL(720, 720, OF_WINDOW);
ofRunApp(new ofApp());
}