新增windTransition例子
This commit is contained in:
@@ -85,7 +85,7 @@ module es {
|
||||
public onDeactive() {
|
||||
}
|
||||
|
||||
public async begin() {
|
||||
public begin() {
|
||||
if (this._renderers.length == 0) {
|
||||
this.addRenderer(new DefaultRenderer());
|
||||
console.warn("场景开始时没有渲染器 自动添加DefaultRenderer以保证能够正常渲染");
|
||||
|
||||
@@ -14,6 +14,9 @@ module es {
|
||||
}
|
||||
|
||||
public async onBeginTransition() {
|
||||
if (!this._mask.parent)
|
||||
Core.scene.stage.addChild(this._mask);
|
||||
|
||||
this._mask.graphics.beginFill(this.fadeToColor, 1);
|
||||
this._mask.graphics.drawRect(0, 0, Core.graphicsDevice.viewport.width, Core.graphicsDevice.viewport.height);
|
||||
this._mask.graphics.endFill();
|
||||
@@ -28,6 +31,13 @@ module es {
|
||||
});
|
||||
}
|
||||
|
||||
protected transitionComplete(){
|
||||
super.transitionComplete();
|
||||
|
||||
if (this._mask.parent)
|
||||
this._mask.parent.removeChild(this._mask);
|
||||
}
|
||||
|
||||
public render() {
|
||||
this._mask.graphics.clear();
|
||||
this._mask.graphics.beginFill(this.fadeToColor, this._alpha);
|
||||
|
||||
@@ -48,6 +48,7 @@ module es {
|
||||
this._mask.graphics.drawRect(0, 0, Core.graphicsDevice.viewport.width, Core.graphicsDevice.viewport.height);
|
||||
this._mask.graphics.endFill();
|
||||
this._mask.filters = [this._windEffect];
|
||||
Core.scene.stage.addChild(this._mask);
|
||||
}
|
||||
|
||||
public set windSegments(value: number) {
|
||||
@@ -63,5 +64,12 @@ module es {
|
||||
await this.tickEffectProgressProperty(this._windEffect, this.duration, this.easeType);
|
||||
this.transitionComplete();
|
||||
}
|
||||
|
||||
protected transitionComplete() {
|
||||
super.transitionComplete();
|
||||
|
||||
if (this._mask.parent)
|
||||
this._mask.parent.removeChild(this._mask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user