# 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)

*** ** * ** ***

Common/All
- Cmn

  ```
  class DampingNode : ValueNode
  ```

|---|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) ||||
| ↳ | [androidx.ink.brush.behavior.Node](https://developer.android.com/reference/kotlin/androidx/ink/brush/behavior/Node) |||
|   | ↳ | [androidx.ink.brush.behavior.ValueNode](https://developer.android.com/reference/kotlin/androidx/ink/brush/behavior/ValueNode) ||
|   |   | ↳ | [androidx.ink.brush.behavior.DampingNode](https://developer.android.com/reference/kotlin/androidx/ink/brush/behavior/DampingNode) |

*** ** * ** ***

A `https://developer.android.com/reference/kotlin/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/kotlin/androidx/ink/brush/behavior/DampingNode#DampingNode(androidx.ink.brush.behavior.ProgressDomain,kotlin.Float,androidx.ink.brush.behavior.ValueNode)(dampOver: https://developer.android.com/reference/kotlin/androidx/ink/brush/behavior/ProgressDomain, strength: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, input: https://developer.android.com/reference/kotlin/androidx/ink/brush/behavior/ValueNode)` Creates a `https://developer.android.com/reference/kotlin/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. | Cmn |

| ### Public functions |
|---|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/behavior/DampingNode#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/behavior/DampingNode#hashCode()()` | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/behavior/DampingNode#toString()()` | Cmn |

| ### Public properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/behavior/ProgressDomain` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/behavior/DampingNode#dampOver()` The domain units over which damping is applied (whether distance or time). | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/behavior/ValueNode` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/behavior/DampingNode#input()` The input node that produces the value to be modified by the damping. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/behavior/DampingNode#strength()` The strength of the damping to apply, measured in `https://developer.android.com/reference/kotlin/androidx/ink/brush/behavior/DampingNode#dampOver()` units. | Cmn |

### Inherited functions

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

Returns the minimum required `https://developer.android.com/reference/kotlin/androidx/ink/brush/Version` for this `https://developer.android.com/reference/kotlin/androidx/ink/brush/behavior/Node`.
Cmn

### Inherited properties

From [androidx.ink.brush.behavior.Node](https://developer.android.com/reference/kotlin/androidx/ink/brush/behavior/Node) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/ink/brush/behavior/ValueNode>` `https://developer.android.com/reference/kotlin/androidx/ink/brush/behavior/Node#inputs()`

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

## Public constructors

### DampingNode

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

```
DampingNode(dampOver: ProgressDomain, strength: Float, input: ValueNode)
```

Creates a `https://developer.android.com/reference/kotlin/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/kotlin/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/kotlin/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/kotlin/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/kotlin/androidx/ink/brush/behavior/ProgressDomain#TIME_IN_SECONDS()` and `https://developer.android.com/reference/kotlin/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/kotlin/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/kotlin/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/kotlin/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/kotlin/androidx/ink/brush/behavior/DampingNode#(androidx.ink.brush.behavior.ProgressDomain,kotlin.Float,androidx.ink.brush.behavior.ValueNode)` is `https://developer.android.com/reference/kotlin/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 |
|---|---|
| `dampOver: https://developer.android.com/reference/kotlin/androidx/ink/brush/behavior/ProgressDomain` | The domain units over which damping is applied. |
| `strength: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The amount of damping to apply, measured in `https://developer.android.com/reference/kotlin/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). |
| `input: https://developer.android.com/reference/kotlin/androidx/ink/brush/behavior/ValueNode` | The input node that produces the value to be modified by the damping. |

## Public functions

### equals

Cmn

```
open operator fun equals(other: Any?): Boolean
```

### hashCode

Cmn

```
open fun hashCode(): Int
```

### toString

Cmn

```
open fun toString(): String
```

## Public properties

### dampOver

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

```
val dampOver: ProgressDomain
```

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

### input

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

```
val input: ValueNode
```

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

### strength

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

```
val strength: Float
```

The strength of the damping to apply, measured in `https://developer.android.com/reference/kotlin/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/kotlin/androidx/ink/brush/behavior/DampingNode#strength()` value by hand.