Done reports whether all effects have finished playing. Always returns false for a looping EffectWidget.
()
| 165 | // Done reports whether all effects have finished playing. |
| 166 | // Always returns false for a looping EffectWidget. |
| 167 | func (w *EffectWidget) Done() bool { |
| 168 | if w.loop { |
| 169 | return false |
| 170 | } |
| 171 | w.mu.Lock() |
| 172 | defer w.mu.Unlock() |
| 173 | if !w.started { |
| 174 | return false |
| 175 | } |
| 176 | elapsed := time.Since(w.startTime) |
| 177 | return elapsed >= totalDuration(w.effects) |
| 178 | } |
| 179 | |
| 180 | // Draw implements widgetapi.Widget. |
| 181 | func (w *EffectWidget) Draw(cvs *canvas.Canvas, meta *widgetapi.Meta) error { |