//-------------------------------------------------------------- void ofApp::setup(){ ofSeedRandom(0); ofSetLineWidth(3); ofSetRectMode(OF_RECTMODE_CENTER); //---------------------------------------------------------------- // the data is stored in a big flat array, let's copy it into something more managable for (int i = 0; i < 30; i++){ for (int j = 0; j < 24; j++){ float x = data3d[ i * 24 * 3 + j * 3 + 0 ]; float y = data3d[ i * 24 * 3 + j * 3 + 1 ]; float z = data3d[ i * 24 * 3 + j * 3 + 2 ]; frames[i][j].set(x,y,z); } } n1.set(0, 0,1); n2.set(0,1,0); n3.set(0,0,1); plane1.set(ofPoint(0,0,300), n1); plane2.set(ofPoint(0,300,0), n2); plane3.set(ofPoint(0,0,-300),n3); }
void Neuron::display() { for (int i = 0; i < connections.size(); i++) { connections[i].display(); } float radiusInc = 0; if(fireFrame>0){ radiusInc = sin(fireFrame * 0.1) * 10; if(radiusInc<0){ radiusInc = 0; fireFrame = 0; } else { fireFrame++; } } ofNoFill(); ofSetColor(0,0,0); ofSetLineWidth(2); ofCircle(location.x,location.y,16 + radiusInc); ofFill(); ofSetColor(0,0,0,ofMap(sum,0,1.0,0,255)); ofCircle(location.x,location.y,15 + radiusInc); }
//-------------------------------------------------------------- void ofApp::draw() { glEnable( GL_DEPTH_TEST ); camera.begin(); ofSetLineWidth(1.f); ofSetColor(255, 0, 200); world.drawDebug(); ofSetColor(5, 100, 100); ground.draw(); ofSetColor(225, 225, 225); sphere->draw(); worldCenterX = sphere->getPosition().x; worldCenterY = sphere->getPosition().y; worldCenterZ = sphere->getPosition().z; ofSetColor(100, 0, 0); //placement for (int i = 0; i < earthquakePoints.size(); i++){ //cout << earthquakePoints[i] << endl; ofDrawSphere(earthquakePoints[i].x + worldCenterX, earthquakePoints[i].y + worldCenterY, earthquakePoints[i].z + worldCenterZ, 0.03); } //movement camera.end(); }
//-------------------------------------------------------------- void ofApp::draw() { float angle = 0; float angleVel = 0.2; float amplitude = 100; ofEnableSmoothing(); ofNoFill(); ofSetLineWidth(2); ofSetColor(0,0,0); ofBeginShape(); for (int x = 0; x <= ofGetWindowWidth(); x += 5) { float y = ofMap(sin(angle),-1,1,0,ofGetWindowHeight()); ofVertex(x,y); angle += angleVel; } ofEndShape(); }
// ------------------- draw a circle with pink polka dots inside void ofApp::drawaPolkaDotO(float xPos, float yPos, float scale){ ofPushMatrix(); // we're going to push this thing ofTranslate(xPos, yPos); // push it this far. Why is this a variable and not a fixed number? ofScale(scale, scale); //scale it this much float CircCenterBX, CircCenterBY, CircRadius; CircCenterBX = 0; CircCenterBY = 0; CircRadius = 100; // why am i defining this here? ofSetColor(myOutlines); ofNoFill(); ofSetLineWidth(6); ofCircle(CircCenterBX,CircCenterBY,CircRadius); // centerx, centery, radius - this is drawing the black outline to be at 0,0,100 radius ofSetColor(yellow); //now i'm doing the polka dots ofFill(); float circleX = CircCenterBY; float circleY = CircCenterBX; float circleRadius = CircRadius; for (int i = -circleRadius; i < circleRadius; i = i + 20) { //scoot it over 20 each time for (int k = -circleRadius; k < circleRadius; k = k + 20) { //scoot it over 20 each time float distance = ofDist(CircCenterBX, CircCenterBY, i, k); if (distance < circleRadius-4){ if ((k/20) % 2 == 0) { // is k even or not ? ofCircle(k,i,4); } else { ofCircle(k,i + 10,4); } } } } ofPopMatrix(); //now we're done, reset coordinates to normal }
void ofxCalibImage::drawImageGrid(){ ofPushStyle(); ofPushView(); ofSetLineWidth(2); ofSetColor(0, 0, 255); for(int i=0; i< (int) mvGridCorners.size(); i++){ for(int dirn=0; dirn<4; dirn++) if(mvGridCorners[i].aNeighborStates[dirn].val > i){ ofLine( mvGridCorners[i].Params.v2Pos[0], mvGridCorners[i].Params.v2Pos[1], mvGridCorners[mvGridCorners[i].aNeighborStates[dirn].val].Params.v2Pos[0], mvGridCorners[mvGridCorners[i].aNeighborStates[dirn].val].Params.v2Pos[1]); } } ofSetColor(255, 255, 0); ofNoFill(); for(unsigned int i=0; i<mvGridCorners.size(); i++) ofCircle(mvGridCorners[i].Params.v2Pos[0], mvGridCorners[i].Params.v2Pos[1], 3); ofPopStyle(); ofPopView(); };
//-------------------------------------------------------------- void ofApp::draw(){ face = 0; ofSetHexColor(0xFFFFFF); movie.draw(20,20); //imgg.draw(0,0); finder.findHaarObjects(movie.getPixelsRef()); //finder.findHaarObjects(imgg); cout<<"frame"<<ofGetFrameNum<<endl; cout<<endl; ofSetColor(255,0,0); ofSetLineWidth(4); ofNoFill(); for(unsigned int i = 0; i < finder.blobs.size(); i++) { ofRectangle cur = finder.blobs[i].boundingRect; if(cur.height > 200) { ofRect(cur.x, cur.y, cur.width, cur.height); face++; } } cout<<face<<endl; }
//-------------------------------------------------------------- void testApp::draw() { //draw OscWave GLSL float resolution[] = {320, 240}; float mousePoint[] = {mouseX, mouseY}; ofDisableBlendMode(); oscFbo.begin(); oscShader.begin(); oscShader.setUniform1f("time", ofGetElapsedTimef() - oscStartTime); oscShader.setUniform1f("num", oscNum); int n = int(oscNum); float ffreq[100]; for (int i = 0; i< oscFreq.size(); i++) { ffreq[i] = oscFreq[i]; } oscShader.setUniform1fv("oscFreq", ffreq, 64); oscShader.setUniform2fv("resolution", resolution); oscShader.setUniform2fv("mouse", mousePoint); ofRect(0, 0, ofGetWidth(), ofGetHeight()); oscShader.end(); oscFbo.end(); oscFbo.draw(0, 0, ofGetWidth(), ofGetHeight()); ofEnableBlendMode(OF_BLENDMODE_ADD); for (int i=0; i<rects.size(); i++) { rects[i]->draw(); } if (glitchMode) { glitch->draw(); } if (flickerMode) { flicker->draw(); } for (int i = 0; i < saws.size(); i++) { saws[i]->draw(); } ofSetLineWidth(1); // draw OscWave guide & log if (mode == 1) { ofVec2f currentPos; ofSetHexColor(0x666666); ofNoFill(); if (bMousePressed) { float dist = drawPos.distance(ofVec2f(mouseX, mouseY)); if (dist > 100.0) { dist = 100.0; } ofCircle(drawPos.x, drawPos.y, dist); ofLine(drawPos.x, drawPos.y, mouseX, mouseY); currentPos = drawPos; } else { currentPos = ofVec2f(mouseX, mouseY); } int note = int(ofMap(currentPos.y, 0, ofGetHeight(), 85, 1)); float freq = 20 + 20 * pow((13.0/12.0), note); float pan = ofMap(currentPos.x, 0, ofGetWidth(), -1.0, 1.0); ofLine(0, currentPos.y, ofGetWidth(), currentPos.y); ofLine(currentPos.x, 0, currentPos.x, ofGetWidth()); ofSetHexColor(0xffffff); ofDrawBitmapString(ofToString(freq,2), 5, currentPos.y - 10); ofDrawBitmapString(ofToString(pan,2), currentPos.x + 5, 10); ofDrawBitmapString("nOsc: " + ofToString(oscils.size()), 10, 22); ofFill(); } // draw MyRect or GlitchRect guide & log if (mode == 2 && bMousePressed) { ofNoFill(); ofSetColor(255, 255, 255, 63); ofRect(drawPos.x, drawPos.y, mouseX - drawPos.x, mouseY-drawPos.y); ofFill(); } // draw Glitch guide & log if (mode == 3) { ofSetHexColor(0xffffff); ofDrawBitmapString("amp: " + ofToString(glitch->amp, 4), 10, 22); } // draw Flickr guide & log if (mode == 4) { ofSetHexColor(0xffffff); ofDrawBitmapString("amp: " + ofToString(flicker->level, 4), 10, 22); } // Saw Lines if (mode == 5) { ofSetHexColor(0xffffff); ofDrawBitmapString("Num = " + ofToString(synthNum) , 10, 22); } // log ofSetHexColor(0xffffff); ofDrawBitmapString("mode: " + ofToString(mode) + ", frameRate: " + ofToString(ofGetFrameRate()), 10, 10); }
// fonction fait le rendu des entités géométriques de la scène void Renderer::drawScene() { // configurer la représentation visuelle des localisateurs ofFill(); ofSetLineWidth(2); ofSetColor(127); // copier la matrice de transformation courante sur le dessus de la pile ofPushMatrix(); // inverser l'axe Y pour qu'il pointe vers le haut ofScale(1, isFlipAxisY ? -1 : 1); // transformer l'origine de la scène au milieu de la fenêtre d'affichage ofTranslate(xCenter + xOffset, isFlipAxisY ? -yCenter : yCenter, zOffset); for(index = 0; index < locatorBufferHead; ++index) { ofPushMatrix(); if(isActiveTranslation) { // extraction des attributs de translation vectorPosition->x = locators[index].position[0]; vectorPosition->y = locators[index].position[1]; vectorPosition->z = locators[index].position[2]; } else { // attributs de translation par défaut vectorPosition->x = 0.0f; vectorPosition->y = 0.0f; vectorPosition->z = 0.0f; } // assignation des attributs de translation node->setPosition( vectorPosition->x, vectorPosition->y, vectorPosition->z); if(isActiveRotation) { // extraction des attributs de rotation vectorRotation->x = locators[index].rotation[0]; vectorRotation->y = locators[index].rotation[1]; vectorRotation->z = locators[index].rotation[2]; } else { // attributs de rotation par défaut vectorRotation->x = 0.0f; vectorRotation->y = 0.0f; vectorRotation->z = 0.0f; } // assignation des attributs de rotation node->setOrientation(*vectorRotation); if(isActiveDimension) { // extraction des attributs de dimension vectorDimension->x = locators[index].dimension[0]; vectorDimension->y = locators[index].dimension[1]; vectorDimension->z = locators[index].dimension[2]; } else { // attributs de dimension par défaut vectorDimension->x = 1.0f; vectorDimension->y = 1.0f; vectorDimension->z = 1.0f; } // assignation des attributs de dimension node->setScale( vectorDimension->x, vectorDimension->y, vectorDimension->z); // dessiner le localisateur node->draw(); ofPopMatrix(); } // dessiner l'origine de la scène drawLocator(10); // revenir à la matrice de transformation précédente dans la pile ofPopMatrix(); }
void ofxTLVideoPlayer::draw(){ if(player == NULL){ return; } if(player->isPlaying() && player->getSpeed() > 0.0){ // cout << " is playing player frame " << player->getCurrentFrame() << " current frame " << getCurrentFrame() << endl; if(timeline->getIsFrameBased()){ if(player->getCurrentFrame() < inFrame || player->getCurrentFrame() > outFrame){ // cout << "reset in frame from " << player->getCurrentFrame() << endl; player->setFrame(inFrame); // cout << " to: " << player->getCurrentFrame() << endl; } if(lastFrame > player->getCurrentFrame()){ currentLoop++; // cout << "LOOPED! with last frame " << lastFrame << " " << player->getCurrentFrame() << " current loop " << currentLoop << endl; } if(timeline->getOutFrame() < getCurrentFrame() || timeline->getInFrame() > getCurrentFrame() ){ if(timeline->getInFrame() > player->getCurrentFrame() && timeline->getLoopType() == OF_LOOP_NONE){ player->stop(); } else { //player->setFrame( timeline->getInFrame() % player->getTotalNumFrames()); selectFrame(timeline->getInFrame()); } } timeline->setCurrentFrame(getCurrentFrame()); lastFrame = player->getCurrentFrame(); } else{ if(timeline->getOutTime() < player->getPosition()*player->getDuration() || timeline->getInTime() > player->getPosition()*player->getDuration() ){ player->setFrame(timeline->getInOutRange().min * player->getTotalNumFrames()); } timeline->setCurrentTime( player->getPosition() * player->getDuration()); } } // cout << "in out is " << inFrame << " " << outFrame << endl; ofPushStyle(); if(thumbsEnabled && getDrawRect().height > 10){ ofSetColor(255); for(int i = 0; i < videoThumbs.size(); i++){ if(videoThumbs[i].visible){ videoThumbs[i].thumb.draw(videoThumbs[i].displayRect); } } for(int i = 0; i < videoThumbs.size(); i++){ if(videoThumbs[i].visible){ if (!thumbsEnabled) { ofFill(); ofSetColor(0); ofRect(videoThumbs[i].displayRect); } ofNoFill(); ofSetColor(255, 150, 0); ofDrawBitmapString(ofToString(videoThumbs[i].framenum), videoThumbs[i].displayRect.x+5, videoThumbs[i].displayRect.y+15); ofRect(videoThumbs[i].displayRect); } } } int selectedFrameX = screenXForIndex(selectedFrame); ofSetColor(0, 125, 255); ofLine(selectedFrameX, bounds.y, selectedFrameX, bounds.y+bounds.height); ofDrawBitmapString(ofToString(selectedFrame), selectedFrameX, bounds.y+35); if(inFrame != -1){ ofSetLineWidth(2); ofSetColor(timeline->getColors().highlightColor); int inFrameX = screenXForIndex(inFrame); int outFrameX = screenXForIndex(outFrame); ofLine(inFrameX, bounds.y, inFrameX, bounds.y+bounds.height); ofLine(outFrameX, bounds.y, outFrameX, bounds.y+bounds.height); ofSetColor(timeline->getColors().keyColor); ofDrawBitmapString("IN: " + ofToString(inFrameX), inFrameX + 5, bounds.y + 10); ofDrawBitmapString("OUT: " + ofToString(outFrameX), outFrameX + 5, bounds.y + bounds.height - 20); } ofPopStyle(); }
//-------------------------------------------------------------- void testApp::draw(){ ofSetColor(225); ofDrawBitmapString("AUDIO OUTPUT EXAMPLE", 32, 32); ofDrawBitmapString("press 's' to unpause the audio\npress 'e' to pause the audio", 31, 92); ofNoFill(); // draw the left channel: ofPushStyle(); ofPushMatrix(); ofTranslate(32, 150, 0); ofSetColor(225); ofDrawBitmapString("Left Channel", 4, 18); ofSetLineWidth(1); ofRect(0, 0, 900, 200); ofSetColor(245, 58, 135); ofSetLineWidth(3); ofBeginShape(); for (int i = 0; i < lAudio.size(); i++){ float x = ofMap(i, 0, lAudio.size(), 0, 900, true); ofVertex(x, 100 -lAudio[i]*180.0f); } ofEndShape(false); ofPopMatrix(); ofPopStyle(); // draw the right channel: ofPushStyle(); ofPushMatrix(); ofTranslate(32, 350, 0); ofSetColor(225); ofDrawBitmapString("Right Channel", 4, 18); ofSetLineWidth(1); ofRect(0, 0, 900, 200); ofSetColor(245, 58, 135); ofSetLineWidth(3); ofBeginShape(); for (int i = 0; i < rAudio.size(); i++){ float x = ofMap(i, 0, rAudio.size(), 0, 900, true); ofVertex(x, 100 -rAudio[i]*180.0f); } ofEndShape(false); ofPopMatrix(); ofPopStyle(); ofSetColor(225); string reportString = "volume: ("+ofToString(volume, 2)+") modify with -/+ keys\npan: ("+ofToString(pan, 2)+") modify with mouse x\nsynthesis: "; if( !bNoise ){ reportString += "sine wave (" + ofToString(targetFrequency, 2) + "hz) modify with mouse y"; }else{ reportString += "noise"; } ofDrawBitmapString(reportString, 32, 579); }
//-------------------------------------------------------------- void testApp::draw(){ ofEnableBlendMode(OF_BLENDMODE_SCREEN); lineBlurTarget.begin(); ofClear(0,0,0,0); ofPushStyle(); cam.begin(ofRectangle(0,0,1920,1080)); ofSetLineWidth( lineThickness *2); ofSetColor(255); traversal.setMode(OF_PRIMITIVE_LINE_STRIP); traversal.draw(); cam.end(); ofPopStyle(); lineBlurTarget.end(); renderTarget.begin(); ofClear(0,0,0,0); cam.begin(ofRectangle(0,0,1920,1080)); ofPushStyle(); ofSetColor(255); ofSetLineWidth( timeline.getValue("line width") ); lineAttenuate.begin(); lineAttenuate.setUniform1f("focalPlane", powf(timeline.getValue("line focal dist"),2)); lineAttenuate.setUniform1f("focalRange", powf(timeline.getValue("line focal range"),2)); lineAttenuate.setUniform1f("lineFade", lineAlpha); lineAttenuate.setUniform3f("attractor", trailHead.x, trailHead.y, trailHead.z); lineAttenuate.setUniform1f("radius", 300.); geometry.setMode(OF_PRIMITIVE_LINE_STRIP); geometry.draw(); lineAttenuate.end(); traversal.setMode(OF_PRIMITIVE_LINE_STRIP); traversal.draw(); //POINT SPRITES billboard.begin(); ofEnablePointSprites(); ofDisableArbTex(); nodeSpriteBasic.getTextureReference().bind(); ofSetColor(255*.5); //glPointSize(replicatePointSize); billboard.setUniform1f("minSize", replicatePointSize); billboard.setUniform3f("attractor", trailHead.x, trailHead.y, trailHead.z); billboard.setUniform1f("radius", 300.); nodeCloudPoints.drawVertices(); nodeSpriteBasic.getTextureReference().unbind(); //FUZZIES // glPointSize(pointSize); // ofSetColor(255*.15); // nodeRingSprite.getTextureReference().bind(); // nodeCloudPoints.drawVertices(); // nodeRingSprite.getTextureReference().unbind(); //NODES nodeSprite.getTextureReference().bind(); traversedNodePoints.drawVertices(); nodeSprite.getTextureReference().unbind(); billboard.end(); ofDisablePointSprites(); ofEnableArbTex(); ofPopStyle(); cam.end(); //line blur gaussianBlur.begin(); ofPushStyle(); //ofSetColor(255 * lineBlurFade); ofSetColor(255*lineBlurFade); gaussianBlur.setUniform1i("tex", 0); gaussianBlur.setUniform2f("sampleOffset", lineBlurAmount, 0); lineBlurTarget.getTextureReference().draw(0, 0, 1920, 1080); gaussianBlur.setUniform2f("sampleOffset", 0, lineBlurAmount); lineBlurTarget.getTextureReference().draw(0, 0,1920, 1080); gaussianBlur.end(); ofPopStyle(); renderTarget.end(); ofEnableAlphaBlending(); if(ofGetKeyPressed('=')){ lineBlurTarget.draw(fboRect.getX(), fboRect.getMaxY(), fboRect.width,-fboRect.height); } else{ renderTarget.draw(fboRect.getX(), fboRect.getMaxY(), fboRect.width,-fboRect.height); } if(rendering && timeline.getIsPlaying()){ char fileName[1024]; sprintf(fileName, "%sframe_%05d.png", renderFolder.c_str(), frameNum++); ofImage image; image.setUseTexture(false); renderTarget.readToPixels(image.getPixelsRef()); image.mirror(true, false); image.saveImage(string(fileName)); } timeline.draw(); gui.draw(); }
void Leaf::draw(float _xPos, float _yPos){ ofPushMatrix(); ofSetLineWidth(1); ofTranslate(_xPos, _yPos); ofScale(scaleFactor, scaleFactor); ofRotateZ(rotation); //draw leaf ofSetColor(leafColor); //draw left half of leaf ofBeginShape(); float x0 = 0; float x1 = x0 - leafWidth; float x2 = x0 - leafWidth/leafCurvature; float x3 = x0; float y0 = 0 - stemLength; float y1 = y0 - leafLength/3; float y2 = y1 - leafLength/3; float y3 = y0 - leafLength; ofVertex(x0,y0); ofBezierVertex(x1,y1,x2,y2,x3,y3); ofEndShape(); //draw middle part of leaf ofBeginShape(); x0 = 0; x1 = x0 - leafWidth; x2 = x0 - leafWidth/leafCurvature; x3 = x0; y0 = 0 - stemLength; y1 = y0 - leafLength/3; y2 = y1 - leafLength/2; y3 = y0 - leafLength/2; ofVertex(x0,y0); ofBezierVertex(x1,y1,x2,y2,x3,y3); ofEndShape(); //draw right half of leaf ofBeginShape(); x0 = 0; //don't need to redefine as float, because we are just reusing the variables created above x1 = x0 + leafWidth; x2 = x0 + leafWidth/leafCurvature; x3 = x0 + leafWidth/3; y0 = 0 - stemLength; y1 = y0 - leafLength/3; y2 = y1 - leafLength/3; y3 = y0 - leafLength; ofVertex(x0,y0); ofBezierVertex(x1,y1,x2,y2,x3,y3); ofEndShape(); //draw stem and veins of leaf ofSetColor(stemColor); ofRect(0,0 - (stemLength/2), stemWidth, stemLength); //MATH! ofTriangle(0 - stemWidth/2, 0 - stemLength, 0 + stemWidth/2, 0 - stemLength, 0, 0 - stemLength - 3*(leafLength/4)); cout << "x1 = "; cout << x1 << endl; cout << "x2 = "; cout << x2 << endl; ofPopMatrix(); }
int l_setLineWidth(lua_State *L) { ofSetLineWidth(luaL_checknumber(L, 1)); }
//-------------------------------------------------------------- void testApp::draw() { ofSetColor(255,255,255,blur); grayImage.draw(initX*factor, initY*factor, filmWidth*factor, filmHeight*factor); ofSetColor(0); ofRect(15, 25, 385, 130); ofSetColor(255); ofDrawBitmapString("blur amount +/- (0-255): "+ofToString(blur), 20, 40); ofDrawBitmapString("play videofile n/p: "+DIR.getName(vidIndex)+" ("+ofToString((vidIndex+1))+"/"+ofToString(numFiles)+")", 20, 55); ofDrawBitmapString("video zoomfactor i/o: "+ofToString(factor).substr(0,4), 20, 70); ofDrawBitmapString("frame: "+ofToString(frameIndex)+" / "+ofToString(vidPlayer.getTotalNumFrames()), 20, 85); ofDrawBitmapString("save Position: "+ofToString(saveFile), 20, 100); if (stable_points.size() >= 1) { float colorScale = 0.4; ofSetColor(0); ofRect(0, ofGetHeight()-colorImg.getHeight()*colorScale-30, colorImg.getWidth()*colorScale+30, colorImg.getHeight()*colorScale+30); ofSetColor(255,255,255,255); colorImg.draw(15, ofGetHeight()-colorImg.getHeight()*colorScale-15, colorImg.getWidth()*colorScale, colorImg.getHeight()*colorScale); ofSetLineWidth(1); for(int i=0; i<stable_points.size(); i++) { float sx = (stable_points[i].src_point.x * colorScale)+15; float sy = (stable_points[i].src_point.y * colorScale)+(ofGetHeight()-colorImg.getHeight() * colorScale)-15; ofSetColor(255,0,0); ofLine(sx-3, sy, sx+3, sy); ofLine(sx, sy-3, sx, sy+3); float dx = (stable_points[i].dst_point.x * colorScale)+15; float dy = (stable_points[i].dst_point.y * colorScale)+(ofGetHeight()-colorImg.getHeight() * colorScale)-15; ofSetColor(0,255,0); ofLine(dx-3, dy, dx+3, dy); ofLine(dx, dy-3, dx, dy+3); } } if (playToggle) { // Set new source to current dest stable_points.clear(); for(int i=0; i<count; i++) { tStablePoint pt; pt.src_point = act_points[i]; stable_points.push_back(pt); } } if(clearScreen) { initX = initializedX; initY = initializedY; ofBackground(0,0,0); clearScreen = false; } }
//-------------------------------------------------------------- void testApp::draw(){ float sine = sin(ofGetElapsedTimef()/10.0f) ; for (int i = 0; i < BUFFER_SIZE/2; i++) { ofPushMatrix(); ofTranslate(ofGetWidth()/2, 0); ofSetColor(255,150); ofRect(0, i*4, -freq[i]*10.0f, 2); ofPopMatrix(); //first moon float xorig = ofGetWidth()/4; float yorig = ofGetHeight()/3 + sine*100; ofFill(); for (int i = 0; i < 100; i++){ float radius = 10 + i * 2; float angle = ofGetElapsedTimef() * (1 + i / 1.0); float x = xorig + radius * cos(angle); float y = yorig + radius * -sin(angle); ofSetColor(247, 219, 126,freq[i]*2); ofCircle(x, y, -freq[i]*1.0f); } //------- //second moon ofPushMatrix(); ofTranslate(ofGetWidth()*3/4, ofGetHeight()/2-sine*100); ofNoFill(); ofSetLineWidth(1); ofScale(freq[i]/8.0f,freq[i]/8.0f); ofBeginShape(); ofSetColor(220,freq[i]*3.0f); for (int j = 0; j < 40; j++){ float radius2 = 5 + j * 2; float angle2 = ofGetElapsedTimef() * (1 + j / 3.0); float x = radius2 * cos(angle2); float y = radius2 * sin(angle2); ofVertex(x, y); } ofEndShape(); ofPopMatrix(); //------- } ofFill(); ofPushMatrix(); ofTranslate(0, ofGetHeight()); ofBeginShape(); ofVertex(0, ofGetHeight()); ofSetColor(40, 80, 20,150); for (int i = 0;i < FFTanalyzer.nAverages; i++){ // ofPoint posIn = (i*70, -FFTanalyzer.averages[i]*15); // ofPoint posOut; // float catchspeed = 0.9f; // posOut.x = catchspeed * posIn.x + (1-catchspeed) * posOut.x; // posOut.y = catchspeed * posIn.y + (1-catchspeed) * posOut.y; ofCurveVertex(i*70, -FFTanalyzer.averages[i]*15); } ofVertex(ofGetWidth(), ofGetHeight()); ofEndShape(); ofPopMatrix(); ofPushMatrix(); ofTranslate(0, ofGetHeight()); for (int i = 0 ; i< FFTanalyzer.nAverages; i++) { ofSetColor(255, FFTanalyzer.averages[i]*20); ofCircle(i*70, -FFTanalyzer.averages[i]*20, FFTanalyzer.averages[i]); } ofPopMatrix(); }
//---------- void Strip::rebuildBorders() { if (this->handlesEnabled) { auto count = this->elements.size(); for (int i = 0; i < count - 1; i++) { auto border = make_shared<Element>(); auto borderWeak = weak_ptr<Element>(border); //generic draw border->onDraw += [borderWeak](DrawArguments & args) { auto border = borderWeak.lock(); if (!border) { return; } ofPushStyle(); { if (border->isMouseDown() || border->isMouseDragging()) { ofFill(); ofSetLineWidth(0); ofSetColor(100); ofDrawRectangle(args.localBounds); } else if (border->isMouseOver()) { ofFill(); ofSetLineWidth(0); ofSetColor(50); ofDrawRectangle(args.localBounds); ofxCvGui::Utils::drawToolTip("Resize", args.localBounds.getCenter()); } } ofPopStyle(); }; //specific action (different movement) { auto action = [this, i, borderWeak](float movement, MouseArguments & mouseArgs) { auto border = borderWeak.lock(); if (!border) { return; } mouseArgs.takeMousePress(border); if (mouseArgs.isDragging(border) && mouseArgs.button == 0) { auto prevCellHeight = this->getCellSize(i); auto nextCellHeight = this->getCellSize(i + 1); prevCellHeight += movement; //** nextCellHeight -= movement; //** bool prevIsAuto = this->programmaticCellSizes[i] == -1; bool nextIsAuto = this->programmaticCellSizes[i + 1] == -1; auto bothAreAuto = prevIsAuto && nextIsAuto; if (bothAreAuto || nextIsAuto) { this->setUserCellSize(i, prevCellHeight); } if (bothAreAuto || prevIsAuto) { this->setUserCellSize(i + 1, nextCellHeight); } } }; if (this->direction == Direction::Horizontal) { border->onMouse += [action](MouseArguments & args) { action(args.movement.x, args); }; } else { border->onMouse += [action](MouseArguments & args) { action(args.movement.y, args); }; } } //generic action (reset) border->onMouseReleased += [this, borderWeak](MouseArguments & args) { if (args.button == 2) { this->resetUserCellSizes(); } }; this->borders->add(border); } this->layoutBorders(); } else { this->borders->clear(); } }
//-------------------------------------------------------------- void testApp::drawScene(bool isPreview){ glEnable(GL_DEPTH_TEST); if (isPreview) { ofPushStyle(); ofSetColor(150, 100, 100); ofDrawGrid(1.0f, 5.0f, true); ofSetColor(255); //-- //draw camera preview // headTrackedCamera.transformGL(); ofPushMatrix(); ofScale(0.002f, 0.002f, 0.002f); ofNode().draw(); ofPopMatrix(); ofMultMatrix(headTrackedCamera.getProjectionMatrix().getInverse()); ofPushStyle(); ofNoFill(); ofBox(2.0f); ofPopStyle(); headTrackedCamera.restoreTransformGL(); // //-- //-- //draw window preview // ofMesh window; window.addVertex(windowTopLeft); window.addVertex(windowBottomLeft); window.addVertex(windowBottomRight); window.setMode(OF_PRIMITIVE_LINE_STRIP); window.draw(); glPointSize(3.0f); window.drawVertices(); // //-- } ofPushStyle(); ofNoFill(); ofColor col(200,100,100); for (float z = 0.0f; z > -40.0f; z-= 0.1f){ col.setHue(int(-z * 100.0f + ofGetElapsedTimef() * 10.0f) % 360); ofSetColor(col); ofRect(-windowWidth / 2.0f, -windowHeight / 2.0f, z, windowWidth, windowHeight); } ofPopStyle(); ofPushStyle(); ofEnableSmoothing(); ofSetColor(255); ofSetLineWidth(5.0f); ofBeginShape(); for (int i=0; i<headPositionHistory.size(); i++) { ofPoint vertex(headPositionHistory[i].x, headPositionHistory[i].y, -float( headPositionHistory.size() - i ) * 0.05f); ofCurveVertex(vertex); } ofEndShape(false); ofPopStyle(); glDisable(GL_DEPTH_TEST); }
void displaySystem::drawWaves(){ //cout<<"drawWaves"<<endl; //cout<<"waves.size(): "<<waves.size()<<endl; //draw outline for the waves ofNoFill(); ofSetLineWidth(1); int y=0; //PANELS for (int i=0;i<wavesPanels.size();i++) { ledWavePanels * w = wavesPanels.at(i); //cout<<"draw wave " << i << endl; if(mode == TEST_MODE){ //draw red boxes for all the panels waves ofSetColor(255, 0, 0, 255); ofRect(w->_x, w->_y+debugYOffset, w->_w, w->_h); ofDrawBitmapString(ofToString(w->_idNum), w->_x+2, w->_y+12+debugYOffset); } //draw the panels to the screen ofSetColor(ledPanelsColor); w->draw(y); y+=w->_h; } //STRIPS for (int i=0;i<wavesStrips.size();i++){ ledWaveStrips * w = wavesStrips.at(i); //cout<<"draw wave " << i << endl; if(mode == TEST_MODE){ //draw blue boxes for all the strips waves ofSetColor(0, 0, 255, 255); ofRect(w->_x, w->_y+debugYOffset, w->_w, w->_h); ofDrawBitmapString(ofToString(w->_idNum), w->_x+2, w->_y+12+debugYOffset); //draw strips below int yOffset = 200; ofSetColor(255); if(ledStripsOn){ ofDrawBitmapString(ofToString(w->_idNum), 10, yOffset+(i*20)+7); w->draw(30, yOffset+(i*20)); //send to strips via OSC // w->drawToStrips(); } else{ ofDrawBitmapString(ofToString(w->_idNum)+" STRIP IS OFF", 10, yOffset+(i*20)+7); } } if(ledStripsOn){ w->drawToStrips(); } } }
void MantaController::drawStats(int x, int y, int w) { int h = w * 310.0 / 400.0; statsDrawRect = ofRectangle(x, y, w, h); ofPushStyle(); ofPushMatrix(); ofTranslate(x, y); ofSetColor(0); ofFill(); ofRect(0, 0, w, h); // draw convex hull ofNoFill(); ofSetColor(0, 255, 0); ofSetLineWidth(1); ofBeginShape(); for (int i=0; i<fingersHull.size(); i++) { float x = ofMap(fingersHull[i].x, 0, 1, 0, w); float y = ofMap(fingersHull[i].y, 0, 1, 0, h); ofVertex(x, y); } ofEndShape(); // draw fingers ofFill(); ofSetColor(255, 0, 0); ofSetLineWidth(0); for (int i=0; i<fingers.size(); i++) { float x = ofMap(fingers[i].x, 0, 1, 0, w); float y = ofMap(fingers[i].y, 0, 1, 0, h); float r = ofMap(fingerValues[i], 0, 196, 0, 10); ofCircle(x, y, r); } // draw centroids float cx = ofMap(centroidX, 0, 1, 0, w); float cy = ofMap(centroidY, 0, 1, 0, h); float wcx = ofMap(weightedCentroidX, 0, 1, 0, w); float wcy = ofMap(weightedCentroidY, 0, 1, 0, h); ofNoFill(); ofSetColor(150); ofSetLineWidth(2); ofLine(cx-4, cy-4, cx+4, cy+4); ofLine(cx+4, cy-4, cx-4, cy+4); ofSetColor(255); ofLine(wcx-4, wcy-4, wcx+4, wcy+4); ofLine(wcx+4, wcy-4, wcx-4, wcy+4); // draw stats ofSetColor(255); ofDrawBitmapString("pad sum", 3, 12); ofDrawBitmapString("pad avg", 3, 28); ofDrawBitmapString("perimeter", 3, 44); ofDrawBitmapString("bw fingers", 3, 60); ofSetColor(0, 255, 0); ofSetLineWidth(0); ofFill(); ofRect(75, 1, ofClamp(ofMap(padSum, 0, 1024, 0, w-80), 0, w-80), 14); ofRect(75, 17, ofClamp(ofMap(padAverage, 0, 196, 0, w-80), 0, w-80), 14); ofRect(75, 33, ofClamp(ofMap(perimeter, 0, 2, 0, w-80), 0, w-80), 14); ofRect(75, 49, ofClamp(ofMap(averageInterFingerDistance, 0, 1, 0, w-80), 0, w-80), 14); ofPopMatrix(); ofPopStyle(); }
//-------------------------------------------------------------- void ballPond::draw(){ ofSetColor(255, 255, 255, 255); background.draw(0, 0); if (bDebug) { if (bShowRGB) { kinect.draw(0, 0, ofGetWidth(), ofGetHeight()); } else if(bShowGray) { grayImage.draw(0, 0, ofGetWidth(), ofGetHeight()); } else if(bShowDepth) { kinect.drawDepth(0, 0, ofGetWidth(), ofGetHeight()); } else if(bShowContour) { contourFinder.draw(0, 0, ofGetWidth(), ofGetHeight()); } } //draw particles ofFill(); ofEnableSmoothing(); for (int i = 0; i < particles.size(); i++) { particles[i].draw(); } ofDisableSmoothing(); ofNoFill(); //draw contour ofSetLineWidth(2); for(int i=0; i<contourFinder.blobs.size(); i++) { ofBeginShape(); //ofCurveVertex(ofMap(v_arr[i][0].x, 0, 640, 0, resX, false), ofMap(v_arr[i][0].y, 0, 480, 0, resY, false)); for(int j = blobPts[i]; j>=0; j--) { //for (int j=0; j<blobPts[i]; j++) { ofSetColor(255, 255, 255); ofPoint p; p.x = v_arr[i][j].x; p.y = v_arr[i][j].y; //ofRect(ofMap(p.x, 0, 640, 0, resX, false)-2, ofMap(p.y, 0, 480, 0, resY, false)-2, 4, 4); ofCurveVertex(ofMap(p.x, 0, 640, 0, resX, false), ofMap(p.y, 0, 480, 0, resY, false)); } ofCurveVertex(ofMap(v_arr[i][blobPts[i]].x, 0, 640, 0, resX, false), ofMap(v_arr[i][blobPts[i]].y, 0, 480, 0, resY, false)); ofCurveVertex(ofMap(v_arr[i][blobPts[i]-1].x, 0, 640, 0, resX, false), ofMap(v_arr[i][blobPts[i]-1].y, 0, 480, 0, resY, false)); ofEndShape(true); } px = mouseX; py = mouseY; // DEBUG if (bDebug) { //drawDebugText(0, 300, 1024, 568); drawDebugText(0, 300, 1280, 568); } screenCapture(); distCapture(); //cout << "--------------" << endl; //cout << "blobPts[]: " << blobPts.size() << endl; //cout << "v_arr[]: " << v_arr.size() << endl; for(int i=0; i<contourFinder.blobs.size(); i++) { //cout << "v_arr[][]: " << v_arr[i].size() << endl; v_arr[i].clear(); //cout << "v_arr[][]: " << v_arr[i].size() << endl; } blobPts.clear(); v_arr.clear(); //cout << "lineStripBlob[]: " << lineStripBlob.size() << endl; //cout << "blobPts[]: " << blobPts.size() << endl; //cout << "v_arr[]: " << v_arr.size() << endl; }
// Update & draw void Faces::update() { if (isThereMbodybool){ b2Vec2 bodyPos = mBody->GetPosition(); // cout << "bodypos: x: " << bodyPos.x << " y: " << bodyPos.y << endl; // cout << "bodypos: x: " << _toPixelX(bodyPos.x) << " y: " << _toPixelY(bodyPos.y) << endl; ofVec2f curPoint = ofVec2f(mVertice[curSection].x, mVertice[curSection].y); ofVec2f nextPoint = ofVec2f( mVertice[curSection].x + (addDist[curSection].x * rotSpd * (curPointofSection + 1)), mVertice[curSection].y + (addDist[curSection].y * rotSpd * (curPointofSection + 1))); float distBetweenPoint = ofDist(curPoint.x, curPoint.y, nextPoint.x, nextPoint.y); if (distBetweenPoint < dists[curSection]){ // ofxOscMessage m; // m.setAddress("/fromOF_pBody"); // m.addIntArg(index); // m.addFloatArg(bodyPos.x * BOX2D_SCALE + nextPoint.x); // m.addFloatArg(bodyPos.y * BOX2D_SCALE + nextPoint.y); // sender.sendMessage(m); ofPushStyle(); ofSetColor(10, 200, 100); ofFill(); ofPushMatrix(); ofTranslate(bodyPos.x * BOX2D_SCALE, bodyPos.y * BOX2D_SCALE * (-1)); ofSetColor(20, 200, 150); ofCircle(nextPoint.x, nextPoint.y, outliner_rad); // Outline vector<ofPoint> lines; for (int i = 0; i < curSection + 1; i++){ ofPoint point = ofPoint(mVertice[i].x, mVertice[i].y); lines.push_back(point); } ofPolyline outline(lines); ofSetLineWidth(2.f); outline.draw(); ofLine(curPoint.x, curPoint.y, nextPoint.x, nextPoint.y); ofPopMatrix(); ofPopStyle(); curPointofSection++; // cout << "curPointofSection: " << curPointofSection << endl; }else{ curSection++; // cout << "curSection: " << curSection << endl; if (curSection == (kMAX_VERTICES - 1) ) { curSection = 0; } curPointofSection = 0; } } }
//---------- Crossfader::Crossfader(int targetWidth, int targetHeight) { this->caption = "Crossfader"; this->slider = this->elementGroup->addBlank(); this->slider->onDraw += [this] (DrawArguments& args) { const float yCenter = this->getHeight() / 2.0f; const float width = this->getWidth(); const float xCenter = width / 2.0f; ofPushStyle(); //-- //major ticks // ofSetColor(100); ofSetLineWidth(1.0f); float x = this->getX(-1.0f); ofLine(x, yCenter - 50.0f, x, yCenter + 50.0f); x = this->getX(0.0f); ofLine(x, yCenter - 50.0f, x, yCenter + 50.0f); x = this->getX(1.0f); ofLine(x, yCenter - 50.0f, x, yCenter + 50.0f); // //-- //-- //coloured ticks // for(float position = -1.0f; position <= 1.0f; position += 0.01f) { this->drawTicks(position); } // //-- //-- //handle // ofSetLineWidth(1.0f); float handleX = this->getX(this->position); ofFill(); ofEnableAlphaBlending(); ofSetColor(0,0,0,50); ofRect(handleX - 10.0f, yCenter - VMIG_CROSSFADE_HANDLE_HEIGHT / 2.0f, 20.0f, VMIG_CROSSFADE_HANDLE_HEIGHT); ofNoFill(); ofSetColor(255); ofLine(handleX, yCenter - VMIG_CROSSFADE_ROW_HEIGHT / 2.0f, handleX, yCenter - VMIG_CROSSFADE_ROW_HEIGHT); ofLine(handleX, yCenter + VMIG_CROSSFADE_ROW_HEIGHT / 2.0f, handleX, yCenter + VMIG_CROSSFADE_ROW_HEIGHT); ofPopStyle(); // //-- }; //-- //select mode buttons // vector<ElementPtr> modeButtons; auto selectDefault = this->elementGroup->addBlank(); auto selectHalfRange = this->elementGroup->addBlank(); auto selectThroughBlack = this->elementGroup->addBlank(); auto selectCut = this->elementGroup->addBlank(); modeButtons.push_back(selectThroughBlack); modeButtons.push_back(selectDefault); modeButtons.push_back(selectHalfRange); modeButtons.push_back(selectCut); selectDefault->onDraw += [this] (DrawArguments& args) { ofEnableAlphaBlending(); this->defaultMode->preview.draw(0,0,args.parentBounds.width, args.parentBounds.height); ofDisableAlphaBlending(); if (this->selectedMode == this->defaultMode) { ofPushStyle(); ofSetColor(255); ofNoFill(); ofSetLineWidth(1.0f); ofRect(0,0,args.parentBounds.width, args.parentBounds.height); ofPopStyle(); } }; selectHalfRange->onDraw += [this] (DrawArguments& args) { ofEnableAlphaBlending(); this->halfRangeMode->preview.draw(0,0,args.parentBounds.width, args.parentBounds.height); ofDisableAlphaBlending(); if (this->selectedMode == this->halfRangeMode) { ofPushStyle(); ofSetColor(255); ofNoFill(); ofSetLineWidth(1.0f); ofRect(0,0,args.parentBounds.width, args.parentBounds.height); ofPopStyle(); } }; selectThroughBlack->onDraw += [this] (DrawArguments& args) { ofEnableAlphaBlending(); this->throughBlackMode->preview.draw(0,0,args.parentBounds.width, args.parentBounds.height); ofDisableAlphaBlending(); if (this->selectedMode == this->throughBlackMode) { ofPushStyle(); ofSetColor(255); ofNoFill(); ofSetLineWidth(1.0f); ofRect(0,0,args.parentBounds.width, args.parentBounds.height); ofPopStyle(); } }; selectCut->onDraw += [this] (DrawArguments& args) { ofEnableAlphaBlending(); this->cutMode->preview.draw(0,0,args.parentBounds.width, args.parentBounds.height); ofDisableAlphaBlending(); if (this->selectedMode == this->cutMode) { ofPushStyle(); ofSetColor(255); ofNoFill(); ofSetLineWidth(1.0f); ofRect(0,0,args.parentBounds.width, args.parentBounds.height); ofPopStyle(); } }; selectDefault->onMouse += [this] (MouseArguments& args) { if (args.isLocalPressed()) { this->selectedMode = this->defaultMode; } }; selectHalfRange->onMouse += [this] (MouseArguments& args) { if (args.isLocalPressed()) { this->selectedMode = this->halfRangeMode; } }; selectThroughBlack->onMouse += [this] (MouseArguments& args) { if (args.isLocalPressed()) { this->selectedMode = this->throughBlackMode; } }; selectCut->onMouse += [this] (MouseArguments& args) { if (args.isLocalPressed()) { this->selectedMode = this->cutMode; } }; // //-- //-- //auto fade buttons // auto autoToA_1 = this->elementGroup->addBlank(); auto autoToA_2 = this->elementGroup->addBlank(); auto autoToA_5 = this->elementGroup->addBlank(); auto autoToA_10 = this->elementGroup->addBlank(); auto autoToB_1 = this->elementGroup->addBlank(); auto autoToB_2 = this->elementGroup->addBlank(); auto autoToB_5 = this->elementGroup->addBlank(); auto autoToB_10 = this->elementGroup->addBlank(); autoToA_1->onDraw += [] (DrawArguments&) { ofxCvGui::AssetRegister.drawText("1s", 0, 0, "", true, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE); }; autoToA_2->onDraw += [] (DrawArguments&) { ofxCvGui::AssetRegister.drawText("2s", 0, 0, "", true, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE); }; autoToA_5->onDraw += [] (DrawArguments&) { ofxCvGui::AssetRegister.drawText("5s", 0, 0, "", true, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE); }; autoToA_10->onDraw += [] (DrawArguments&) { ofxCvGui::AssetRegister.drawText("10s", 0, 0, "", true, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE); }; autoToB_1->onDraw += [] (DrawArguments&) { ofxCvGui::AssetRegister.drawText("1s", 0, 0, "", true, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE); }; autoToB_2->onDraw += [] (DrawArguments&) { ofxCvGui::AssetRegister.drawText("2s", 0, 0, "", true, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE); }; autoToB_5->onDraw += [] (DrawArguments&) { ofxCvGui::AssetRegister.drawText("5s", 0, 0, "", true, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE); }; autoToB_10->onDraw += [] (DrawArguments&) { ofxCvGui::AssetRegister.drawText("10s", 0, 0, "", true, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE); }; autoToA_1->onMouse += [this] (MouseArguments& args) { if (args.isLocalPressed()) { this->autoFade = AutoFade_A; this->autoFadeSpeed = (-1.0f - this->position) / 1.0f; } }; autoToA_2->onMouse += [this] (MouseArguments& args) { if (args.isLocalPressed()) { this->autoFade = AutoFade_A; this->autoFadeSpeed = (-1.0f - this->position) / 2.0f; } }; autoToA_5->onMouse += [this] (MouseArguments& args) { if (args.isLocalPressed()) { this->autoFade = AutoFade_A; this->autoFadeSpeed = (-1.0f - this->position) / 5.0f; } }; autoToA_10->onMouse += [this] (MouseArguments& args) { if (args.isLocalPressed()) { this->autoFade = AutoFade_A; this->autoFadeSpeed = (-1.0f - this->position) / 10.0f; } }; autoToB_1->onMouse += [this] (MouseArguments& args) { if (args.isLocalPressed()) { this->autoFade = AutoFade_B; this->autoFadeSpeed = (+1.0f - this->position) / 1.0f; } }; autoToB_2->onMouse += [this] (MouseArguments& args) { if (args.isLocalPressed()) { this->autoFade = AutoFade_B; this->autoFadeSpeed = (+1.0f - this->position) / 2.0f; } }; autoToB_5->onMouse += [this] (MouseArguments& args) { if (args.isLocalPressed()) { this->autoFade = AutoFade_B; this->autoFadeSpeed = (+1.0f - this->position) / 5.0f; } }; autoToB_10->onMouse += [this] (MouseArguments& args) { if (args.isLocalPressed()) { this->autoFade = AutoFade_B; this->autoFadeSpeed = (+1.0f - this->position) / 10.0f; } }; // //-- this->onMouse += [this] (MouseArguments& args) { if (args.action == MouseArguments::Pressed) { this->draggingCrossfader = (args.local.y >= this->getHeight() / 2.0f - VMIG_CROSSFADE_HANDLE_HEIGHT && args.local.y <= this->getHeight() / 2.0f + VMIG_CROSSFADE_HANDLE_HEIGHT); } if (args.action == MouseArguments::Dragged && this->draggingCrossfader) { float dx = args.movement.x; float dPosition = this->getPosition(args.local.x) - this->getPosition(args.local.x - dx); this->setPosition(this->position + dPosition); } }; this->onBoundsChange += [this, modeButtons, autoToA_1, autoToA_2, autoToA_5, autoToA_10, autoToB_1, autoToB_2, autoToB_5, autoToB_10] (BoundsChangeArguments&) { this->slider->setBounds(ofRectangle(0,0,this->getWidth(), this->getHeight())); float spread = modeButtons.size() * VMIG_CROSSFADE_MODE_BUTTON_SPACING; for(int i=0; i<modeButtons.size(); i++) { auto & button = modeButtons[i]; float x = ofMap(i, 0, modeButtons.size() - 1, -spread / 2.0f, spread / 2.0f) + this->getWidth() / 2.0f; button->setBounds(ofRectangle(x - VMIG_CROSSFADE_MODE_BUTTON_SIZE / 2.0f, this->getHeight() / 2.0f + VMIG_CROSSFADE_MODE_BUTTON_Y_OFFSET, VMIG_CROSSFADE_MODE_BUTTON_SIZE, VMIG_CROSSFADE_MODE_BUTTON_SIZE)); } float autoToAx = VMIG_CROSSFADE_INDENT - VMIG_CROSSFADE_AUTO_FADE_BUTTON_SPACING - VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE / 2.0f; autoToA_1->setBounds(ofRectangle(autoToAx, this->getHeight() / 2.0f - 2 * VMIG_CROSSFADE_AUTO_FADE_BUTTON_SPACING - VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE / 2.0f, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE)); autoToA_2->setBounds(ofRectangle(autoToAx, this->getHeight() / 2.0f - VMIG_CROSSFADE_AUTO_FADE_BUTTON_SPACING - VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE / 2.0f, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE)); autoToA_5->setBounds(ofRectangle(autoToAx, this->getHeight() / 2.0f - VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE / 2.0f, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE)); autoToA_10->setBounds(ofRectangle(autoToAx, this->getHeight() / 2.0f + VMIG_CROSSFADE_AUTO_FADE_BUTTON_SPACING - VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE / 2.0f, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE)); float autoToBx = this->getWidth() - VMIG_CROSSFADE_INDENT + VMIG_CROSSFADE_AUTO_FADE_BUTTON_SPACING - VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE / 2.0f; autoToB_1->setBounds(ofRectangle(autoToBx, this->getHeight() / 2.0f - 2 * VMIG_CROSSFADE_AUTO_FADE_BUTTON_SPACING - VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE / 2.0f, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE)); autoToB_2->setBounds(ofRectangle(autoToBx, this->getHeight() / 2.0f - VMIG_CROSSFADE_AUTO_FADE_BUTTON_SPACING - VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE / 2.0f, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE)); autoToB_5->setBounds(ofRectangle(autoToBx, this->getHeight() / 2.0f - VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE / 2.0f, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE)); autoToB_10->setBounds(ofRectangle(autoToBx, this->getHeight() / 2.0f + VMIG_CROSSFADE_AUTO_FADE_BUTTON_SPACING - VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE / 2.0f, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE, VMIG_CROSSFADE_AUTO_FADE_BUTTON_SIZE)); }; this->onUpdate += [this] (UpdateArguments&) { this->drawFade(); if (this->autoFade != AutoFade_None) { this->position += this->autoFadeSpeed * ofGetLastFrameTime(); if (this->position < -1.0f || this->position > 1.0f) { this->setPosition(this->position); // this will clear auto and clamp } } }; this->defaultMode = ofPtr<BaseMode>(new DefaultMode()); this->halfRangeMode = ofPtr<BaseMode>(new HalfRangeMode()); this->throughBlackMode = ofPtr<BaseMode>(new ThroughBlackMode()); this->cutMode = ofPtr<BaseMode>(new CutMode()); this->selectedMode = this->defaultMode; this->defaultMode->updatePreview(); this->halfRangeMode->updatePreview(); this->throughBlackMode->updatePreview(); this->cutMode->updatePreview(); this->position = 0.0f; this->A = 0; this->B = 0; this->targetWidth = targetWidth; this->targetHeight = targetHeight; this->target.allocate(this->targetWidth, this->targetHeight, GL_RGBA); this->draggingCrossfader = false; }
//-------------------------------------------------------------- void testApp::draw() { glEnable( GL_DEPTH_TEST ); camera.begin(); ofSetLineWidth(1.f); if(bDrawDebug) world.drawDebug(); ofEnableLighting(); light.enable(); light.setPosition(shapes[0]->getPosition()); ofSetColor(255, 255, 255); shapes[0]->draw(); ofSetColor(100., 100., 100.); if(!bDropBox) { boundsMat.begin(); for(int i = 0; i < bounds.size()-1; i++) { bounds[i]->draw(); } boundsMat.end(); } else { ofNoFill(); btScalar m[16]; ofGetOpenGLMatrixFromRigidBody( boundsShape->getRigidBody(), m ); glPushMatrix(); glMultMatrixf( m ); ofBox(ofVec3f(0, 0,0), boundsWidth); glPopMatrix(); ofFill(); } ofDisableAlphaBlending(); ofDisableBlendMode(); glPushAttrib(GL_ALL_ATTRIB_BITS); glPushClientAttrib(GL_CLIENT_ALL_ATTRIB_BITS); glEnable(GL_NORMALIZE); glDisable(GL_CULL_FACE); ofPoint scale = assimpModel.getScale(); ofSetColor(0, 0, 0); logoMat.begin(); for(int i = 0; i < logos.size(); i++) { btScalar m[16]; ofGetOpenGLMatrixFromRigidBody( logos[i]->getRigidBody(), m ); glPushMatrix(); glMultMatrixf( m ); glTranslatef(-logos[i]->getCentroid().x, -logos[i]->getCentroid().y, -logos[i]->getCentroid().z); ofScale(scale.x,scale.y,scale.z); assimpModel.getMesh(0).drawFaces(); glPopMatrix(); } glPopAttrib(); logoMat.end(); ofSetColor(15,197,138); ofPushStyle(); shapesMat.begin(); for(int i = 0; i < shapes.size(); i++) { shapes[i]->draw(); } shapesMat.end(); ofPopStyle(); light.disable(); ofDisableLighting(); camera.end(); glDisable(GL_DEPTH_TEST); int totalShapes = shapes.size() + logos.size(); ofVec3f gravity = world.getGravity(); stringstream ss; ss << "Draw Debug (d): " << bDrawDebug << endl; ss << "Total Shapes: " << totalShapes << endl; ss << "Add logos(o)" << endl; ss << "add spherers (s)" << endl; ss << "add boxes (b)" << endl; ss << "Gravity(up/down/left/right): x=" << gravity.x << " y= " << gravity.y << " z= " << gravity.z << endl; ofSetColor(255, 255, 255); ofDrawBitmapString(ss.str().c_str(), 20, 20); }
//---------------------------------------------------- void ofxSimpleSlider::draw(ofEventArgs& event){ ofEnableAlphaBlending(); ofDisableSmoothing(); ofPushMatrix(); ofTranslate(x,y,0); // Use different alphas if we're actively maniupulating me. float sliderAlpha = (bHasFocus) ? 128:64; float spineAlpha = (bHasFocus) ? 192:128; float thumbAlpha = (bHasFocus) ? 255:160; // draw box outline ofNoFill(); ofSetLineWidth(1.0); ofSetColor(200,200,200, sliderAlpha); ofSetRectMode(OF_RECTMODE_CORNER); ofRect(0,0, width,height); // draw spine ofSetLineWidth(1.0); ofSetColor(255,255,255, spineAlpha); if (bVertical){ ofLine(width/2,0, width/2,height); } else { ofLine(0,height/2, width,height/2); } // draw thumb ofSetLineWidth(5.0); ofSetColor(255,255,255, thumbAlpha); if (bVertical){ float thumbY = ofMap(percent, 0,1, height,0, true); ofLine(0,thumbY, width,thumbY); } else { float thumbX = ofMap(percent, 0,1, 0,width, true); ofLine(thumbX,0, thumbX,height); } // draw numeric value if (bHasFocus){ ofSetColor(255); } else { ofSetColor(200); } if (bVertical){ ofDrawBitmapString( ofToString(getValue(),numberDisplayPrecision), width+5,height); //float labelStringWidth = labelString.size(); ofDrawBitmapString(labelString, width+5, height-14); } else { ofDrawBitmapString( ofToString(getValue(),numberDisplayPrecision), width+5,height/2 + 4); float labelStringWidth = labelString.size(); ofDrawBitmapString( labelString, 0-labelStringWidth*8-5, height/2 + 4); } ofPopMatrix(); ofSetLineWidth(1.0); ofDisableAlphaBlending(); }
void ofxTLTicker::draw(){ ofPushStyle(); int textH, textW; string text; //draw tickers with time float startTime = zoomBounds.min * timeline->getDurationInSeconds(); float endTime = zoomBounds.max * timeline->getDurationInSeconds(); float durationInview = endTime-startTime; float secondsPerPixel = durationInview / bounds.width; if(viewIsDirty){ refreshTickMarks(); } tickerMarks.setStrokeColor( ofColor(200, 180, 40) ); tickerMarks.setStrokeWidth(1); tickerMarks.draw(bounds.x, bounds.y); if(drawBPMGrid){ if(viewIsDirty){ updateBPMPoints(); } ofPushStyle(); ofSetColor(255, 255, 255, 50); for(int i = 0; i < bpmScreenPoints.size(); i++){ ofSetLineWidth(bpmScreenPoints[i].weight); ofLine(bpmScreenPoints[i].screenX, getBottomEdge(), bpmScreenPoints[i].screenX, totalDrawRect.y+totalDrawRect.height); } ofPopStyle(); } textH = timeline->getFont().getLineHeight(); textW = 3; //highlite current mouse position if(hover){ //draw background rect ofSetColor(timeline->getColors().backgroundColor); float screenX = millisToScreenX(hoverTime); text = timeline->formatTime(hoverTime); textW = timeline->getFont().stringWidth(text)+3; if(bounds.height > 2){ int previewTimecodeX = ofClamp(screenX+5, bounds.x, bounds.x+bounds.width-textW-5); ofFill(); ofRect(previewTimecodeX-5, bounds.y+textH, textW, textH); //draw playhead line ofSetColor(timeline->getColors().textColor); timeline->getFont().drawString(text, previewTimecodeX, bounds.y+textH*2); } ofSetColor(timeline->getColors().highlightColor); ofSetLineWidth(1); ofLine(screenX, totalDrawRect.y, screenX, totalDrawRect.y+totalDrawRect.height); } //draw current frame //TIMECODE int currentFrameX; if (timeline->getIsFrameBased()) { text = ofToString(timeline->getCurrentFrame()); currentFrameX = screenXForIndex(timeline->getCurrentFrame()); } else{ text = timeline->formatTime(timeline->getCurrentTime()); currentFrameX = screenXForTime(timeline->getCurrentTime()); } if(bounds.height > 2){ int timeCodeX = ofClamp(currentFrameX+5, bounds.x, bounds.x+bounds.width-textW-5); ofSetColor(timeline->getColors().backgroundColor); ofFill(); ofRect(timeCodeX-5, bounds.y, textW, textH); ofSetColor(timeline->getColors().textColor); timeline->getFont().drawString(text, timeCodeX, bounds.y+textH); } if(timeline->getIsPlaying()){ ofSetColor(timeline->getColors().keyColor); } else{ ofSetColor(timeline->getColors().outlineColor); } //draw playhead line ofSetLineWidth(1); ofLine(currentFrameX, totalDrawRect.y, currentFrameX, totalDrawRect.y+totalDrawRect.height); //draw bounds ofNoFill(); ofSetColor(200, 180, 40); ofRect(bounds); ofPopStyle(); }
//-------------------------------------------------------------- void testApp::draw(){ //----------------------------------- start draw for LEDS // ofBackground( (int)( ofGetElapsedTimef() * 100 ) % 255); // float sinOfTime = sin( ofGetElapsedTimef() * 10 ); // float sinOfTimeMapped = ofMap( sinOfTime, -1, 1, 0 ,30); // ofSetColor( 127 + 127 * sin(ofGetElapsedTimef())); // ofCircle(mouseX, ofGetHeight() * .5, sinOfTimeMapped * 10.0); // -------------------------- draw the line ofSetColor(fade); ofSetLineWidth(5); TPR.draw(); // -------------------------- draw the point at the current time if (TPR.bHaveADrawing()){ // if we have a drawing to work with // figure out what time we are at, and make sure we playback cyclically (!) // use the duration here and make sure our timeToCheck is in the range of 0 - duration float timeToCheck = ofGetElapsedTimef() - playbackStartTime; while (timeToCheck > TPR.getDuration() && TPR.getDuration() > 0){ timeToCheck -= TPR.getDuration(); } // get the position and velocity at timeToCheck ofPoint pos = TPR.getPositionForTime(timeToCheck); ofPoint vel = TPR.getVelocityForTime(timeToCheck); // since velocity is a line, we want to know how long it is. float lengthOfVel = ofDist(0,0,vel.x, vel.y); ofFill(); float sinOfTime = sin( ofGetElapsedTimef() * 5 ); float sinOfTimeMapped = ofMap( sinOfTime, -1, 1, 10 ,40); ofSetColor( 127 + 127 * sin(ofGetElapsedTimef())); // ofCircle(mouseX, ofGetHeight() * .5, sinOfTimeMapped * 10.0); ofCircle(pos.x, pos.y, 2 + lengthOfVel/5.0); } //----------------------------------- end draw for LEDS ofImage imgTemp; imgTemp.grabScreen(0, ofGetHeight()/2, ofGetWidth(), 6); imgTemp.setImageType(OF_IMAGE_GRAYSCALE ); imgTemp.resize(N_LIGHTS, 6); unsigned char * pixels = imgTemp.getPixels(); if (ofGetFrameNum() % 3 == 0){ serial.writeByte(255); for (int j = 0; j < N_LIGHTS; j++){ float pct = ofMap(pixels[j], 0, 255, 0 , 1, true); float value = ofMap( powf(pct, 2), 0, 1, 0,253, true); serial.writeByte(value); //if (j % (int)ofClamp(mouseX, 1, 10) == 0) serial.writeByte(254); //else serial.writeByte(0); } } ofSetColor(127); ofFill(); ofRect(0, ofGetHeight()/2, ofGetWidth(), 6); }
//-------------------------------------------------------------- void ofApp::draw() { // change background video alpha value based on the mouse position float videoAlphaValue = ofMap(mouseX, 0,ofGetWidth(),100,255); // set a white fill color with the alpha generated above ofSetColor(255,255,255,videoAlphaValue); float typeValue = ofMap(mouseY, 0,ofGetHeight(),9,72); font.load("Courier New Bold.ttf",typeValue); // draw the raw video frame with the alpha value generated above vidGrabber.draw(0,0); ofPixelsRef pixelsRef = vidGrabber.getPixels(); ofSetHexColor(0xffffff); for (int i = 0; i < camWidth; i+= 7) { for (int j = 0; j < camHeight; j+= 9) { // get the pixel and its lightness (lightness is the average of its RGB values) float lightness = pixelsRef.getColor(i,j).getLightness(); // calculate the index of the character from our asciiCharacters array int character = powf( ofMap(lightness, 0, 255, 0, 1), 2.5) * asciiCharacters.size(); // draw the character at the correct location font.drawString(ofToString(asciiCharacters[character]), i, j); } } ofTranslate(ofGetWidth()/2,ofGetHeight()/2); // move initital drawing postion to the center of the screen // int circle_resolution=1600; // amount of points circle is made of, more points - better quality, but could decrease perfomance float cResolution = ofMap(mouseY, 0,ofGetHeight(),1800,180); int circle_resolution=cResolution; // int radius=200; // radius of the circle int radius=450; // int smoothing_amount=10; int smoothing_amount=0.1; ofPolyline circle_sin; ofPolyline circle_cos; ofPolyline circle_un_cos; // int wave_height=radius*0.1; // height of sine waves int wave_height=radius; // int anim_shape=16; // amount waves per circle int anim_shape=3000; // float sine_pct=0.5; // how long is wave in percantage float sine_pct=8; float speed_increment=ofGetElapsedTimef()*0.5; // speed of animation // int line_w=7; // width of the stroke int line_w=0.01; int radius_cos=radius+line_w-1; // let's make it little less then line width, so circles will overlap each other int radius_un_cos=radius+(line_w-1)*2; for(int i=0; i<circle_resolution; i++) { float angle=TWO_PI/circle_resolution*i; float raidus_addon=wave_height*sin((angle+speed_increment)*anim_shape); float x=cos(angle+speed_increment)*radius; float y=sin(angle+speed_increment)*radius; // drawing sine wave only on a part of the circle if(i<sine_pct*circle_resolution) { x=cos(angle+speed_increment)*(radius+raidus_addon); y=sin(angle+speed_increment)*(radius+raidus_addon); } circle_sin.addVertex(ofPoint(x,y)); raidus_addon=wave_height*cos((angle+speed_increment)*anim_shape); x=cos(angle+speed_increment)*(radius_cos); y=sin(angle+speed_increment)*(radius_cos); if(i<sine_pct*circle_resolution) { x=cos(angle+speed_increment)*(radius_cos+raidus_addon); y=sin(angle+speed_increment)*(radius_cos+raidus_addon); } circle_cos.addVertex(ofPoint(x,y)); //increment a wave angle to flip the wave raidus_addon=wave_height*cos((angle+TWO_PI/3+speed_increment)*anim_shape); x=cos(angle+speed_increment)*(radius_un_cos); y=sin(angle+speed_increment)*(radius_un_cos); if(i<sine_pct*circle_resolution) { x=cos(angle+speed_increment)*(radius_un_cos+raidus_addon); y=sin(angle+speed_increment)*(radius_un_cos+raidus_addon); } circle_un_cos.addVertex(ofPoint(x,y)); } ofSetLineWidth(line_w); ofColor clr=ofColor::fromHex(0xfff400); ofSetColor(clr,30); circle_sin.close(); // to connect first and last point of our shape we need to use ÔcloseÕ function circle_sin= circle_sin.getSmoothed(1); circle_sin.draw(); clr=ofColor::fromHex(0x000000); ofSetColor(clr,30); circle_cos.close(); circle_cos= circle_cos.getSmoothed(1); circle_cos.draw(); clr=ofColor::fromHex(0xff0000); ofSetColor(clr,30); circle_un_cos.close(); circle_un_cos= circle_un_cos.getSmoothed(1); circle_un_cos.draw(); }
//-------------------------------------------------------------- void ofApp::draw(){ ofBackground(0); int totalLoaded = 0; for(int i = 0; i < MAX_AVATARS; i++){ if(avatars[i].player.isLoaded()) totalLoaded++; } ofSetColor(255, 255, 255); if(bUseSets){ if(avatars[currentPlaying].player.getIsMovieDone()) ofSetColor(150,150,150); // only show if all loaded if(totalLoaded >= MAX_AVATARS) avatars[currentPlaying].draw(); //cout << "totalLoaded " << totalLoaded << endl; }else avatar.draw(); //--- // show instructions if(bUseSets){ ofSetColor(255, 255, 255); if(totalLoaded < MAX_AVATARS){ string readyInfo = "Please Wait"; ofRectangle bounds = font.getStringBoundingBox(readyInfo, 0, 0); font.drawString(readyInfo, ofGetWidth()*.5-bounds.width*.5, ofGetHeight()*.85-bounds.height*.5); }else if( !avatars[currentPlaying].player.isPlaying() && !avatars[currentPlaying].player.getIsMovieDone()){ string readyInfo = "When the video begins,"; ofRectangle bounds = font.getStringBoundingBox(readyInfo, 0, 0); font.drawString(readyInfo, ofGetWidth()*.5-bounds.width*.5, ofGetHeight()*.20-bounds.height*.5); readyInfo = "follow the dance movements"; ofRectangle bounds2 = font.getStringBoundingBox(readyInfo, 0, 0); font.drawString(readyInfo, ofGetWidth()*.5-bounds2.width*.5, ofGetHeight()*.20-bounds2.height*.5+bounds.height); }else if( avatars[currentPlaying].player.getIsMovieDone() ){ string readyInfo = "Wait a moment for your avatar to generate."; ofRectangle bounds = font.getStringBoundingBox(readyInfo, 0, 0); font.drawString(readyInfo, ofGetWidth()*.5-bounds.width*.5, ofGetHeight()*.85-bounds.height*.5); } } //----- if(bShowGui){ ofSetColor(255, 255, 255); stringstream reportStream; reportStream << "0 - Load from file\n" << "g - toggle this text on/off\n" << "f - toggle fullscreen\n" << "fps: " << ofGetFrameRate() << endl << "RETURN - load sequence" << endl << "n - next sequence " << endl << "r - play and record" << endl; ofDrawBitmapString(reportStream.str(), ofGetWidth()-200, 10); if( (bLoadingNewSet && totalPreloaded>=0) || totalLoaded < MAX_AVATARS){ //cout << totalPreloaded << endl; stringstream reportStream2; if(totalPreloaded > 0) reportStream2 << "Loading file: " << avatars[totalPreloaded-1].getDirectory() << endl; ofDrawBitmapString(reportStream2.str(), ofGetWidth()-200, 120); } gui.draw(); } if(bHasUser){ ofNoFill(); ofSetColor(255, 0, 0); ofSetLineWidth(3); ofRect(0, 0, ofGetWidth(), ofGetHeight()); ofSetLineWidth(1); } }
//-------------------------------------------------------------- void RuleOne::draw(){ //BG------white paper with light blue gridded lines-------------------- ofBackground(255); ofSetColor( ofColor::lightBlue); ofSetLineWidth(1); for (int i = 0; i < ofGetWidth(); i = i + 20){ ofLine(i,0,i, ofGetHeight()); } for (int i = 0; i < ofGetHeight(); i = i + 20){ ofLine(0, i, ofGetWidth(), i); } //----------draw ellipses------------------------------ float sinOfTime = sin( ofGetElapsedTimef() ); float sinOfTimeMapped = ofMap( sinOfTime, -1, 1, 0, 255); float sinOfTime2 = sin( ofGetElapsedTimef() + PI); float sinOfTimeMapped2 = ofMap( sinOfTime2, -1, 1, 0, 255); sin(ofGetElapsedTimef()); // moves from -1 and 1 every 2Pi seconds float sinValue = sin(ofGetElapsedTimef()*2); ofColor c; c.set(ofColor::pink); c.lerp( ofColor::blue, ofMap(ofGetMouseX(), 0, ofGetWidth(), 0, 1, true)); ofSetColor(c); ofCircle(610,490+sinValue*17, 5); ofCircle(640,490+sinValue*15, 5); ofCircle(670,490+sinValue*20, 5); //----------draw letters----------------- float intalphaMapped = ofMap(moveZach, 100, ofGetWidth()-400, 0, 255); if (ofGetMousePressed() && ofGetMouseX() >100 && ofGetMouseX() <ofGetWidth()-305){ moveZach = ofGetMouseX(); } letterheight = 380; // float intalphaMapped = ofMap(ofGetMouseX(), 20, ofGetWidth()-400, 0, 255); ofSetColor(224,103,99,intalphaMapped); IntroBlack.drawString(letterT, 235,letterheight); ofSetColor(245,155,181,intalphaMapped); IntroBlack.drawString(letterR, 405,letterheight); ofSetColor(200,221,109,intalphaMapped); IntroBlack.drawString(letterU, 605,letterheight); ofSetColor(98,196,215,intalphaMapped); IntroBlack.drawString(letterS, 805, letterheight); ofSetColor(245,155,181,intalphaMapped); IntroBlack.drawString(letterT2, 1005,letterheight); ofSetColor(brown); RuleOneeverything.draw(50,50,1328,754); Zach.draw(moveZach-220,434,484,430); ofSetColor(255); Nav.draw(0,0,ofGetWidth(),ofGetHeight()); }