# playcanvas-update-fn

> PlayCanvas extension to all a function to be called every update cycle until it returns `false`

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

## Install

```sh
npm install playcanvas-update-fn
pnpm add playcanvas-update-fn
yarn add playcanvas-update-fn
bun add playcanvas-update-fn
```

## 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 | ISC |
| 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-update-fn
- Repository: https://github.com/whydoidoit/update
- Homepage: https://github.com/whydoidoit/update#readme
- Issues: https://github.com/whydoidoit/update/issues
- npm.io page: https://npm.io/package/playcanvas-update-fn

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

Specifies a function to be called every game frame until it returns false.

### Installation

```language-shell
npm install --save playcanvas-update-fn
```

### Usage

```language-javascript
import update from 'playcanvas-update-fn'

...

let w = new pc.Vec3;

MyScript.prototype.moveTo = function(position) {
    let t = 0;
    this.startPosition.copy(this.entity.getPosition());
    //Call update until the movement is complete
    update(dt=>{
        t += dt;
        this.entity.setPosition(w.lerp(this.startPosition, position, t));
        return t < 1;
    });
} 
 

```

### Requirements

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

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