mirror of
https://github.com/tengge1/ShadowEditor.git
synced 2026-01-18 15:02:09 +00:00
播放器粒子动画。
This commit is contained in:
parent
dfb989496b
commit
f340432c19
31
ShadowEditor.Web/src/player/animator/ParticleAnimator.js
Normal file
31
ShadowEditor.Web/src/player/animator/ParticleAnimator.js
Normal file
@ -0,0 +1,31 @@
|
||||
import PlayerComponent from '../component/PlayerComponent';
|
||||
import Ease from '../../animation/Ease';
|
||||
|
||||
/**
|
||||
* 粒子动画控制器
|
||||
* @param {*} app 应用
|
||||
*/
|
||||
function ParticleAnimator(app) {
|
||||
PlayerComponent.call(this, app);
|
||||
}
|
||||
|
||||
ParticleAnimator.prototype = Object.create(PlayerComponent.prototype);
|
||||
ParticleAnimator.prototype.constructor = ParticleAnimator;
|
||||
|
||||
ParticleAnimator.prototype.create = function (scene, camera, renderer) {
|
||||
this.scene = scene;
|
||||
};
|
||||
|
||||
ParticleAnimator.prototype.update = function (clock, deltaTime, time) {
|
||||
this.scene.children.forEach(n => {
|
||||
if (n.userData.type === 'ParticleEmitter') {
|
||||
n.userData.group.tick(deltaTime);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
ParticleAnimator.prototype.dispose = function () {
|
||||
this.scene = null;
|
||||
};
|
||||
|
||||
export default ParticleAnimator;
|
||||
@ -3,6 +3,7 @@ import Ease from '../../animation/Ease';
|
||||
|
||||
import TweenAnimator from '../animator/TweenAnimator';
|
||||
import MMDAnimator from '../animator/MMDAnimator';
|
||||
import ParticleAnimator from '../animator/ParticleAnimator';
|
||||
|
||||
/**
|
||||
* 播放器动画
|
||||
@ -17,7 +18,8 @@ function PlayerAnimation(app) {
|
||||
|
||||
this.animators = [
|
||||
new TweenAnimator(this.app),
|
||||
new MMDAnimator(this.app)
|
||||
new MMDAnimator(this.app),
|
||||
new ParticleAnimator(this.app)
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user