Exemplo n.º 1
0
void ofApp::applyVideoMatrix(){
  bool stopped = video.isPaused();
  video.setSpeed(vVector * vSpeed);
  ofLogNotice() << "Speed: " << vSpeed << ", Vector: " << vVector;
  if(stopped){
    video.setPaused(true);
  }
}
Exemplo n.º 2
0
void nextVideo(){
	if( whichVideo < thumbs.size() ){
		
		vid.loadMovie(thumbs[whichVideo].video);
		vid.play();
		vid.update();
		vid.setPosition(thumbs[whichVideo].pos);
		
		if( mode == "play" ){
			vid.setSpeed(0.25);
		}
		
		whichVideo++;
		framecounter = 0;
	}else{
		std::exit(0);
	}
}
Exemplo n.º 3
0
//--------------------------------------------------------------
void ofApp::draw(){
//-------------------------
    
    int  limit = contourFinder.nBlobs;
    int maxArea = 0;
    int elementNum = -1;
    ofColor yellow(255, 255, 171);
    ofColor white(255, 1);
    
//-------------------------
    
    // loop pages, back and forth
    if (_i < 0) {
        _i = 14;
    }
    if (_i > 14){
        _i = 0;
    }
    
    switch (_i) {
    
        case 0: // blink eyes - ellipse, fill black when clicked DONE
            img1.draw(30, 60);
            ofSetColor(255, 180, 0, alpha);
            ofDrawCircle(265, 225, 45);
            ofDrawCircle(440, 230, 45);
            if (ofGetMousePressed() == true){
                alpha = 0;
            } else {
                alpha = 255;
            }
            music1.setPaused(false);
            ofSetColor(255);
            font.drawString("Omphalotus wasnt like all the other mushrooms.", 40, 40);
            font.drawString("He had eyes. ...and could walk.", 40, 55);
            break;
            
        case 1: // cap sensor DONE
            img2.draw(30, 60);
            music2.setPaused(false);
            bSendSerialMessage = true;
            if (nBytesRead != 1){
                ofSetColor(220);
            } else {
                ofSetColor(0);
            }
            font.drawString("...and talk. He glowed in the dark too.", 40, 40);
            break;
            
        case 2: // earth video speed, mouse move DONE
            bSendSerialMessage = false;
            ofClearAlpha();
            img3.draw(30, 60);
            mov1.draw(215, 480);
            mov1.setSpeed(vidSpeed);
            music3.setPaused(false);
            font.drawString("He didnt know what to do with the days, he felt lost and lonely.", 40, 40);
            font.drawString("Like the world was too big, and he was too small.", 40, 55);
            break;
            
        case 3: // ketchup DONE
            ofEnableAlphaBlending();
            bSendSerialMessage = false;
            img4.draw(30, 60);
            music4.setPaused(false);
            font.drawString("He thought of turning himself in to the omelet factory,", 40, 40);
            font.drawString("but even then, theyd turn him away because he is too poisonous.", 40, 55);
            ofSetColor(250, 58, 20);
            line.draw();
            ofSetColor(255);
            break;
            
        case 4:
            bSendSerialMessage = false;
            ofClearAlpha();
            img5.draw(30, 60);
            music5.setPaused(false);
            font.drawString("It was late one evening he squished sadly past a slime mold on a rock.", 40, 40);
            break;
            
        case 5: // stars in eyes
            bSendSerialMessage = false;
            ofClearAlpha();
            img6.draw(30, 60);
            music6.setPaused(false);
            font.drawString("Hello, what a lovely evening!", 40, 40);
            font.drawString("...squeaked the slime mold.", 40, 55);
            break;
            
        case 6: // drops in eyes
            bSendSerialMessage = false;
            ofClearAlpha();
            img8.draw(30, 60);
            music7.setPaused(false);
            font.drawString("Hello.", 40, 40);
            font.drawString("...replied Omphalotus gloomily.", 40, 55);
            break;
            
        case 7: // more stars
            bSendSerialMessage = false;
            ofClearAlpha();
            img9.draw(30, 60);
            music8.setPaused(false);
            font.drawString("Come, sit upon this rock with me, the lunar eclipse is coming!", 40, 40);
            font.drawString("...the slime mold squeaked.", 40, 55);
            break;
            
        case 8:
            bSendSerialMessage = false;
            img7.draw(30, 60);
            ofClearAlpha();
            music9.setPaused(false);
            font.drawString("Omphalotus did not know what the slime mold was talking about ", 40, 40);
            font.drawString("but he slowly glided over to the rock and joined his new companion.", 40, 55);
            break;
            
        case 9: // throw sum leds DONE
                // touch cap sensor to alternate functions?
            bSendSerialMessage = true;
            ofClearAlpha();
            img10.draw(30, 60);
            music10.setPaused(false);
            font.drawString("They waited in silence, staring at the full moon glowing in the night sky.", 40, 40);
            font.drawString("A snake slithered past in the grass. Three crickets chirped an evening chorus, and a group of fireflies danced.", 40, 55);
            break;
            
        case 10: // moon ellipse, covered by black ellipse with openCV DONE
            bSendSerialMessage = false;
            img11.draw(30, 60);
            
            for (int i = 0; i < limit; i++) {
                if (contourFinder.blobs[i].area > maxArea){
                    maxArea = contourFinder.blobs[i].area;
                    elementNum = i;
                }
            }
            if (elementNum >= 0) {
                pointerX = ofMap(contourFinder.blobs[elementNum].boundingRect.x, vidX, 0, 0, ofGetWidth(), true);
                ofSetColor(255);
                ofDrawCircle(ofGetWidth()/2, 400, 160);
                ofSetColor(0);
                ofDrawCircle(pointerX/2 + 200, 400, 150);
            }
            ofSetColor(255, 255, 255, 150);
            music11.setPaused(false);
            font.drawString("Soon the world grew quiet all around and Omphalotus gazed into the sky.", 40, 40);
            font.drawString("He watched in wonder as the once luminous moon was covered in a veil of magic shadow.", 40, 55);
            break;
            
        case 11: // 'glowing' eclipse
            bSendSerialMessage = false;
            ofClearAlpha();
            img12.draw(30, 60);
            music12.setPaused(false);
            font.drawString("A small smile crept onto his cap, a satisfying chill rushed up his stalk.", 40, 40);
            font.drawString("He had never seen something so spectacular, so unequivocally beautiful.", 40, 55);
            ofSetColor(255);
            ofDrawCircle(300, 300, 110);
            ofSetColor(0);
            ofDrawCircle(300, 300, 100);
            ofSetColor(255, 150);
            break;
            
        case 12: // particle eyes
            bSendSerialMessage = false;
            img13.draw(30, 60);
            music13.setPaused(false);
            
            for(unsigned int i = 0; i < p.size(); i++){
                p[i].draw();
            }
            currentMode == PARTICLE_MODE_ATTRACT;
            
            ofSetColor(255);
            font.drawString("For the first time he was filled with wonder, and he no longer felt so small.", 40, 40);
            
            break;
            
        case 13: // radial gradient fills screen
            ofSetColor(255);
            ofBackgroundGradient(yellow, white, OF_GRADIENT_CIRCULAR);
            bSendSerialMessage = false;
            music14.setPaused(false);
            font.drawString("He started glowing brighter than the moon.", 250, ofGetHeight()/1.3);
            break;
            
        case 14:
            bSendSerialMessage = false;
            music15.setPaused(false);
            ofSetColor(255);
            font2.drawString("After the Eclipse", 40, 300);
            font.drawString("story by: Amber Glassman", 40, 80);
            font.drawString("illustrated by: Jessica Herzog", 40, 100);
            break;
    }
    
}