# CustomVariable

Artifact: [androidx.constraintlayout:constraintlayout-core](https://developer.android.com/jetpack/androidx/releases/constraintlayout) [View Source](https://cs.android.com/search?q=file:androidx/constraintlayout/core/motion/CustomVariable.java+class:androidx.constraintlayout.core.motion.CustomVariable) Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

*** ** * ** ***


```
public class CustomVariable
```

<br />

*** ** * ** ***

Defines non standard Attributes

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#CustomVariable(androidx.constraintlayout.core.motion.CustomVariable)(https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable c)` |
| `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#CustomVariable(java.lang.String,int)(https://developer.android.com/reference/java/lang/String.html name, int attributeType)` |
| `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#CustomVariable(androidx.constraintlayout.core.motion.CustomVariable,java.lang.Object)(https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable source, https://developer.android.com/reference/java/lang/Object.html value)` |
| `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#CustomVariable(java.lang.String,int,java.lang.Object)(https://developer.android.com/reference/java/lang/String.html name, int attributeType, https://developer.android.com/reference/java/lang/Object.html value)` |
| `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#CustomVariable(java.lang.String,int,boolean)(https://developer.android.com/reference/java/lang/String.html name, int type, boolean value)` |
| `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#CustomVariable(java.lang.String,int,float)(https://developer.android.com/reference/java/lang/String.html name, int type, float value)` |
| `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#CustomVariable(java.lang.String,int,int)(https://developer.android.com/reference/java/lang/String.html name, int type, int value)` |
| `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#CustomVariable(java.lang.String,int,java.lang.String)(https://developer.android.com/reference/java/lang/String.html name, int type, https://developer.android.com/reference/java/lang/String.html value)` |

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#applyToWidget(androidx.constraintlayout.core.motion.MotionWidget)(https://developer.android.com/reference/androidx/constraintlayout/core/motion/MotionWidget view)` |
| `static https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#colorString(int)(int v)` |
| `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable` | `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#copy()()` |
| `boolean` | `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#diff(androidx.constraintlayout.core.motion.CustomVariable)(https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable customAttribute)` test if the two attributes are different |
| `boolean` | `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#getBooleanValue()()` |
| `int` | `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#getColorValue()()` |
| `float` | `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#getFloatValue()()` |
| `int` | `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#getIntegerValue()()` |
| `int` | `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#getInterpolatedColor(float[])(float[] value)` |
| `https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#getName()()` |
| `https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#getStringValue()()` |
| `int` | `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#getType()()` |
| `float` | `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#getValueToInterpolate()()` Transforms value to a float for the purpose of interpolation |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#getValuesToInterpolate(float[])(float[] ret)` |
| `static int` | `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#hsvToRgb(float,float,float)(float hue, float saturation, float value)` |
| `boolean` | `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#isContinuous()()` Continuous types are interpolated they are fired only at |
| `int` | `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#numberOfInterpolatedValues()()` The number of interpolation values that need to be interpolated Typically 1 but 3 for colors. |
| `static int` | `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#rgbaTocColor(float,float,float,float)(float r, float g, float b, float a)` |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#setBooleanValue(boolean)(boolean value)` |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#setFloatValue(float)(float value)` |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#setIntValue(int)(int value)` |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#setInterpolatedValue(androidx.constraintlayout.core.motion.MotionWidget,float[])(https://developer.android.com/reference/androidx/constraintlayout/core/motion/MotionWidget view, float[] value)` |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#setStringValue(java.lang.String)(https://developer.android.com/reference/java/lang/String.html value)` |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#setValue(java.lang.Object)(https://developer.android.com/reference/java/lang/Object.html value)` |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#setValue(float[])(float[] value)` |
| `https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/core/motion/CustomVariable#toString()()` |

## Public constructors

### CustomVariable

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

```
public CustomVariable(CustomVariable c)
```

### CustomVariable

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

```
public CustomVariable(String name, int attributeType)
```

### CustomVariable

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

```
public CustomVariable(CustomVariable source, Object value)
```

### CustomVariable

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

```
public CustomVariable(String name, int attributeType, Object value)
```

### CustomVariable

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

```
public CustomVariable(String name, int type, boolean value)
```

### CustomVariable

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

```
public CustomVariable(String name, int type, float value)
```

### CustomVariable

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

```
public CustomVariable(String name, int type, int value)
```

### CustomVariable

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

```
public CustomVariable(String name, int type, String value)
```

## Public methods

### applyToWidget

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

```
public void applyToWidget(MotionWidget view)
```

### colorString

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

```
public static String colorString(int v)
```

### copy

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

```
public CustomVariable copy()
```

### diff

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

```
public boolean diff(CustomVariable customAttribute)
```

test if the two attributes are different

### getBooleanValue

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

```
public boolean getBooleanValue()
```

### getColorValue

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

```
public int getColorValue()
```

### getFloatValue

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

```
public float getFloatValue()
```

### getIntegerValue

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

```
public int getIntegerValue()
```

### getInterpolatedColor

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

```
public int getInterpolatedColor(float[] value)
```

### getName

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

```
public String getName()
```

### getStringValue

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

```
public String getStringValue()
```

### getType

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

```
public int getType()
```

### getValueToInterpolate

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

```
public float getValueToInterpolate()
```

Transforms value to a float for the purpose of interpolation

| Returns |
|---|---|
| `float` | interpolation value |

### getValuesToInterpolate

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

```
public void getValuesToInterpolate(float[] ret)
```

### hsvToRgb

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

```
public static int hsvToRgb(float hue, float saturation, float value)
```

### isContinuous

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

```
public boolean isContinuous()
```

Continuous types are interpolated they are fired only at

### numberOfInterpolatedValues

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

```
public int numberOfInterpolatedValues()
```

The number of interpolation values that need to be interpolated Typically 1 but 3 for colors.

| Returns |
|---|---|
| `int` | Typically 1 but 3 for colors. |

### rgbaTocColor

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

```
public static int rgbaTocColor(float r, float g, float b, float a)
```

### setBooleanValue

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

```
public void setBooleanValue(boolean value)
```

### setFloatValue

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

```
public void setFloatValue(float value)
```

### setIntValue

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

```
public void setIntValue(int value)
```

### setInterpolatedValue

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

```
public void setInterpolatedValue(MotionWidget view, float[] value)
```

### setStringValue

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

```
public void setStringValue(String value)
```

### setValue

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

```
public void setValue(Object value)
```

### setValue

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

```
public void setValue(float[] value)
```

### toString

```
public String toString()
```