# Velocity

Artifact: [androidx.compose.ui:ui-unit](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/unit/Velocity.kt+class:androidx.compose.ui.unit.Velocity) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0) Common/AllAndroid/JVM
- Cmn

  ```
  value class Velocity
  ```

*** ** * ** ***

A two dimensional velocity in pixels per second.

## Summary

| ### Public companion properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity#Zero()` An offset with zero magnitude. | Cmn |

| ### Public functions |
|---|---|---|
| `inline operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity#component1()()` The horizontal component of the velocity in pixels per second. | Cmn |
| `inline operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity#component2()()` The vertical component of the velocity in pixels per second. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity#copy(kotlin.Float,kotlin.Float)(x: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, y: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Returns a copy of this `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity` instance optionally overriding the x or y parameter | Cmn |
| `operator https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity#div(kotlin.Float)(operand: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Division operator. | Cmn |
| `operator https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity#minus(androidx.compose.ui.unit.Velocity)(other: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity)` Binary subtraction operator. | Cmn |
| `operator https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity#plus(androidx.compose.ui.unit.Velocity)(other: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity)` Binary addition operator. | Cmn |
| `operator https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity#rem(kotlin.Float)(operand: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Modulo (remainder) operator. | Cmn |
| `operator https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity#times(kotlin.Float)(operand: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Multiplication operator. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity#toString()()` | Cmn |
| `operator https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity#unaryMinus()()` Unary negation operator. | Cmn |

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity#x()` The horizontal component of the velocity in pixels per second. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity#y()` The vertical component of the velocity in pixels per second. | Cmn |

## Public companion properties

### Zero

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val Zero: Velocity
```

An offset with zero magnitude.

This can be used to represent the origin of a coordinate space.

## Public functions

### component1

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

```
inline operator fun component1(): Float
```

The horizontal component of the velocity in pixels per second.

### component2

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

```
inline operator fun component2(): Float
```

The vertical component of the velocity in pixels per second.

### copy

Cmn Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.2.0)

```
fun copy(
    x: Float = unpackFloat1(packedValue),
    y: Float = unpackFloat2(packedValue)
): Velocity
```

Returns a copy of this `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity` instance optionally overriding the x or y parameter

### div

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

```
operator fun div(operand: Float): Velocity
```

Division operator.

Returns a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity` whose coordinates are those of the left-hand-side operand (an `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity`) divided by the scalar right-hand-side operand (a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html`).

### minus

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.10.0)

```
operator fun minus(other: Velocity): Velocity
```

Binary subtraction operator.

Returns a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity` whose `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity#x()` value is the left-hand-side operand's `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity#x()` minus the right-hand-side operand's `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity#x()` and whose `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity#y()` value is the left-hand-side operand's `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity#y()` minus the right-hand-side operand's `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity#y()`.

### plus

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.10.0)

```
operator fun plus(other: Velocity): Velocity
```

Binary addition operator.

Returns a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity` whose `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity#x()` value is the sum of the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity#x()` values of the two operands, and whose `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity#y()` value is the sum of the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity#y()` values of the two operands.

### rem

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

```
operator fun rem(operand: Float): Velocity
```

Modulo (remainder) operator.

Returns a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity` whose coordinates are the remainder of dividing the coordinates of the left-hand-side operand (a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity`) by the scalar right-hand-side operand (a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html`).

### times

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

```
operator fun times(operand: Float): Velocity
```

Multiplication operator.

Returns a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity` whose coordinates are those of the left-hand-side operand (a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity`) multiplied by the scalar right-hand-side operand (a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html`).

### toString

Cmn

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

### unaryMinus

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

```
operator fun unaryMinus(): Velocity
```

Unary negation operator.

Returns a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity` with the coordinates negated.

If the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Velocity` represents an arrow on a plane, this operator returns the same arrow but pointing in the reverse direction.

## Public properties

### x

Cmn Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.2.0)

```
val x: Float
```

The horizontal component of the velocity in pixels per second.

### y

Cmn Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.2.0)

```
val y: Float
```

The vertical component of the velocity in pixels per second.