diff options
| author | Comment <tim@gray.(none)> | 2012-12-12 10:57:40 +0000 |
|---|---|---|
| committer | Comment <tim@gray.(none)> | 2012-12-12 10:57:40 +0000 |
| commit | 19c84c74efd5b8ffd1fb8184037910c831990d2e (patch) | |
| tree | 19032ce28fed70a58ae95cc9937c50681e978b50 /vfg/src/Tag.cpp | |
| parent | 1db97e28061caec0b3e8ce998b92e1936edbf2e5 (diff) | |
version for galway gig
Diffstat (limited to 'vfg/src/Tag.cpp')
| -rwxr-xr-x | vfg/src/Tag.cpp | 28 |
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);
}
|
