Skip to content

Commit

Permalink
Merge pull request #14 from GuoLei1990/Animator
Browse files Browse the repository at this point in the history
Animator
  • Loading branch information
luzhuang authored Jun 15, 2021
2 parents da1381f + cf35b57 commit 2a618d5
Show file tree
Hide file tree
Showing 6 changed files with 176 additions and 162 deletions.
32 changes: 32 additions & 0 deletions packages/core/src/animation/AnimationCureOwner.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Quaternion, Vector3 } from "@oasis-engine/math";
import { Component } from "../Component";
import { Entity } from "../Entity";
import { AnimationClipCurveData } from "./AnimationClipCurveData";
import { AnimationProperty } from "./enums/AnimationProperty";
import { InterpolableValue } from "./KeyFrame";

/**
* @internal
*/
export class AnimationCureOwner {
animationClopCurveData: AnimationClipCurveData<Component>;
target: Entity;
defaultValue: InterpolableValue;
fiexedPoseValue: InterpolableValue;
crossCurveMark: number = 0;
crossCurveIndex: number;

saveFixedPoseValue(): void {
switch (this.animationClopCurveData.property) {
case AnimationProperty.Position:
this.target.transform.position.cloneTo(<Vector3>this.fiexedPoseValue);
break;
case AnimationProperty.Rotation:
this.target.transform.rotationQuaternion.cloneTo(<Quaternion>this.fiexedPoseValue);
break;
case AnimationProperty.Scale:
this.target.transform.scale.cloneTo(<Vector3>this.fiexedPoseValue);
break;
}
}
}
Loading

0 comments on commit 2a618d5

Please sign in to comment.