# ParallaxTarget.DirectPropertyTarget

# ParallaxTarget.DirectPropertyTarget

Artifact:[androidx.leanback:leanback](https://developer.android.com/jetpack/androidx/releases/leanback)  
[View Source](https://cs.android.com/search?q=file:androidx/leanback/widget/ParallaxTarget.java+class:androidx.leanback.widget.ParallaxTarget.DirectPropertyTarget)  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/leanback/widget/ParallaxTarget.DirectPropertyTarget "View this page in Java")

<br />

```
class ParallaxTarget.DirectPropertyTarget<T, V : Number?> : ParallaxTarget
```

<br />

|---|---|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)                                                                                                |||
| ↳ | [androidx.leanback.widget.ParallaxTarget](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ParallaxTarget)                                              ||
|   | ↳ | [androidx.leanback.widget.ParallaxTarget.DirectPropertyTarget](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ParallaxTarget.DirectPropertyTarget) |

*** ** * ** ***

DirectPropertyTarget is to support direct mapping into either Integer Property or Float Property. App uses convenient method[target](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ParallaxEffect#target(T,android.util.Property<T,V>))to add a direct mapping.  

|                                          Parameters                                          |
|----------------------------------------------------------------------------------------------|-----------------------------------------|
| `<T>`                                                                                        | Type of target object.                  |
| `<V : `[Number](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-number/index.html)`?>` | Type of value, either Integer or Float. |

## Summary

|                                                                                                                                                                                          ### Public constructors                                                                                                                                                                                           |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [DirectPropertyTarget](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ParallaxTarget.DirectPropertyTarget#DirectPropertyTarget(java.lang.Object,android.util.Property<T,V>))`(targetObject: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`!, property: `[Property](https://developer.android.com/reference/android/util/Property.html)`<T!, V!>!)` |

|                                ### Public functions                                 |
|-------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)       | [directUpdate](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ParallaxTarget.DirectPropertyTarget#directUpdate(java.lang.Number))`(value: `[Number](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-number/index.html)`!)` Directly update the target using a float or int value.                                                                             |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [isDirectMapping](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ParallaxTarget.DirectPropertyTarget#isDirectMapping())`()` Returns true as DirectPropertyTarget receives a number to update Property in[directUpdate](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ParallaxTarget.DirectPropertyTarget#directUpdate(java.lang.Number)). |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                          ### Inherited functions                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From[androidx.leanback.widget.ParallaxTarget](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ParallaxTarget) |-------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [update](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ParallaxTarget#update(float))`(fraction: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`)` Implementation class is supposed to update target with the provided fraction (between 0 and 1). | |

## Public constructors

### DirectPropertyTarget

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)  

```
DirectPropertyTarget(targetObject: Any!, property: Property<T!, V!>!)
```  

|                                              Parameters                                               |
|-------------------------------------------------------------------------------------------------------|------------------------------------------------------------------|
| `targetObject: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`!`        | Target object for perform Parallax                               |
| `property: `[Property](https://developer.android.com/reference/android/util/Property.html)`<T!, V!>!` | Target property, either an Integer Property or a Float Property. |

## Public functions

### directUpdate

```
fun directUpdate(value: Number!): Unit
```

Directly update the target using a float or int value. Called when[isDirectMapping](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ParallaxTarget#isDirectMapping())is true.  

|                                          Parameters                                           |
|-----------------------------------------------------------------------------------------------|----------------------------|
| `value: `[Number](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-number/index.html)`!` | Either int or float value. |

|                                                          See also                                                           |
|-----------------------------------------------------------------------------------------------------------------------------|---|
| [isDirectMapping](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ParallaxTarget#isDirectMapping()) |   |

### isDirectMapping

```
fun isDirectMapping(): Boolean
```

Returns true as DirectPropertyTarget receives a number to update Property in[directUpdate](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ParallaxTarget.DirectPropertyTarget#directUpdate(java.lang.Number)).