summaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorTim Redfern <tim@getdrop.com>2017-12-15 09:24:22 +0000
committerTim Redfern <tim@getdrop.com>2017-12-15 09:24:22 +0000
commit3418dd0859106791d5534c53b901c2be4ea6b4c4 (patch)
treecfa88e599b5e94867bd4dc74a171b9a57e01af41 /gui
parent75094cedeb1910d8a7cdb86ac56617af25f21a54 (diff)
better paths
Diffstat (limited to 'gui')
-rw-r--r--gui/src/chainImage.cpp7
-rw-r--r--gui/src/chainImage.h8
-rw-r--r--gui/src/chainImageSet.cpp22
3 files changed, 30 insertions, 7 deletions
diff --git a/gui/src/chainImage.cpp b/gui/src/chainImage.cpp
index 5a24c7b..7192fdc 100644
--- a/gui/src/chainImage.cpp
+++ b/gui/src/chainImage.cpp
@@ -130,6 +130,11 @@ void chainImage::updateRotationTimeline(){
}
+ofPoint chainImage::getPathPoint(){
+ //printf("get point at transition: %f \n",transition);
+ return path.getPointAtLength(transition);
+}
+
int chainImage::updateOutput(float decayRatio){
//where there is rotation of the link, the path needs to be rotated
@@ -150,7 +155,7 @@ int chainImage::updateOutput(float decayRatio){
ofPoint previous=getLinkPos()+(rotated_destination*getLinkScale()*(1.0f-BEZIER_IN));
path.bezierTo(
- getLinkPos().x*(1.0f+BEZIER_OUT),getLinkPos().y*(1.0f+BEZIER_OUT),
+ getLinkPos().x*(1.0f+(BEZIER_OUT*linkScale)),getLinkPos().y*(1.0f+(BEZIER_OUT*linkScale)),
previous.x,previous.y,
destination.x,destination.y);
diff --git a/gui/src/chainImage.h b/gui/src/chainImage.h
index 1ac234c..2567e3c 100644
--- a/gui/src/chainImage.h
+++ b/gui/src/chainImage.h
@@ -6,9 +6,9 @@
#define THUMB_BORDER_RATIO 0.8
#define THUMB_SIZE 160
#define DEFAULT_FADEIN 1.0
-#define BEZIER_OUT 0.125
-#define BEZIER_IN 0.125
-#define ROTATION_BEZIER_FRACTION 0.1
+#define BEZIER_OUT 0.5
+#define BEZIER_IN 0.5
+#define ROTATION_BEZIER_FRACTION 0.2
#define SWITCH_NONE 0
#define SWITCH_FORWARD 1
@@ -70,6 +70,8 @@ class chainImage : public ofImage{
Json::Value toJson();
bool fromJson(Json::Value json);
+ ofPoint getPathPoint();
+
chainImage *link;
chainImage *linked;
diff --git a/gui/src/chainImageSet.cpp b/gui/src/chainImageSet.cpp
index 8f73013..65ea5f9 100644
--- a/gui/src/chainImageSet.cpp
+++ b/gui/src/chainImageSet.cpp
@@ -194,17 +194,24 @@ void chainImageSet::drawGui(int x,int y,bool is_selected){
glPopMatrix();
}
+
+ //DRAW PATH PREVIEW
glPushMatrix();
- ofSetColor(255,0,255);
+ if (((*ii)->linked)->link==(*currentImage)->link){ //seems like cheating
+ ofSetColor(0,255,0);
+ }
+ else {
+ ofSetColor(255,255,255);
+ }
glTranslatef(t_xoffs+borderwidth+thumbx,borderwidth+thumby,0);
//this gets us to the middle of the image
- ofDrawRectangle(-5,-5,10,10);
+ //ofDrawRectangle(-2,-2,4,4);
- ofSetLineWidth(5);
+ ofSetLineWidth(2);
float pathscale=thumbscale/(((*ii)->linked)->linkScale);
@@ -218,9 +225,18 @@ void chainImageSet::drawGui(int x,int y,bool is_selected){
glTranslatef(-start.x,-start.y,0);
((*ii)->linked)->path.draw();
+ if (((*ii)->linked)->link==(*currentImage)->link){ //seems like cheating
+ ofPoint currentpos=((*ii)->linked)->getPathPoint();
+ glTranslatef(currentpos.x,currentpos.y,0);
+ ofSetColor(255,255,255);
+ ofDrawRectangle(-2,-2,4,4);
+ }
+
ofSetLineWidth(1);
glPopMatrix();
+
+ //jump to next image
t_xoffs+=(*ii)->thumbnail.getWidth()+(borderwidth*2);