Skip to content
Browse files

ok

  • Loading branch information...
1 parent 8bf848c commit ea447aac0199f0ecef080b121261fcb2a3d725e3 @hideyukisaito hideyukisaito committed Mar 15, 2013
Showing with 236 additions and 25 deletions.
  1. +115 −0 ars3D.xcodeproj/project.pbxproj
  2. +106 −22 src/testApp.cpp
  3. +15 −3 src/testApp.h
View
115 ars3D.xcodeproj/project.pbxproj
@@ -20,6 +20,19 @@
40FA61F616D35BBD00493C03 /* ofxOscMessage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 40FA61E616D35BBD00493C03 /* ofxOscMessage.cpp */; };
40FA61F716D35BBD00493C03 /* ofxOscReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 40FA61E816D35BBD00493C03 /* ofxOscReceiver.cpp */; };
40FA61F816D35BBD00493C03 /* ofxOscSender.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 40FA61EA16D35BBD00493C03 /* ofxOscSender.cpp */; };
+ AB27027E16F3205B000AC44E /* ofxEasing.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB27026016F3205B000AC44E /* ofxEasing.cpp */; };
+ AB27027F16F3205B000AC44E /* ofxEasingBack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB27026216F3205B000AC44E /* ofxEasingBack.cpp */; };
+ AB27028016F3205B000AC44E /* ofxEasingBounce.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB27026416F3205B000AC44E /* ofxEasingBounce.cpp */; };
+ AB27028116F3205B000AC44E /* ofxEasingCirc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB27026616F3205B000AC44E /* ofxEasingCirc.cpp */; };
+ AB27028216F3205B000AC44E /* ofxEasingCubic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB27026816F3205B000AC44E /* ofxEasingCubic.cpp */; };
+ AB27028316F3205B000AC44E /* ofxEasingElastic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB27026A16F3205B000AC44E /* ofxEasingElastic.cpp */; };
+ AB27028416F3205B000AC44E /* ofxEasingExpo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB27026C16F3205B000AC44E /* ofxEasingExpo.cpp */; };
+ AB27028516F3205B000AC44E /* ofxEasingLinear.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB27026E16F3205B000AC44E /* ofxEasingLinear.cpp */; };
+ AB27028616F3205B000AC44E /* ofxEasingQuad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB27027016F3205B000AC44E /* ofxEasingQuad.cpp */; };
+ AB27028716F3205B000AC44E /* ofxEasingQuart.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB27027216F3205B000AC44E /* ofxEasingQuart.cpp */; };
+ AB27028816F3205B000AC44E /* ofxEasingQuint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB27027416F3205B000AC44E /* ofxEasingQuint.cpp */; };
+ AB27028916F3205B000AC44E /* ofxEasingSine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB27027616F3205B000AC44E /* ofxEasingSine.cpp */; };
+ AB27028A16F3205B000AC44E /* ofxTween.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB27027816F3205B000AC44E /* ofxTween.cpp */; };
BBAB23CB13894F3D00AA2426 /* GLUT.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = BBAB23BE13894E4700AA2426 /* GLUT.framework */; };
E4328149138ABC9F0047C5CB /* openFrameworksDebug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E4328148138ABC890047C5CB /* openFrameworksDebug.a */; };
E45BE97B0E8CC7DD009D7055 /* AGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E45BE9710E8CC7DD009D7055 /* AGL.framework */; };
@@ -105,6 +118,38 @@
40FA61E916D35BBD00493C03 /* ofxOscReceiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxOscReceiver.h; sourceTree = "<group>"; };
40FA61EA16D35BBD00493C03 /* ofxOscSender.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxOscSender.cpp; sourceTree = "<group>"; };
40FA61EB16D35BBD00493C03 /* ofxOscSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxOscSender.h; sourceTree = "<group>"; };
+ AB27024616F3205B000AC44E /* .cproject */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = .cproject; sourceTree = "<group>"; };
+ AB27024716F3205B000AC44E /* .gitignore */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .gitignore; sourceTree = "<group>"; };
+ AB27024816F3205B000AC44E /* .project */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = .project; sourceTree = "<group>"; };
+ AB27025B16F3205B000AC44E /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
+ AB27025C16F3205B000AC44E /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ AB27025F16F3205B000AC44E /* easing_terms_of_use.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = easing_terms_of_use.html; sourceTree = "<group>"; };
+ AB27026016F3205B000AC44E /* ofxEasing.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxEasing.cpp; sourceTree = "<group>"; };
+ AB27026116F3205B000AC44E /* ofxEasing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxEasing.h; sourceTree = "<group>"; };
+ AB27026216F3205B000AC44E /* ofxEasingBack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxEasingBack.cpp; sourceTree = "<group>"; };
+ AB27026316F3205B000AC44E /* ofxEasingBack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxEasingBack.h; sourceTree = "<group>"; };
+ AB27026416F3205B000AC44E /* ofxEasingBounce.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxEasingBounce.cpp; sourceTree = "<group>"; };
+ AB27026516F3205B000AC44E /* ofxEasingBounce.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxEasingBounce.h; sourceTree = "<group>"; };
+ AB27026616F3205B000AC44E /* ofxEasingCirc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxEasingCirc.cpp; sourceTree = "<group>"; };
+ AB27026716F3205B000AC44E /* ofxEasingCirc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxEasingCirc.h; sourceTree = "<group>"; };
+ AB27026816F3205B000AC44E /* ofxEasingCubic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxEasingCubic.cpp; sourceTree = "<group>"; };
+ AB27026916F3205B000AC44E /* ofxEasingCubic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxEasingCubic.h; sourceTree = "<group>"; };
+ AB27026A16F3205B000AC44E /* ofxEasingElastic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxEasingElastic.cpp; sourceTree = "<group>"; };
+ AB27026B16F3205B000AC44E /* ofxEasingElastic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxEasingElastic.h; sourceTree = "<group>"; };
+ AB27026C16F3205B000AC44E /* ofxEasingExpo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxEasingExpo.cpp; sourceTree = "<group>"; };
+ AB27026D16F3205B000AC44E /* ofxEasingExpo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxEasingExpo.h; sourceTree = "<group>"; };
+ AB27026E16F3205B000AC44E /* ofxEasingLinear.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxEasingLinear.cpp; sourceTree = "<group>"; };
+ AB27026F16F3205B000AC44E /* ofxEasingLinear.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxEasingLinear.h; sourceTree = "<group>"; };
+ AB27027016F3205B000AC44E /* ofxEasingQuad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxEasingQuad.cpp; sourceTree = "<group>"; };
+ AB27027116F3205B000AC44E /* ofxEasingQuad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxEasingQuad.h; sourceTree = "<group>"; };
+ AB27027216F3205B000AC44E /* ofxEasingQuart.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxEasingQuart.cpp; sourceTree = "<group>"; };
+ AB27027316F3205B000AC44E /* ofxEasingQuart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxEasingQuart.h; sourceTree = "<group>"; };
+ AB27027416F3205B000AC44E /* ofxEasingQuint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxEasingQuint.cpp; sourceTree = "<group>"; };
+ AB27027516F3205B000AC44E /* ofxEasingQuint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxEasingQuint.h; sourceTree = "<group>"; };
+ AB27027616F3205B000AC44E /* ofxEasingSine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxEasingSine.cpp; sourceTree = "<group>"; };
+ AB27027716F3205B000AC44E /* ofxEasingSine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxEasingSine.h; sourceTree = "<group>"; };
+ AB27027816F3205B000AC44E /* ofxTween.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxTween.cpp; sourceTree = "<group>"; };
+ AB27027916F3205B000AC44E /* ofxTween.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxTween.h; sourceTree = "<group>"; };
AB47AE0016DCEF2300C50356 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.md; sourceTree = "<group>"; };
BBAB23BE13894E4700AA2426 /* GLUT.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLUT.framework; path = ../../../libs/glut/lib/osx/GLUT.framework; sourceTree = "<group>"; };
E4328143138ABC890047C5CB /* openFrameworksLib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = openFrameworksLib.xcodeproj; path = ../../../libs/openFrameworksCompiled/project/osx/openFrameworksLib.xcodeproj; sourceTree = SOURCE_ROOT; };
@@ -264,9 +309,66 @@
path = src;
sourceTree = "<group>";
};
+ AB27024516F3205B000AC44E /* ofxTween */ = {
+ isa = PBXGroup;
+ children = (
+ AB27024616F3205B000AC44E /* .cproject */,
+ AB27024716F3205B000AC44E /* .gitignore */,
+ AB27024816F3205B000AC44E /* .project */,
+ AB27025B16F3205B000AC44E /* LICENSE */,
+ AB27025C16F3205B000AC44E /* README */,
+ AB27025D16F3205B000AC44E /* src */,
+ );
+ name = ofxTween;
+ path = ../../../addons/ofxTween;
+ sourceTree = "<group>";
+ };
+ AB27025D16F3205B000AC44E /* src */ = {
+ isa = PBXGroup;
+ children = (
+ AB27025E16F3205B000AC44E /* Easings */,
+ AB27027816F3205B000AC44E /* ofxTween.cpp */,
+ AB27027916F3205B000AC44E /* ofxTween.h */,
+ );
+ path = src;
+ sourceTree = "<group>";
+ };
+ AB27025E16F3205B000AC44E /* Easings */ = {
+ isa = PBXGroup;
+ children = (
+ AB27025F16F3205B000AC44E /* easing_terms_of_use.html */,
+ AB27026016F3205B000AC44E /* ofxEasing.cpp */,
+ AB27026116F3205B000AC44E /* ofxEasing.h */,
+ AB27026216F3205B000AC44E /* ofxEasingBack.cpp */,
+ AB27026316F3205B000AC44E /* ofxEasingBack.h */,
+ AB27026416F3205B000AC44E /* ofxEasingBounce.cpp */,
+ AB27026516F3205B000AC44E /* ofxEasingBounce.h */,
+ AB27026616F3205B000AC44E /* ofxEasingCirc.cpp */,
+ AB27026716F3205B000AC44E /* ofxEasingCirc.h */,
+ AB27026816F3205B000AC44E /* ofxEasingCubic.cpp */,
+ AB27026916F3205B000AC44E /* ofxEasingCubic.h */,
+ AB27026A16F3205B000AC44E /* ofxEasingElastic.cpp */,
+ AB27026B16F3205B000AC44E /* ofxEasingElastic.h */,
+ AB27026C16F3205B000AC44E /* ofxEasingExpo.cpp */,
+ AB27026D16F3205B000AC44E /* ofxEasingExpo.h */,
+ AB27026E16F3205B000AC44E /* ofxEasingLinear.cpp */,
+ AB27026F16F3205B000AC44E /* ofxEasingLinear.h */,
+ AB27027016F3205B000AC44E /* ofxEasingQuad.cpp */,
+ AB27027116F3205B000AC44E /* ofxEasingQuad.h */,
+ AB27027216F3205B000AC44E /* ofxEasingQuart.cpp */,
+ AB27027316F3205B000AC44E /* ofxEasingQuart.h */,
+ AB27027416F3205B000AC44E /* ofxEasingQuint.cpp */,
+ AB27027516F3205B000AC44E /* ofxEasingQuint.h */,
+ AB27027616F3205B000AC44E /* ofxEasingSine.cpp */,
+ AB27027716F3205B000AC44E /* ofxEasingSine.h */,
+ );
+ path = Easings;
+ sourceTree = "<group>";
+ };
BB4B014C10F69532006C3DED /* addons */ = {
isa = PBXGroup;
children = (
+ AB27024516F3205B000AC44E /* ofxTween */,
40FA61C216D35BBD00493C03 /* ofxOsc */,
);
name = addons;
@@ -451,6 +553,19 @@
40FA61F616D35BBD00493C03 /* ofxOscMessage.cpp in Sources */,
40FA61F716D35BBD00493C03 /* ofxOscReceiver.cpp in Sources */,
40FA61F816D35BBD00493C03 /* ofxOscSender.cpp in Sources */,
+ AB27027E16F3205B000AC44E /* ofxEasing.cpp in Sources */,
+ AB27027F16F3205B000AC44E /* ofxEasingBack.cpp in Sources */,
+ AB27028016F3205B000AC44E /* ofxEasingBounce.cpp in Sources */,
+ AB27028116F3205B000AC44E /* ofxEasingCirc.cpp in Sources */,
+ AB27028216F3205B000AC44E /* ofxEasingCubic.cpp in Sources */,
+ AB27028316F3205B000AC44E /* ofxEasingElastic.cpp in Sources */,
+ AB27028416F3205B000AC44E /* ofxEasingExpo.cpp in Sources */,
+ AB27028516F3205B000AC44E /* ofxEasingLinear.cpp in Sources */,
+ AB27028616F3205B000AC44E /* ofxEasingQuad.cpp in Sources */,
+ AB27028716F3205B000AC44E /* ofxEasingQuart.cpp in Sources */,
+ AB27028816F3205B000AC44E /* ofxEasingQuint.cpp in Sources */,
+ AB27028916F3205B000AC44E /* ofxEasingSine.cpp in Sources */,
+ AB27028A16F3205B000AC44E /* ofxTween.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
128 src/testApp.cpp
@@ -1,49 +1,89 @@
#include "testApp.h"
//--------------------------------------------------------------
-void testApp::setup(){
+void testApp::setup()
+{
+ ofSetFrameRate(60);
ofEnableSmoothing();
ofSetBackgroundAuto(false);
ofSetCircleResolution(100);
+ ofEnableAlphaBlending();
rightImage.loadImage("fujitest1.jpg");
leftImage.loadImage("fujitest2.jpg");
receiver.setup(PORT);
-
+
+ leftAlpha = 255;
+ leftAlphaTween.setParameters(LEFT_TWEEN_ID, easingCirc, ofxTween::easeOut, 0, 255, 2000, 0);
+ ofAddListener(leftAlphaTween.end_E, this, &testApp::tweenCompleted);
+ bLeftFadeIn = true;
+
+ rightAlpha = 255;
+ rightAlphaTween.setParameters(RIGHT_TWEEN_ID, easingCirc, ofxTween::easeOut, 0, 255, 2000, 0);
+ ofAddListener(rightAlphaTween.end_E, this, &testApp::tweenCompleted);
+ bRightFadeIn = true;
}
//--------------------------------------------------------------
-void testApp::update(){
+void testApp::update()
+{
while (receiver.hasWaitingMessages()){
ofxOscMessage m;
receiver.getNextMessage(&m);
- if (m.getAddress() == "/right/image"){
+ if (m.getAddress() == "/url/right"){
rightFile = m.getArgAsString(0);
- rightCameraId = m.getArgAsInt32(1);
- cout << "get osc";
- } else if (m.getAddress() == "/left/image" ){
+ cout << "rightFile: " << rightFile << endl;
+
+ rightAlphaTween.setParameters(RIGHT_TWEEN_ID, easingCirc, ofxTween::easeOut, rightAlpha, 0, 500, 0);
+ bRightFadeOut = true;
+ } else if (m.getAddress() == "/url/left" ){
leftFile = m.getArgAsString(0);
- leftCameraId = m.getArgAsInt32(1);
+ cout << "leftFile: " << leftFile << endl;
+
+ leftAlphaTween.setParameters(LEFT_TWEEN_ID, easingCirc, ofxTween::easeOut, leftAlpha, 0, 500, 0);
+ bLeftFadeOut = true;
}
}
-
+
+ if (bLeftFadeIn || bLeftFadeOut) {
+ leftAlpha = leftAlphaTween.update();
+ }
+
+ if (bRightFadeIn || bRightFadeOut) {
+ rightAlpha = rightAlphaTween.update();
+ }
+
+ if (0 == leftAlpha && leftImage.isAllocated()) {
+ leftAlphaTween.setParameters(LEFT_TWEEN_ID, easingCirc, ofxTween::easeOut, leftAlpha, 255, 2000, 0);
+ bLeftFadeIn = true;
+ }
+
+ if (0 == rightAlpha && rightImage.isAllocated()) {
+ rightAlphaTween.setParameters(RIGHT_TWEEN_ID, easingCirc, ofxTween::easeOut, rightAlpha, 255, 2000, 0);
+ bRightFadeIn = true;
+ }
}
//--------------------------------------------------------------
-void testApp::draw(){
- ofEnableAlphaBlending();
- ofSetColor(100, 100, 100);
- ofRect(0,0,ofGetWidth()/2,ofGetHeight());
+void testApp::draw()
+{
+ ofSetColor(255);
+ ofRect(0, 0, ofGetWidth(), ofGetHeight());
+
+ ofPushStyle();
+ ofSetColor(255, 255, 255, leftAlpha);
+ leftImage.draw(0, 0, ofGetWidth() / 2, ofGetHeight());
+ ofPopStyle();
- ofSetColor(255, 255, 255);
- leftImage.draw(0,0,ofGetWidth()/2,ofGetHeight());
- rightImage.draw(ofGetWidth()/2,0,ofGetWidth()/2,ofGetHeight());
+ ofPushStyle();
+ ofSetColor(255, 255, 255, rightAlpha);
+ rightImage.draw(ofGetWidth() / 2, 0, ofGetWidth() / 2, ofGetHeight());
+ ofPopStyle();
ofDrawBitmapString(leftFile + ofToString(leftCameraId) , 100,ofGetHeight() -100);
ofDrawBitmapString(rightFile + ofToString(rightCameraId) , ofGetWidth()/2 + 100,ofGetHeight() -100);
-
}
@@ -55,7 +95,7 @@ void testApp::keyPressed(int key){
//--------------------------------------------------------------
void testApp::keyReleased(int key){
if(key == ' '){
- ofBackground(255,255,255);
+ ofBackground(255, 255, 255);
}
}
@@ -66,12 +106,33 @@ void testApp::mouseMoved(int x, int y){
//--------------------------------------------------------------
void testApp::mouseDragged(int x, int y, int button){
-
+
}
//--------------------------------------------------------------
-void testApp::mousePressed(int x, int y, int button){
-
+void testApp::mousePressed(int x, int y, int button)
+{
+ if (ofGetWidth() / 2 > x) {
+ leftAlphaTween.setParameters(LEFT_TWEEN_ID, easingCirc, ofxTween::easeOut, leftAlpha, 0, 500, 0);
+ leftFile = "http://cache5.amanaimages.com/cen3tzG4fTr7Gtw1PoeRer/22973000320.jpg";
+ if (0 < leftAlpha){
+ bLeftFadeOut = true;
+ bLeftFadeIn = false;
+ } else {
+ bLeftFadeOut = false;
+ bLeftFadeIn = true;
+ }
+ } else {
+ rightAlphaTween.setParameters(RIGHT_TWEEN_ID, easingCirc, ofxTween::easeOut, rightAlpha, 0, 500, 0);
+ rightFile = "http://cache5.amanaimages.com/cen3tzG4fTr7Gtw1PoeRer/22973000320.jpg";
+ if (0 < rightAlpha){
+ bRightFadeOut = true;
+ bRightFadeIn = false;
+ } else {
+ bRightFadeOut = false;
+ bRightFadeIn = true;
+ }
+ }
}
//--------------------------------------------------------------
@@ -94,4 +155,27 @@ void testApp::dragEvent(ofDragInfo dragInfo){
}
-
+//--------------------------------------------------------------
+void testApp::tweenCompleted(int &id)
+{
+ cout << "tween completed. id: " << id << endl;
+
+ if (LEFT_TWEEN_ID == id) {
+ if (bLeftFadeIn) {
+ bLeftFadeIn = false;
+ } else if (bLeftFadeOut) {
+ cout << "load left: " << leftFile << endl;
+ bLeftFadeOut = false;
+ leftImage.clear();
+ leftImage.loadImage(leftFile);
+ }
+ } else if (RIGHT_TWEEN_ID == id) {
+ if (bRightFadeIn) {
+ bRightFadeIn = false;
+ } else if (bRightFadeOut) {
+ cout << "load right: " << rightFile << endl;
+ bRightFadeOut = false;
+ rightImage.loadImage(rightFile);
+ }
+ }
+}
View
18 src/testApp.h
@@ -2,10 +2,15 @@
#include "ofMain.h"
#include "ofxOsc.h"
+#include "ofxTween.h"
#define PORT 4444
-class testApp : public ofBaseApp{
+#define LEFT_TWEEN_ID 0
+#define RIGHT_TWEEN_ID 1
+
+class testApp : public ofBaseApp
+{
public:
void setup();
void update();
@@ -26,7 +31,14 @@ class testApp : public ofBaseApp{
ofxOscReceiver receiver;
- string leftFile,rightFile;
- int leftCameraId,rightCameraId;
+ string leftFile, rightFile;
+ int leftCameraId, rightCameraId;
+
+ int leftAlpha, rightAlpha;
+ bool bLeftFadeIn, bRightFadeIn;
+ bool bLeftFadeOut, bRightFadeOut;
+ ofxTween leftAlphaTween, rightAlphaTween;
+ ofxEasingCirc easingCirc;
+ void tweenCompleted(int &id);
};

0 comments on commit ea447aa

Please sign in to comment.
Something went wrong with that request. Please try again.