Scenic Scrollable v0.1.0 Scenic.Scrollable.Acceleration View Source
Module for calculating the scroll speed for Scenic.Scrollable
components.
Link to this section Summary
Types
Data structure containing settings that define the behaviour of the Scenic.Scrollable
components scroll speed and acceleration. Note that the Scenic.Scrollable
content may not be able to move when the acceleration is set too low, or the mass and counter_pressure are set too high
Data structure with the necessary values to calculate the current scroll speed
Shorthand for Scenic.Math.vector_2/0
.
Consists of a tuple containing the x and y numeric values
Functions
Apply counter pressure to the current Scenic.Scrollable
comonents movement.
The counter pressures strength is calculated based on the Scenic.Scrollable
components current speed, the components mass set during initialization, and the counter pressure value set during initialization
Apply force in the specified direction to make the Scenic.Scrollable
component move
Initializes a t:Scenic.Scrollable.Acceleration.t
state object based on the passed Scenic.Scrollable.Acceleration.settings/0
.
When nil is passed, the default settings will be used
Find out if the Scenic.Scrollable
component is currently stationary
Directly update the speed of the Scenic.Scrollable
components scroll movement, to make it move at a certain velocity in the given direction
Calculate the translation of a point based on the current speed
Link to this section Types
settings() View Source
Data structure containing settings that define the behaviour of the Scenic.Scrollable
components scroll speed and acceleration. Note that the Scenic.Scrollable
content may not be able to move when the acceleration is set too low, or the mass and counter_pressure are set too high.
Default settings:
- acceleration: 20
- mass: 1
- counter_pressure: 0.1
Data structure with the necessary values to calculate the current scroll speed.
v2()
View Source
v2() :: Scenic.Math.vector_2()
v2() :: Scenic.Math.vector_2()
Shorthand for Scenic.Math.vector_2/0
.
Consists of a tuple containing the x and y numeric values.
Link to this section Functions
apply_counter_pressure(state) View Source
Apply counter pressure to the current Scenic.Scrollable
comonents movement.
The counter pressures strength is calculated based on the Scenic.Scrollable
components current speed, the components mass set during initialization, and the counter pressure value set during initialization.
apply_force(state, force) View Source
Apply force in the specified direction to make the Scenic.Scrollable
component move.
init(settings) View Source
Initializes a t:Scenic.Scrollable.Acceleration.t
state object based on the passed Scenic.Scrollable.Acceleration.settings/0
.
When nil is passed, the default settings will be used.
is_stationary?(arg1) View Source
Find out if the Scenic.Scrollable
component is currently stationary.
set_speed(state, speed) View Source
Directly update the speed of the Scenic.Scrollable
components scroll movement, to make it move at a certain velocity in the given direction.
translate(map, position) View Source
Calculate the translation of a point based on the current speed.