summaryrefslogtreecommitdiff
path: root/vfg/src/Tag.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'vfg/src/Tag.cpp')
-rwxr-xr-xvfg/src/Tag.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/vfg/src/Tag.cpp b/vfg/src/Tag.cpp
index bc087e6..0a478a6 100755
--- a/vfg/src/Tag.cpp
+++ b/vfg/src/Tag.cpp
@@ -4,24 +4,26 @@
void Billboard::draw(float x, float y, float scale){
img.draw(x-(anchorPoint.x*scale),y-(anchorPoint.y*scale),img.getWidth()*scale,img.getHeight()*scale);
}
-void Tag::play(){
+void Tag::play(int time){
isPlaying=true;
- startTime=ofGetElapsedTimeMillis();
+ startTime=ofGetElapsedTimeMillis()+time;
}
-void Tag::1playEnd(){
+void Tag::playEnd(){
end=true;
play();
}
void Tag::draw(float x, float y, float scale) {
- float time=((float)ofGetElapsedTimeMillis()-startTime)/duration;
- float yshift=0.0f;
- if (end) {
- if (time<1.0) yshift=pow((time),0.7)-1.0;
+ if (ofGetElapsedTimeMillis()>=startTime) {
+ float time=((float)ofGetElapsedTimeMillis()-startTime)/duration;
+ float yshift=0.0f;
+ if (end) {
+ if (time<1.0) yshift=pow((time),0.7)-1.0;
+ }
+ else {
+ if (time<0.4) yshift=pow((time/0.4),0.7)-1.0;
+ else if (time>0.75) yshift=-pow((time-0.75)/0.25,0.75);
+ if ((ofGetElapsedTimeMillis()-startTime)>duration) isPlaying=false;
+ }
+ img.draw(x-(anchorPoint.x*scale),y-(anchorPoint.y*scale)+(yshift*img.getHeight()*scale),img.getWidth()*scale,img.getHeight()*scale);
}
- else {
- if (time<0.4) yshift=pow((time/0.4),0.7)-1.0;
- else if (time>0.75) yshift=-pow((time-0.75)/0.25,0.75);
- if ((ofGetElapsedTimeMillis()-startTime)>duration) isPlaying=false;
- }
- img.draw(x-(anchorPoint.x*scale),y-(anchorPoint.y*scale)+(yshift*img.getHeight()*scale),img.getWidth()*scale,img.getHeight()*scale);
}