Hasty Badger
Small UI library (a branch of Turbo Badger)
 All Classes Namespaces Functions Variables Enumerations Enumerator Friends Groups Pages
tb::TBScrollerFunction Class Reference

TBScrollerFunction does the calculations of time, speed and distance that decides how the slow down of a scroll will happen. More...

#include <tb_scroller.h>

Public Member Functions

 TBScrollerFunction (float decay)
 
float GetDurationFromSpeed (float start_speed)
 Calculate the duration needed until the end distance is reached from the given start speed. More...
 
float GetSpeedFromDistance (float distance)
 Calculate the start speed needed to reach the given distance. More...
 
float GetDistanceAtTime (float start_speed, float elapsed_time_ms)
 Calculate the distance reached at the given elapsed_time_ms with the given start_speed. More...
 
int GetDistanceAtTimeInt (float start_speed, float elapsed_time_ms)
 Same as GetDistanceAtTime but rounded to integer. More...
 

Detailed Description

TBScrollerFunction does the calculations of time, speed and distance that decides how the slow down of a scroll will happen.

Note: Speed is in pixels per millisecond. Duration is in milliseconds and distance is in pixels. Distance and speed may be negative!

Member Function Documentation

float tb::TBScrollerFunction::GetDistanceAtTime ( float  start_speed,
float  elapsed_time_ms 
)

Calculate the distance reached at the given elapsed_time_ms with the given start_speed.

int tb::TBScrollerFunction::GetDistanceAtTimeInt ( float  start_speed,
float  elapsed_time_ms 
)

Same as GetDistanceAtTime but rounded to integer.

float tb::TBScrollerFunction::GetDurationFromSpeed ( float  start_speed)

Calculate the duration needed until the end distance is reached from the given start speed.

float tb::TBScrollerFunction::GetSpeedFromDistance ( float  distance)

Calculate the start speed needed to reach the given distance.


The documentation for this class was generated from the following files: