FloUI.Scrollable.Acceleration (FloUI v0.1.0-alpha.6) 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 t: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
Specs
settings() :: %{ optional(:acceleration) => number(), optional(:mass) => number(), optional(:counter_pressure) => number() }
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
Specs
t() :: %{ acceleration: number(), mass: number(), counter_pressure: number(), force: v2(), speed: v2() }
Data structure with the necessary values to calculate the current scroll speed.
Specs
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
Specs
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.
Specs
Apply force in the specified direction to make the Scenic.Scrollable
component move.
Specs
Initializes a t:Scenic.Scrollable.Acceleration.t
state object based on the passed t:Scenic.Scrollable.Acceleration.settings/0
.
When nil is passed, the default settings will be used.
Specs
Find out if the Scenic.Scrollable
component is currently stationary.
Specs
Directly update the speed of the Scenic.Scrollable
components scroll movement, to make it move at a certain velocity in the given direction.
Specs
Calculate the translation of a point based on the current speed.