Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ofMain.h"
- class ofApp : public ofBaseApp{
- public:
- float tileCount = 20;
- ofVec3f moduleColor = ofVec3f(0);
- int moduleAlpha = 100;
- int actRandomSeed = 0;
- int max_distance = 500;
- void setup(){
- ofEnableSmoothing();
- }
- void draw(){
- ofBackground(255);
- ofNoFill();
- ofSeedRandom(actRandomSeed);
- for (int gridY=0; gridY<ofGetHeight(); gridY+=25) {
- for (int gridX=0; gridX<ofGetWidth(); gridX+=25) {
- float diameter = ofDist(mouseX, mouseY, gridX, gridY);
- diameter = diameter / max_distance * 40;
- ofSetLineWidth(3);
- ofSetColor(moduleColor.x,moduleColor.y,moduleColor.z, moduleAlpha);
- ofPushMatrix();
- ofTranslate(gridX, gridY,diameter*5);
- ofDrawRectangle(0, 0, diameter, diameter);
- ofPopMatrix();
- }
- }
- }
- void mousePressed(int x, int y, int button){
- actRandomSeed = (int)ofRandom(100000);
- }
- };
- //========================================================================
- int main( ){
- ofSetupOpenGL(600,600,OF_WINDOW); // <-------- setup the GL context
- // this kicks off the running of my app
- // can be OF_WINDOW or OF_FULLSCREEN
- // pass in width and height too:
- ofRunApp(new ofApp());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement