The Android Developer Challenge is back! Submit your idea before December 2.

ParallaxEffect

abstract class ParallaxEffect
kotlin.Any
   ↳ androidx.leanback.widget.ParallaxEffect

ParallaxEffect class drives changes in ParallaxTarget in response to changes in variables defined in Parallax.

ParallaxEffect has a list of Parallax.PropertyMarkerValues which represents the range of values that source variables can take. The main function is ParallaxEffect#performMapping(Parallax) which computes a fraction between 0 and 1 based on the current values of variables in Parallax. As the parallax effect goes on, the fraction increases from 0 at beginning to 1 at the end. Then the fraction is passed on to ParallaxTarget#update(float).

App use Parallax#addEffect(PropertyMarkerValue...) to create a ParallaxEffect.

Summary

Public methods

Unit

Add a ParallaxTarget to run parallax effect.

MutableList<Parallax.PropertyMarkerValue<Any!>!>!

Returns the list of PropertyMarkerValues, which represents the range of values that source variables can take.

MutableList<ParallaxTarget!>!

Returns the list of ParallaxTarget objects.

Unit
performMapping(source: Parallax<Property<*, *>!>!)

Perform mapping from Parallax to list of ParallaxTarget.

Unit

Remove a ParallaxTarget object from the list.

Unit

Sets the list of PropertyMarkerValues, which represents the range of values that source variables can take.

ParallaxEffect!

Add a ParallaxTarget to run parallax effect.

ParallaxEffect!
target(targetObject: Any!, values: PropertyValuesHolder!)

Creates a ParallaxTarget from PropertyValuesHolder and adds it to the list of targets.

ParallaxEffect!
target(targetObject: T, targetProperty: Property<T, V>!)

Creates a ParallaxTarget using direct mapping from source property into target property, the new ParallaxTarget will be added to its list of targets.

Public methods

addTarget

fun addTarget(target: ParallaxTarget!): Unit

Add a ParallaxTarget to run parallax effect.

Parameters
target ParallaxTarget!: ParallaxTarget to add.

getPropertyRanges

fun getPropertyRanges(): MutableList<Parallax.PropertyMarkerValue<Any!>!>!

Returns the list of PropertyMarkerValues, which represents the range of values that source variables can take.

Return
MutableList<Parallax.PropertyMarkerValue<Any!>!>!: A list of Parallax.PropertyMarkerValues.

getTargets

fun getTargets(): MutableList<ParallaxTarget!>!

Returns the list of ParallaxTarget objects.

Return
MutableList<ParallaxTarget!>!: The list of ParallaxTarget objects.

performMapping

fun performMapping(source: Parallax<Property<*, *>!>!): Unit

Perform mapping from Parallax to list of ParallaxTarget.

removeTarget

fun removeTarget(target: ParallaxTarget!): Unit

Remove a ParallaxTarget object from the list.

Parameters
target ParallaxTarget!: The ParallaxTarget object to be removed.

setPropertyRanges

fun setPropertyRanges(vararg markerValues: Parallax.PropertyMarkerValue<Any!>!): Unit

Sets the list of PropertyMarkerValues, which represents the range of values that source variables can take.

Parameters
markerValues Parallax.PropertyMarkerValue<Any!>!: A list of PropertyMarkerValues.

target

fun target(target: ParallaxTarget!): ParallaxEffect!

Add a ParallaxTarget to run parallax effect.

Parameters
target ParallaxTarget!: ParallaxTarget to add.
Return
ParallaxEffect!: This ParallaxEffect object, allowing calls to methods in this class to be chained.

target

fun target(targetObject: Any!, values: PropertyValuesHolder!): ParallaxEffect!

Creates a ParallaxTarget from PropertyValuesHolder and adds it to the list of targets.

Parameters
targetObject Any!: Target object for PropertyValuesHolderTarget.
values Any!: PropertyValuesHolder for PropertyValuesHolderTarget.
Return
ParallaxEffect!: This ParallaxEffect object, allowing calls to methods in this class to be chained.

target

fun <T : Any!, V : Number!> target(targetObject: T, targetProperty: Property<T, V>!): ParallaxEffect!

Creates a ParallaxTarget using direct mapping from source property into target property, the new ParallaxTarget will be added to its list of targets.

Parameters
targetObject T: Target object for property.
targetProperty T: The target property that will receive values.
<T> T: Type of target object.
<V> T: Type of target property value, either Integer or Float.
Return
ParallaxEffect!: This ParallaxEffect object, allowing calls to methods in this class to be chained.