diff --git a/README.md b/README.md index f5d9f90..0e1b71e 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ ticker.maxUpdatesPerRender = 4; // set the default logic for opt-in/opt-out containers ticker.getDefaultInterpolation = ( container ): boolean => { - return container instanceof MyClass; + return !(container instanceof ParticleContainer); } ``` @@ -84,7 +84,7 @@ Containers are extended with a few optional properties to make it easy to config | Property | Description | | :----- | :------ | -| `interpolation` | Whether interpolation is explicitly enabled or disabled for this container. The default behavior for most containers is `true`, excluding `AnimatedSprite`, `Graphics`, `Mesh`, and `ParticleContainer`. | +| `interpolation` | Whether interpolation is explicitly enabled or disabled for this container. The default behavior for all containers is `true`. | | `interpolatedChildren` | An array of child containers to include in interpolation. When not set, `children` is used. | | `interpolationWraparound` | If set, position will smoothly wraparound the given ranges. | diff --git a/package.json b/package.json index e0686e3..8a0e3e9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pixijs-interpolated-ticker", - "version": "0.1.2", + "version": "0.1.3", "author": "Reece Como ", "authors": [ "Reece Como " diff --git a/src/InterpolatedTicker.ts b/src/InterpolatedTicker.ts index effee59..ac58de5 100644 --- a/src/InterpolatedTicker.ts +++ b/src/InterpolatedTicker.ts @@ -1,11 +1,4 @@ -import { - Application, - Container, - AnimatedSprite, - Graphics, - ParticleContainer, - Mesh -} from "pixi.js"; +import { Application, Container } from "pixi.js"; const _BUFFER_PROPERTIES = @@ -270,10 +263,7 @@ export class InterpolatedTicker */ public getDefaultInterpolation( container: InterpolatedContainer ): boolean { - return !(container instanceof AnimatedSprite - || container instanceof Graphics - || container instanceof ParticleContainer - || container instanceof Mesh); + return true; } // ----- protected methods: ----- @@ -339,7 +329,8 @@ export class InterpolatedTicker { if ( ! this.getDefaultInterpolation(container) ) { - container.interpolation = false; + container.interpolation = false; // skip check next time + return; } diff --git a/src/globals.d.ts b/src/globals.d.ts index 08333a9..7081e9c 100644 --- a/src/globals.d.ts +++ b/src/globals.d.ts @@ -12,8 +12,7 @@ declare module 'pixi.js' { * Set `getDefaultInterpolation( container )` on `InterpolatedTicker` to * modify the default behavior. * - * The default is true for all containers, excluding `PIXI.AnimatedSprite`, - * `PIXI.Graphics`, `PIXI.Mesh`, and `PIXI.ParticleContainer`. + * The default is true for all containers. */ interpolation?: boolean;