ParallaxTarget


public abstract class ParallaxTarget

Known direct subclasses
ParallaxTarget.DirectPropertyTarget

DirectPropertyTarget is to support direct mapping into either Integer Property or Float Property.

ParallaxTarget.PropertyValuesHolderTarget

PropertyValuesHolderTarget is an implementation of ParallaxTarget that uses PropertyValuesHolder to update the target object.


ParallaxTarget is responsible for updating the target through the update method or the directUpdate method when isDirectMapping is true. When isDirectMapping is false, ParallaxEffect transforms the values of Parallax, which represents the current state of UI, into a float value between 0 and 1. That float value is passed into update method.

Summary

Nested types

public final class ParallaxTarget.DirectPropertyTarget<T extends Object, V extends Number> extends ParallaxTarget

DirectPropertyTarget is to support direct mapping into either Integer Property or Float Property.

PropertyValuesHolderTarget is an implementation of ParallaxTarget that uses PropertyValuesHolder to update the target object.

Public constructors

Public methods

void

Directly update the target using a float or int value.

boolean

Returns true if the ParallaxTarget is directly mapping from source value, directUpdate will be used to update value, otherwise update(fraction) will be called to update value.

void
update(float fraction)

Implementation class is supposed to update target with the provided fraction (between 0 and 1).

Public constructors

ParallaxTarget

Added in 1.1.0
public ParallaxTarget()

Public methods

directUpdate

Added in 1.1.0
public void directUpdate(Number value)

Directly update the target using a float or int value. Called when isDirectMapping is true.

Parameters
Number value

Either int or float value.

See also
isDirectMapping

isDirectMapping

Added in 1.1.0
public boolean isDirectMapping()

Returns true if the ParallaxTarget is directly mapping from source value, directUpdate will be used to update value, otherwise update(fraction) will be called to update value. Default implementation returns false.

Returns
boolean

True if direct mapping, false otherwise.

See also
directUpdate
update

update

Added in 1.1.0
public void update(float fraction)

Implementation class is supposed to update target with the provided fraction (between 0 and 1). The fraction represents percentage of completed change (e.g. scroll) on target. Called only when isDirectMapping is false.

Parameters
float fraction

Fraction between 0 to 1.

See also
isDirectMapping