0.10.0 • Published 17 days ago

@masatomakino/pixijs-basic-scrollbar v0.10.0

Weekly downloads
-
License
MIT
Repository
-
Last release
17 days ago

pixijs-basic-scrollbar

Scrollbar modules for pixi.js

MIT License CI Test Coverage Maintainability

ReadMe Card

Demo

Demo Page

Getting Started

Install

npm install @masatomakino/pixijs-basic-scrollbar --save-dev

pixijs-basic-scrollbar depend on pixi.js and @tweenjs/tween.js

Import

pixijs-basic-scrollbar is composed of ES6 modules and TypeScript d.ts files.

At first, import classes.

import { SliderView } from "@masatomakino/pixijs-basic-scrollbar";

Add to stage

const slider = new SliderView({
  base: new Graphics(...),
  bar: new Graphics(...),
  button: new Graphics(...),
  mask: new Graphics(...),
  minPosition: 0,
  maxPosition: 320, //slider width
  rate: 0.0,
  canvas : app.canvas // Option : global drag on canvas element
});

slider.on("slider_change", e => {
  console.log(e.rate);
});
stage.addChild(slider);

API documents

Option : Scroll bar and Tween

Tween.js needs update in rendering loop.

PIXI.Ticker.shared.add((e) => {
  TWEEN.update(performance.now());
});

Option : global drag on canvas element

Since v7, pixi.js does not get pointer events where nothing is drawn. Give a canvas element as an argument so that dragging continues outside the slider.

const slider = new SliderView(
  ...,
  canvas: app.canvas
});
0.10.0

17 days ago

0.9.2

1 month ago

0.9.1

2 months ago

0.9.0

2 months ago

0.8.4

3 months ago

0.8.3

4 months ago

0.8.2

4 months ago

0.8.1

8 months ago

0.8.0

8 months ago

0.7.1

9 months ago

0.7.0

10 months ago

0.6.3

11 months ago

0.6.2

1 year ago

0.6.4

11 months ago

0.5.0

1 year ago

0.6.1

1 year ago

0.6.0

1 year ago

0.4.1

1 year ago

0.4.0

1 year ago

0.3.1

2 years ago