| KWin
    | 
#include <springmotion.h>
| Public Member Functions | |
| SpringMotion () | |
| SpringMotion (qreal springConstant, qreal dampingRatio) | |
| void | advance (std::chrono::milliseconds delta) | 
| bool | isMoving () const | 
| qreal | velocity () const | 
| void | setVelocity (qreal velocity) | 
| qreal | position () const | 
| void | setPosition (qreal position) | 
| qreal | anchor () const | 
| void | setAnchor (qreal anchor) | 
| qreal | springConstant () const | 
| qreal | dampingRatio () const | 
| qreal | epsilon () const | 
| void | setEpsilon (qreal epsilon) | 
The SpringMotion class simulates the motion of a spring along one dimension using the mass-spring-damper model. The sping constant parameter controls the acceleration of the spring. The damping ratio controls the oscillation of the spring.
Definition at line 21 of file springmotion.h.
| KWin::SpringMotion::SpringMotion | ( | ) | 
Definition at line 19 of file springmotion.cpp.
| KWin::SpringMotion::SpringMotion | ( | qreal | springConstant, | 
| qreal | dampingRatio ) | 
Definition at line 24 of file springmotion.cpp.
| void KWin::SpringMotion::advance | ( | std::chrono::milliseconds | delta | ) | 
Advance the simulation by the given delta milliseconds.
Definition at line 139 of file springmotion.cpp.
| qreal KWin::SpringMotion::anchor | ( | ) | const | 
Returns the anchor position. It's the position that the spring is pulled towards.
Definition at line 90 of file springmotion.cpp.
| qreal KWin::SpringMotion::dampingRatio | ( | ) | const | 
Returns the damping ratio. It controls the oscillation of the spring. Potential values:
Definition at line 47 of file springmotion.cpp.
| qreal KWin::SpringMotion::epsilon | ( | ) | const | 
If the distance of the mass between two consecutive simulations is smaller than the epsilon value, consider that the mass has stopped moving.
Definition at line 80 of file springmotion.cpp.
| bool KWin::SpringMotion::isMoving | ( | ) | const | 
Definition at line 37 of file springmotion.cpp.
| qreal KWin::SpringMotion::position | ( | ) | const | 
Returns the current position.
Definition at line 66 of file springmotion.cpp.
| void KWin::SpringMotion::setAnchor | ( | qreal | anchor | ) | 
Definition at line 95 of file springmotion.cpp.
| void KWin::SpringMotion::setEpsilon | ( | qreal | epsilon | ) | 
Definition at line 85 of file springmotion.cpp.
| void KWin::SpringMotion::setPosition | ( | qreal | position | ) | 
Definition at line 71 of file springmotion.cpp.
| void KWin::SpringMotion::setVelocity | ( | qreal | velocity | ) | 
Definition at line 57 of file springmotion.cpp.
| qreal KWin::SpringMotion::springConstant | ( | ) | const | 
Returns the spring constant. It controls the acceleration of the spring.
Definition at line 42 of file springmotion.cpp.
| qreal KWin::SpringMotion::velocity | ( | ) | const | 
Returns the current velocity.
Definition at line 52 of file springmotion.cpp.