Skip to contents

Returns a list of suggested scroll_lag arguments under 50ms as a function of monitor refresh rate and the next frame rank.

Usage

get_scroll_lag(refresh_rate = 60, n_frame = 0)

Arguments

refresh_rate

The refresh rate of the monitor

n_frame

The frame rank at which the change is assumed to happen on average (e.g. n = 1 for the next frame). In general, n = 2 is recommended

Value

Either prints a list of different possible scroll_lag arguments under 100ms, or returns the exact scroll_lag for the specified n_frame

Examples

# Display all suggested scroll_lag arguments for a 120Hz monitor:
get_scroll_lag(refresh_rate = 120)
#> Suggested scroll_lag under 50ms with a 120Hz monitor:
#> -----------------------------------------------------
#> next frame: 4.167
#> 2 frames: 12.5
#> 3 frames: 20.833
#> 4 frames: 29.167
#> 5 frames: 37.5
#> 6 frames: 45.833

# Get the scroll_lag argument assuming that, on average, changes will be
# displayed after 3 monitor frames on a 60Hz monitor:
get_scroll_lag(refresh_rate = 60, n_frame = 3)
#> [1] 41.66667