対象のSpriteもしくはShapeオブジェクトに残像エフェクトを付与します。(ただしShapeは不完全)
残像にfilterをかけることもできます。
残像にfilterをかけることもできます。
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
optional
|
||||||||||||||||||||||||
filterFunc |
function | optional 残像にかけるフィルター関数:cross-originによるエラーに注意 |
Example
const player = phina.display.Sprite('player').addChildTo(this);
const filterFunc = (pixel, i, x, y, imageData)=> {
if (pixel[3] === 0) return; // pixel[3]はalpha値、0の場合は透明ピクセルなので無視
imageData.data[i] *= 0.2; // r
imageData.data[i + 1] *= 0; // g
imageData.data[i + 2] *= 0.8; // b
}
phina.accessory.AfterImage({
interval: 8
}, filterFunc)
.attachTo(player);
Extends
- phina.accessory.Accessory
Methods
-
Shapeをcanvasに変換
Name Type Description shape
phina.display.Shape Returns:
Type Description phina.asset.Texture -
残像用Spriteをプール
Returns:
Type Description phina.display.Sprite 生成したSpriteクラス -
add pool-releasing process to original remove method
Returns:
Type Description void -
表示フラグを変更
Name Type Description flag
boolean Returns:
Type Description this