@woosh/meep-engine
Version:
Pure JavaScript game engine. Fully featured and production ready.
62 lines (53 loc) • 1.47 kB
JavaScript
import { combine_hash } from "../../../../../../../core/collection/array/combine_hash.js";
import { computeHashFloat } from "../../../../../../../core/primitives/numbers/computeHashFloat.js";
import { computeStringHash } from "../../../../../../../core/primitives/strings/computeStringHash.js";
export class AnimationTransitionDefinition {
constructor() {
/**
*
* @type {string}
*/
this.event = "";
/**
*
* @type {number}
*/
this.duration = 0.2;
/**
*
* @type {AnimationStateDefinition}
*/
this.source = null;
/**
*
* @type {AnimationStateDefinition}
*/
this.target = null;
}
/**
*
* @param {AnimationTransitionDefinition} other
* @returns {boolean}
*/
equals(other) {
if (this === other) {
return true;
}
return this.event === other.event
&& this.duration === other.duration
&& this.source.equals(other.source)
&& this.target.equals(other.target)
;
}
/**
* @returns {number}
*/
hash() {
return combine_hash(
computeStringHash(this.event),
computeHashFloat(this.duration),
this.source.hash(),
this.target.hash()
);
}
}