# DampingNode

Artifact: [androidx.ink:ink-brush](https://developer.android.com/jetpack/androidx/releases/ink) [View Source](https://cs.android.com/search?q=file:androidx/ink/brush/behavior/DampingNode.kt+class:androidx.ink.brush.behavior.DampingNode) Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

*** ** * ** ***


```
public final class DampingNode extends ValueNode
```

<br />

|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) ||||
| ↳ | [androidx.ink.brush.behavior.Node](https://developer.android.com/reference/androidx/ink/brush/behavior/Node) |||
|   | ↳ | [androidx.ink.brush.behavior.ValueNode](https://developer.android.com/reference/androidx/ink/brush/behavior/ValueNode) ||
|   |   | ↳ | [androidx.ink.brush.behavior.DampingNode](https://developer.android.com/reference/androidx/ink/brush/behavior/DampingNode) |

*** ** * ** ***

A `https://developer.android.com/reference/androidx/ink/brush/behavior/ValueNode` that applies damping to an input value, smoothing out rapid changes by causing the output value to asymptotically decay towards the input value over a specified time or distance.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/ink/brush/behavior/DampingNode#DampingNode(androidx.ink.brush.behavior.ProgressDomain,kotlin.Float,androidx.ink.brush.behavior.ValueNode)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/behavior/ProgressDomain dampOver, float strength, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/behavior/ValueNode input )` Creates a `https://developer.android.com/reference/androidx/ink/brush/behavior/DampingNode` that damps changes in an input value, causing the output value to slowly follow changes in the input value over a specified time or distance. |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/ink/brush/behavior/DampingNode#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/behavior/ProgressDomain` | `https://developer.android.com/reference/androidx/ink/brush/behavior/DampingNode#getDampOver()()` The domain units over which damping is applied (whether distance or time). |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/behavior/ValueNode` | `https://developer.android.com/reference/androidx/ink/brush/behavior/DampingNode#getInput()()` The input node that produces the value to be modified by the damping. |
| `final float` | `https://developer.android.com/reference/androidx/ink/brush/behavior/DampingNode#getStrength()()` The strength of the damping to apply, measured in `https://developer.android.com/reference/androidx/ink/brush/behavior/DampingNode#dampOver()` units. |
| `int` | `https://developer.android.com/reference/androidx/ink/brush/behavior/DampingNode#hashCode()()` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/ink/brush/behavior/DampingNode#toString()()` |

### Inherited methods

From [androidx.ink.brush.behavior.Node](https://developer.android.com/reference/androidx/ink/brush/behavior/Node) `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/Version` `https://developer.android.com/reference/androidx/ink/brush/behavior/Node#calculateMinimumRequiredVersion()()`

Returns the minimum required `https://developer.android.com/reference/androidx/ink/brush/Version` for this `https://developer.android.com/reference/androidx/ink/brush/behavior/Node`.
`final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/behavior/ValueNode>` `https://developer.android.com/reference/androidx/ink/brush/behavior/Node#getInputs()()`

The ordered list of inputs that this node directly depends on.

## Public constructors

### DampingNode

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

```
public DampingNode(
    @NonNull ProgressDomain dampOver,
    float strength,
    @NonNull ValueNode input
)
```

Creates a `https://developer.android.com/reference/androidx/ink/brush/behavior/DampingNode` that damps changes in an input value, causing the output value to slowly follow changes in the input value over a specified time or distance.

Damping smooths changes in the input value using standard [exponential decay](https://en.wikipedia.org/wiki/Exponential_decay), where `https://developer.android.com/reference/androidx/ink/brush/behavior/DampingNode#(androidx.ink.brush.behavior.ProgressDomain,kotlin.Float,androidx.ink.brush.behavior.ValueNode)` acts as the decay constant, measured in `https://developer.android.com/reference/androidx/ink/brush/behavior/DampingNode#(androidx.ink.brush.behavior.ProgressDomain,kotlin.Float,androidx.ink.brush.behavior.ValueNode)` units. The greater the damping strength, the longer it takes for the output value to asymptotically approach the input value. For example, if `https://developer.android.com/reference/androidx/ink/brush/behavior/DampingNode#(androidx.ink.brush.behavior.ProgressDomain,kotlin.Float,androidx.ink.brush.behavior.ValueNode)` is set to `https://developer.android.com/reference/androidx/ink/brush/behavior/ProgressDomain#TIME_IN_SECONDS()` and `https://developer.android.com/reference/androidx/ink/brush/behavior/DampingNode#(androidx.ink.brush.behavior.ProgressDomain,kotlin.Float,androidx.ink.brush.behavior.ValueNode)` is 0.5, then it will take about half a second for the output value to decay most of the way (see the documentation of the `https://developer.android.com/reference/androidx/ink/brush/behavior/DampingNode#(androidx.ink.brush.behavior.ProgressDomain,kotlin.Float,androidx.ink.brush.behavior.ValueNode)` property) towards the input value; if `https://developer.android.com/reference/androidx/ink/brush/behavior/DampingNode#(androidx.ink.brush.behavior.ProgressDomain,kotlin.Float,androidx.ink.brush.behavior.ValueNode)` is 0.25 then it will take only a quarter second. If `https://developer.android.com/reference/androidx/ink/brush/behavior/DampingNode#(androidx.ink.brush.behavior.ProgressDomain,kotlin.Float,androidx.ink.brush.behavior.ValueNode)` is zero, then there is no damping at all, and the output value will instantly snap to the input value whenever that value changes.

If `https://developer.android.com/reference/androidx/ink/brush/behavior/DampingNode#(androidx.ink.brush.behavior.ProgressDomain,kotlin.Float,androidx.ink.brush.behavior.ValueNode)` is `https://developer.android.com/reference/androidx/ink/brush/behavior/ProgressDomain#DISTANCE_IN_CENTIMETERS()` and the stroke input data does not indicate the relationship between stroke units and physical units (e.g. as may be the case for programmatically-generated inputs), then the output value will be null regardless of the input.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/behavior/ProgressDomain dampOver` | The domain units over which damping is applied. |
| `float strength` | The amount of damping to apply, measured in `https://developer.android.com/reference/androidx/ink/brush/behavior/DampingNode#(androidx.ink.brush.behavior.ProgressDomain,kotlin.Float,androidx.ink.brush.behavior.ValueNode)` units. Must be finite and non-negative. Smaller values result in less damping (i.e. faster transitions, following the input more closely), while larger values result in more damping (i.e. slower transitions and heavier smoothing). |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/behavior/ValueNode input` | The input node that produces the value to be modified by the damping. |

## Public methods

### equals

```
public boolean equals(Object other)
```

### getDampOver

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

```
public final @NonNull ProgressDomain getDampOver()
```

The domain units over which damping is applied (whether distance or time).

### getInput

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

```
public final @NonNull ValueNode getInput()
```

The input node that produces the value to be modified by the damping.

### getStrength

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

```
public final float getStrength()
```

The strength of the damping to apply, measured in `https://developer.android.com/reference/androidx/ink/brush/behavior/DampingNode#dampOver()` units.

This represents the amount of distance or time it will take for the output value of this node to exponentially decay most of the way (see note below) towards the input value.

This value will always be finite and non-negative.

*Note:* This value is used as the decay constant for a standard [exponential decay](https://en.wikipedia.org/wiki/Exponential_decay) function, so "most of the way" above means specifically 1 - 1/e, about 63%. This may seem like an arbitrary amount, but using a standard natural-base exponential decay function has nicer mathematical properties than using another base, and tends to feel more intuitive when tuning the `https://developer.android.com/reference/androidx/ink/brush/behavior/DampingNode#strength()` value by hand.

### hashCode

```
public int hashCode()
```

### toString

```
public @NonNull String toString()
```