# FloatPropertyCompat

Artifact: [androidx.dynamicanimation:dynamicanimation](https://developer.android.com/jetpack/androidx/releases/dynamicanimation) [View Source](https://cs.android.com/search?q=file:androidx/dynamicanimation/animation/FloatPropertyCompat.java+class:androidx.dynamicanimation.animation.FloatPropertyCompat) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

*** ** * ** ***


```
public abstract class FloatPropertyCompat<T>
```

<br />

Known direct subclasses [DynamicAnimation.ViewProperty](https://developer.android.com/reference/androidx/dynamicanimation/animation/DynamicAnimation.ViewProperty)

|---|---|
| `https://developer.android.com/reference/androidx/dynamicanimation/animation/DynamicAnimation.ViewProperty` | ViewProperty holds the access of a property of a `https://developer.android.com/reference/android/view/View.html`. |

*** ** * ** ***

FloatPropertyCompat is an abstraction that can be used to represent a mutable float value that is held in a host object. To access this float value, `https://developer.android.com/reference/androidx/dynamicanimation/animation/FloatPropertyCompat#setValue(T,float)` and getter `https://developer.android.com/reference/androidx/dynamicanimation/animation/FloatPropertyCompat#getValue(T)` need to be implemented. Both the setter and the getter take the primitive `float` type and avoids autoboxing and other overhead associated with the `Float` class.

For API 24 and later, `https://developer.android.com/reference/android/util/FloatProperty.html` instances can be converted to `https://developer.android.com/reference/androidx/dynamicanimation/animation/FloatPropertyCompat` through `https://developer.android.com/reference/androidx/dynamicanimation/animation/FloatPropertyCompat#createFloatPropertyCompat(android.util.FloatProperty<T>)`.

| Parameters |
|---|---|
| `<T>` | the class on which the Property is declared |

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/dynamicanimation/animation/FloatPropertyCompat#FloatPropertyCompat(java.lang.String)(https://developer.android.com/reference/java/lang/String.html name)` A constructor that takes an identifying name. |

| ### Public methods |
|---|---|
| `static https://developer.android.com/reference/androidx/dynamicanimation/animation/FloatPropertyCompat<T>` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 24) <T> https://developer.android.com/reference/androidx/dynamicanimation/animation/FloatPropertyCompat#createFloatPropertyCompat(android.util.FloatProperty<T>)(https://developer.android.com/reference/android/util/FloatProperty.html<T> property)` Create a `https://developer.android.com/reference/androidx/dynamicanimation/animation/FloatPropertyCompat` wrapper for a `https://developer.android.com/reference/android/util/FloatProperty.html` object. |
| `abstract float` | `https://developer.android.com/reference/androidx/dynamicanimation/animation/FloatPropertyCompat#getValue(T)(T object)` Returns the current value that this property represents on the given `object`. |
| `abstract void` | `https://developer.android.com/reference/androidx/dynamicanimation/animation/FloatPropertyCompat#setValue(T,float)(T object, float value)` Sets the value on `object` which this property represents. |

## Public constructors

### FloatPropertyCompat

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

```
public FloatPropertyCompat(String name)
```

A constructor that takes an identifying name.

## Public methods

### createFloatPropertyCompat

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

```
@RequiresApi(value = 24)
public static FloatPropertyCompat<T> <T> createFloatPropertyCompat(FloatProperty<T> property)
```

Create a `https://developer.android.com/reference/androidx/dynamicanimation/animation/FloatPropertyCompat` wrapper for a `https://developer.android.com/reference/android/util/FloatProperty.html` object. The new `https://developer.android.com/reference/androidx/dynamicanimation/animation/FloatPropertyCompat` instance will access and modify the property value of `https://developer.android.com/reference/android/util/FloatProperty.html` through the `https://developer.android.com/reference/android/util/FloatProperty.html` instance's setter and getter.

| Parameters |
|---|---|
| `<T>` | the class on which the Property is declared |
| `https://developer.android.com/reference/android/util/FloatProperty.html<T> property` | FloatProperty instance to be wrapped |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/dynamicanimation/animation/FloatPropertyCompat<T>` | a new `https://developer.android.com/reference/androidx/dynamicanimation/animation/FloatPropertyCompat` wrapper for the given `https://developer.android.com/reference/android/util/FloatProperty.html` object |

### getValue

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

```
public abstract float getValue(T object)
```

Returns the current value that this property represents on the given `object`.

| Parameters |
|---|---|
| `T object` | object which this property represents |

| Returns |
|---|---|
| `float` | the current property value of the given object |

### setValue

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

```
public abstract void setValue(T object, float value)
```

Sets the value on `object` which this property represents.

| Parameters |
|---|---|
| `T object` | object which this property represents |
| `float value` | new value of the property |