# @zosma/three-lensflare-ts

> [DEPRECATED] three.js Lensflare from official package with extra scaling methods.

Latest version **0.108.0** (published 2019-08-14) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @zosma/three-lensflare-ts
pnpm add @zosma/three-lensflare-ts
yarn add @zosma/three-lensflare-ts
bun add @zosma/three-lensflare-ts
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.108.0 |
| Published | 2019-08-14 |
| First published | 2019-06-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 12.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | zosma |
| Maintainers | zosma |
| Keywords | three, three.js, Lensflare, ts, typescript |

## Links

- npm: https://www.npmjs.com/package/@zosma/three-lensflare-ts
- npm.io page: https://npm.io/package/@zosma/three-lensflare-ts

## Alternatives

- [csv-to-markdown-table](https://npm.io/package/csv-to-markdown-table.md) — 47.0K weekly downloads
- [@sapphire/ratelimits](https://npm.io/package/@sapphire/ratelimits.md) — 4.4K weekly downloads
- [js-csvparser](https://npm.io/package/js-csvparser.md) — 2.0K weekly downloads
- [@adadapted/js-sdk](https://npm.io/package/@adadapted/js-sdk.md) — 251 weekly downloads
- [@grapecity/spread-sheets-sparklines](https://npm.io/package/@grapecity/spread-sheets-sparklines.md) — 103 weekly downloads

## Recent versions

- 0.108.0 (latest) — 2019-08-14
- 0.107.0 — 2019-08-07
- 0.106.1 — 2019-07-11
- 0.106.0 — 2019-07-04
- 0.105.1 — 2019-07-03
- 0.105.0 — 2019-06-22

## README

# three.js Lensflare
![deprecated](https://img.shields.io/static/v1?label=status&message=deprecated&color=critical&style=flat-square)
![three.js version](https://img.shields.io/badge/three.js-v0.107.0-green.svg?style=flat-square)
![license](https://img.shields.io/npm/l/@zosma/three-lensflare-ts.svg?style=flat-square)


## ! Deprecated !
This package is deprecated. Since 2019, three.js provide all modules in the "jsm" folder with typescript support.
You can use the LensflareElement **size** property to scale the lensflare effect:
```javascript
import { Lensflare, LensflareElement } from 'three/examples/jsm/objects/Lensflare';

// ...

var baseSize = 512;
var lensflareElement = new LensflareElement( textureFlare0, baseSize, 0 );
lensflare.addElement( lensflareElement );

// ...

// Add in your animation loop (requestAnimationFrame) the following code.
// I resize only the first lensflareElement but you can resize all them if you desire.
var scale = 1; // Add here your scaling algorithm
lensflareElement.size = baseSize * scale;
```

---

## Installation
```
npm i @zosma/three-lensflare-ts
```

## Description
three.js's [Lensflare](https://threejs.org/docs/#examples/objects/Lensflare) from official package with extra scaling methods.

The extra scaling methods are:
- Lensflare.scaleElement(index, scale);
- Lensflare.scaleElements(scale);

With these methods you can resize the lensflare effect to handle the zoom of camera.


## Usage
```javascript
import { PointLight, TextureLoader } from 'three';
import { LensflareElement } from 'three/examples/jsm/objects/Lensflare';
import { Lensflare } from '@zosma/three-lensflare-ts';


var light = new PointLight( 0xffffff, 1.5, 2000 );

var textureLoader = new TextureLoader();

var textureFlare0 = textureLoader.load( "textures/lensflare/lensflare0.png" );
var textureFlare1 = textureLoader.load( "textures/lensflare/lensflare2.png" );
var textureFlare2 = textureLoader.load( "textures/lensflare/lensflare3.png" );

var lensflare = new Lensflare();

lensflare.addElement( new LensflareElement( textureFlare0, 512, 0 ) );
lensflare.addElement( new LensflareElement( textureFlare1, 512, 0 ) );
lensflare.addElement( new LensflareElement( textureFlare2, 60, 0.6 ) );

light.add( lensflare );

// ...

// Add in your animation loop (requestAnimationFrame) the following code
var scale = 1; // Add here your scaling algorithm
lensflare.scaleElements(scale);

```

The official documentation is available on the [three.js's website](https://threejs.org/docs/#examples/objects/Lensflare).

---
_Source: https://npm.io/package/@zosma/three-lensflare-ts · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
