1 // Created by: Kirill Gavrilov
2 // Copyright (c) 2016 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 #ifndef _AIS_AnimationTimer_HeaderFile
16 #define _AIS_AnimationTimer_HeaderFile
18 #include <OSD_Timer.hxx>
19 #include <Standard_Transient.hxx>
20 #include <Standard_Type.hxx>
22 //! Auxiliary class defining the animation timer.
23 class AIS_AnimationTimer : public Standard_Transient
25 DEFINE_STANDARD_RTTIEXT(AIS_AnimationTimer, Standard_Transient)
28 //! Empty constructor.
29 AIS_AnimationTimer() : myTimerFrom (0.0), myTimerSpeed (1.0) {}
31 //! Return elapsed time in seconds.
32 Standard_Real ElapsedTime() const
34 return myTimerFrom + myTimer.ElapsedTime() * myTimerSpeed;
37 //! Return playback speed coefficient (1.0 means normal speed).
38 Standard_Real PlaybackSpeed() const { return myTimerSpeed; }
40 //! Setup playback speed coefficient.
41 Standard_EXPORT void SetPlaybackSpeed (const Standard_Real theSpeed);
43 //! Return true if timer has been started.
44 Standard_Boolean IsStarted() const
46 return myTimer.IsStarted();
56 Standard_EXPORT void Pause();
59 Standard_EXPORT void Stop();
61 //! Seek the timer to specified position.
62 Standard_EXPORT void Seek (const Standard_Real theTime);
67 Standard_Real myTimerFrom;
68 Standard_Real myTimerSpeed;
72 DEFINE_STANDARD_HANDLE(AIS_AnimationTimer, Standard_Transient)
74 #endif // _AIS_AnimationTimer_HeaderFile