<div class='type'>Class</div>


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
value class Velocity internal constructor(private val packedValue: Long)
```


A two dimensional velocity in pixels per second.


## Properties

<div class='sourceset sourceset-common'>Common</div>


```kotlin
val x: Float
```


The horizontal component of the velocity in pixels per second.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val y: Float
```


The vertical component of the velocity in pixels per second.



## Functions



<h2 id="component1">component1</h2>

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


The horizontal component of the velocity in pixels per second.




<hr class="docs-overload-divider">


<h2 id="component2">component2</h2>

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


The vertical component of the velocity in pixels per second.




<hr class="docs-overload-divider">


<h2 id="copy-x-y">copy</h2>

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


Returns a copy of this `Velocity` instance optionally overriding the x or y parameter




<hr class="docs-overload-divider">


<h2 id="unaryminus">unaryMinus</h2>

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


Unary negation operator.

Returns a `Velocity` with the coordinates negated.

If the `Velocity` represents an arrow on a plane, this operator returns the same arrow but
pointing in the reverse direction.




<hr class="docs-overload-divider">


<h2 id="minus-other">minus</h2>

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


Binary subtraction operator.

Returns a `Velocity` whose `x` value is the left-hand-side operand's `x` minus the
right-hand-side operand's `x` and whose `y` value is the left-hand-side operand's `y` minus
the right-hand-side operand's `y`.




<hr class="docs-overload-divider">


<h2 id="plus-other">plus</h2>

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


Binary addition operator.

Returns a `Velocity` whose `x` value is the sum of the `x` values of the two operands, and
whose `y` value is the sum of the `y` values of the two operands.




<hr class="docs-overload-divider">


<h2 id="times-operand">times</h2>

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


Multiplication operator.

Returns a `Velocity` whose coordinates are those of the left-hand-side operand (a `Velocity`)
multiplied by the scalar right-hand-side operand (a `Float`).




<hr class="docs-overload-divider">


<h2 id="div-operand">div</h2>

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


Division operator.

Returns a `Velocity` whose coordinates are those of the left-hand-side operand (an
`Velocity`) divided by the scalar right-hand-side operand (a `Float`).




<hr class="docs-overload-divider">


<h2 id="rem-operand">rem</h2>

```kotlin
operator fun rem(operand: Float) =
        Velocity(
            packFloats(unpackFloat1(packedValue) % operand, unpackFloat2(packedValue) % operand)
        )
```


Modulo (remainder) operator.

Returns a `Velocity` whose coordinates are the remainder of dividing the coordinates of the
left-hand-side operand (a `Velocity`) by the scalar right-hand-side operand (a `Float`).


## Companion Object

#### Properties

<div class='sourceset sourceset-common'>Common</div>


```kotlin
val Zero = Velocity(0x0L)
```


An offset with zero magnitude.

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