| 149 | } |
| 150 | |
| 151 | float TimelineItem::loopTime( float absTime ) |
| 152 | { |
| 153 | float result = absTime; |
| 154 | |
| 155 | if( mPingPong ) { |
| 156 | result = math<float>::fmod( result * mInvDuration, 2 ); // varies from 0-2 |
| 157 | if( result <= 1 ) |
| 158 | result *= mDuration; |
| 159 | else |
| 160 | result = ( 2 - result ) * mDuration; |
| 161 | } |
| 162 | else if( mLoop ) { |
| 163 | result = math<float>::fmod( result * mInvDuration, 1 ); |
| 164 | result *= mDuration; |
| 165 | } |
| 166 | |
| 167 | return result; |
| 168 | } |
| 169 | |
| 170 | } // namespace cinder |