A helper class to calculate inertial scrolling. 更多...
#include <InertialScrollManager.h>
Public 成员函数 | |
| void | AddScrollSample (float Delta, double CurrentTime) |
| Adds a scroll velocity sample to help calculate a smooth velocity | |
| void | ClearScrollVelocity () |
| Instantly end the inertial scroll | |
| FInertialScrollManager (double SampleTimeout=0.1f) | |
| Constructor 更多... | |
| float | GetScrollVelocity () const |
| Gets the calculated velocity of the scroll. | |
| void | UpdateScrollVelocity (const float InDeltaTime) |
| Updates the current scroll velocity. 更多... | |
A helper class to calculate inertial scrolling.
This class combines a percentage of velocity lost per second coupled with a static amount of velocity lost per second in order to achieve a quick decay when the velocity grows small enough, and the percentage of friction lost prevents large velocities from scrolling forever.
| FInertialScrollManager::FInertialScrollManager | ( | double | SampleTimeout = 0.1f | ) |
Constructor
| ScrollDecceleration | The acceleration against the velocity causing it to decay. |
| SampleTimeout | Samples older than this amount of time will be discarded. |
| void FInertialScrollManager::UpdateScrollVelocity | ( | const float | InDeltaTime | ) |
Updates the current scroll velocity.
Call every frame.