v0.4.0-beta.2
Pre-releaseBreaking changes
ESM bundles and conditional exports
Pixi v6 introduces conditional exports that resolves import * as PIXI from 'pixi.js'
and const PIXI = require('pixi.js')
to different modules. However this plugin only provided CommonJS bundles, which internally uses require
to load Pixi, so if you're using import
to load Pixi in your app, you'll most likely be facing a dual package hazard.
To solve this, this plugin now provides ESM bundles and conditional exports as well. Note that it doesn't prevent you from the dual package hazard, but allows you to import
it together with Pixi.
So, in your entire app, either import
them both...
import * as PIXI from 'pixi.js';
import { Live2DModel } from 'pixi-live2d-display';
or require
them both:
const PIXI = require('pixi.js');
const { Live2DModel } = require('pixi-live2d-display');
Previously, the doc said that you should write the following code to ensure execution order:
import * as PIXI from 'pixi.js';
window.PIXI = PIXI;
const { Live2DModel } = require('pixi-live2d-display');
const model = await Live2DModel.from(url);
Now it's no longer required, because the window.PIXI.Ticker
detection will be deferred until the model has been created. So you can safely import
them both:
import * as PIXI from 'pixi.js';
import { Live2DModel } from 'pixi-live2d-display';
window.PIXI = PIXI;
const model = await Live2DModel.from(url);
In addition, the cubism2/4 submodules should now be imported from different paths:
// before
import { Live2DModel } from 'pixi-live2d-display/lib/cubism2';
// now
import { Live2DModel } from 'pixi-live2d-display/cubism2';
HitAreaFrames
is moved to individual bundle
HitAreaFrames
is no longer bundled into browser-oriented bundles, there's a new extra
bundle for it.
import { HitAreaFrames } from 'pixi-live2d-display/extra';
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/extra.min.js"></script>
Unconverted layout properties in Cubism 2 will be dropped
Previously in Cubism 2, for example, the layout definition { center_x: 0 }
would turn into { center_x: 0, centerX: 0 }
, leaving the unconverted property center_x
intact. That's unexpected. As of 0.4.0, unconverted properties will be dropped.
Preserve expression by default
Previously, if the model had an expression applied, it would be canceled when the model started to play a non-idle motion, so that the motion's parameters wouldn't be overridden by expression.
From my experience, this behavior is intuitive and generally expected by users. However, it doesn't align with Live2D Viewer and other official demos, so I decided to make it an opt-in.
You can get the old behavior by setting the config:
import { config } from 'pixi-live2d-display';
config.preserveExpressionOnMotion = false; // true by default
Other changes
- Removed lodash dependency
- Deferred
window.PIXI.Ticker
detection until model creation