# playcanvas-movetowards

> Functions and PlayCanvas extensions to move a number, a vector or a quaternion towards a target value over frames

Latest version **1.0.0** (published 2017-09-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install playcanvas-movetowards
pnpm add playcanvas-movetowards
yarn add playcanvas-movetowards
bun add playcanvas-movetowards
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-09-10 |
| First published | 2017-09-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Mike Talbot |
| Maintainers | whydoidoit |
| Keywords | PlayCanvas |

## Links

- npm: https://www.npmjs.com/package/playcanvas-movetowards
- Repository: https://github.com/whydoidoit/movetowards
- Homepage: https://github.com/whydoidoit/movetowards#readme
- Issues: https://github.com/whydoidoit/movetowards/issues
- npm.io page: https://npm.io/package/playcanvas-movetowards

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2017-09-10

## README

### Introduction

A series of movetowards implementations.  Move towards are linear functions that move
a value towards a target outcome with a maximum delta. Often this delta is the current
frame time of a game.

### Installation

```language-shell
npm intall --save playcanvas-movetowards
```

### Usage

```language-javascript
import moveTowards from 'playcanvas-movetowards'
import moveTowardsAngle from 'playcanvas-movetowards/angle'
import moveTowardsVector from 'playcanvas-movetowards/vector'


...

MyObject.prototype.update = function(dt) {

    this.value = moveTowards(this.value, this.targetValue, dt * this.speed);
    
    this.angle = moveTowardsAngle(this.angle, this.targetAngle, dt * 100);
    
    this.entity.setLocalPosition(moveTowardsVector(this.entity.getLocalPosition(),
        this.targetPosition, dt * this.speed));
    
}
 

```

### Requirements

Requires PlayCanvas Engine to be running on the page.  Uses ES6/Babel/PlayCanvas template.

---
_Source: https://npm.io/package/playcanvas-movetowards · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
