# DifferentialMotionFlingTarget

# DifferentialMotionFlingTarget

Artifact:[androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core)  
[View Source](https://cs.android.com/search?q=file:androidx/core/view/DifferentialMotionFlingTarget.java+class:androidx.core.view.DifferentialMotionFlingTarget)  
Added in[1.13.0](https://developer.android.com/jetpack/androidx/releases/core#1.13.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/core/view/DifferentialMotionFlingTarget "View this page in Java")

<br />

```
interface DifferentialMotionFlingTarget
```

<br />

*** ** * ** ***

Represents an entity that may be flung by a differential motion or an entity that initiates fling on a target View.

## Summary

|                                ### Public functions                                 |
|-------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)     | [getScaledScrollFactor](https://developer.android.com/reference/kotlin/androidx/core/view/DifferentialMotionFlingTarget#getScaledScrollFactor())`()` Returns the scaled scroll factor to be used for differential motions.                                                                                                |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [startDifferentialMotionFling](https://developer.android.com/reference/kotlin/androidx/core/view/DifferentialMotionFlingTarget#startDifferentialMotionFling(float))`(velocity: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`)` Start flinging on the target View by a given velocity. |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)       | [stopDifferentialMotionFling](https://developer.android.com/reference/kotlin/androidx/core/view/DifferentialMotionFlingTarget#stopDifferentialMotionFling())`()` Stop any ongoing fling on the target View that is caused by a differential motion.                                                                       |

## Public functions

### getScaledScrollFactor

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

```
fun getScaledScrollFactor(): Float
```

Returns the scaled scroll factor to be used for differential motions. This is the value that the raw[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent.html)values should be multiplied with to get pixels.

This usually is one of the values provided by[ViewConfigurationCompat](https://developer.android.com/reference/kotlin/androidx/core/view/ViewConfigurationCompat). It is up to the client to choose and provide any value as per its internal configuration.  

|                                                                                                       See also                                                                                                       |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [getScaledHorizontalScrollFactor](https://developer.android.com/reference/kotlin/androidx/core/view/ViewConfigurationCompat#getScaledHorizontalScrollFactor(android.view.ViewConfiguration,android.content.Context)) |   |
| [getScaledVerticalScrollFactor](https://developer.android.com/reference/kotlin/androidx/core/view/ViewConfigurationCompat#getScaledVerticalScrollFactor(android.view.ViewConfiguration,android.content.Context))     |   |

### startDifferentialMotionFling

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

```
fun startDifferentialMotionFling(velocity: Float): Boolean
```

Start flinging on the target View by a given velocity.  

|                                         Parameters                                          |
|---------------------------------------------------------------------------------------------|---------------------------------------|
| `velocity: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | the fling velocity, in pixels/second. |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|-------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | `true`if fling was successfully initiated,`false`otherwise. |

### stopDifferentialMotionFling

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

```
fun stopDifferentialMotionFling(): Unit
```

Stop any ongoing fling on the target View that is caused by a differential motion.