-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
329 additions
and
208 deletions.
There are no files selected for viewing
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,51 @@ | ||
import ObjectGPU from "../core/ObjectGPU"; | ||
import Renderer from "../Renderer"; | ||
import AnimationChannel from "./AnimationChannel"; | ||
import Timer from "../Timer"; | ||
|
||
export default class Animation extends ObjectGPU | ||
{ | ||
private channels: Array<AnimationChannel>=[] ; | ||
private startTime :number=Number.MAX_VALUE; | ||
private stopTime :number=Number.MIN_VALUE; | ||
private time:number =0; | ||
private totalTime: number; | ||
constructor(renderer:Renderer,label:string) { | ||
super(renderer,label) | ||
|
||
} | ||
|
||
addChannel(channel: AnimationChannel) { | ||
this.stopTime = Math.min(channel.startTime,this.startTime) | ||
this.startTime = Math.max(channel.stopTime,this.stopTime) | ||
this.startTime = Math.min(channel.startTime,this.startTime) | ||
this.stopTime = Math.max(channel.stopTime,this.stopTime) | ||
this.channels.push(channel) | ||
|
||
} | ||
init(){ | ||
|
||
this.totalTime =this.stopTime-this.startTime; | ||
for(let c of this.channels) | ||
{ | ||
c.setToObj(); | ||
} | ||
} | ||
update() | ||
{ | ||
this.time +=Timer.delta; | ||
if(this.time>this.totalTime){ | ||
this.time-=this.totalTime; | ||
} | ||
let t = this.time+this.startTime; | ||
|
||
for(let c of this.channels) | ||
{ | ||
c.setTime(t); | ||
} | ||
} | ||
|
||
set() { | ||
for(let c of this.channels) | ||
{ | ||
c.setToObj() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
import Animation from "./Animation"; | ||
import UI from "../UI/UI"; | ||
export default class AnimationMixer{ | ||
private animations: Array<Animation>; | ||
private mixValue: number=0; | ||
private animation1:number=0; | ||
private animation2:number =1; | ||
constructor() { | ||
|
||
} | ||
setAnimations(animations:Array<Animation>){ | ||
this.animations =animations; | ||
} | ||
onUI(){ | ||
UI.pushWindow("Animation") | ||
//this.mixValue =UI.LFloatSlider("mix",this.mixValue,0,1); | ||
UI.popWindow() | ||
} | ||
update(){ | ||
let anime1 = this.animations[this.animation1] | ||
let anime2 = this.animations[this.animation2] | ||
|
||
if(this.mixValue<0.01){ | ||
anime1.update() | ||
|
||
anime1.set(); | ||
|
||
} else if(this.mixValue>0.99){ | ||
anime2.update() | ||
anime2.set(); | ||
|
||
}else{ | ||
anime1.update() | ||
anime2.update() | ||
|
||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters