|
|
|
@ -288,6 +288,89 @@ export class BabylonTool {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static AnimMoveCameraTargetAB( |
|
|
|
|
camera: ArcRotateCamera, |
|
|
|
|
allFrame: number, |
|
|
|
|
target: Vector3, |
|
|
|
|
radius: number, |
|
|
|
|
alpha: number, |
|
|
|
|
beta: number, |
|
|
|
|
) { |
|
|
|
|
//缓动动画
|
|
|
|
|
let easingFunction = new QuadraticEase(); |
|
|
|
|
easingFunction.setEasingMode(EasingFunction.EASINGMODE_EASEOUT); |
|
|
|
|
|
|
|
|
|
//target
|
|
|
|
|
let anim_target = new Animation( |
|
|
|
|
'CameraAnim_target', |
|
|
|
|
'target', |
|
|
|
|
60, |
|
|
|
|
Animation.ANIMATIONTYPE_VECTOR3, |
|
|
|
|
Animation.ANIMATIONLOOPMODE_CYCLE |
|
|
|
|
); |
|
|
|
|
let keys_target = [ |
|
|
|
|
{ frame: 0, value: camera.target }, |
|
|
|
|
{ frame: allFrame, value: target }, |
|
|
|
|
]; |
|
|
|
|
anim_target.setKeys(keys_target); |
|
|
|
|
anim_target.setEasingFunction(easingFunction); |
|
|
|
|
|
|
|
|
|
//radius
|
|
|
|
|
let anim_radius = new Animation( |
|
|
|
|
'CameraAnim_radius', |
|
|
|
|
'radius', |
|
|
|
|
60, |
|
|
|
|
Animation.ANIMATIONTYPE_FLOAT, |
|
|
|
|
Animation.ANIMATIONLOOPMODE_CYCLE |
|
|
|
|
); |
|
|
|
|
let keys_radius = [ |
|
|
|
|
{ frame: 0, value: camera.radius }, |
|
|
|
|
{ frame: allFrame, value: radius }, |
|
|
|
|
]; |
|
|
|
|
anim_radius.setKeys(keys_radius); |
|
|
|
|
anim_radius.setEasingFunction(easingFunction); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//beta
|
|
|
|
|
let anim_a = new Animation( |
|
|
|
|
'CameraAnim_a', |
|
|
|
|
'alpha', |
|
|
|
|
60, |
|
|
|
|
Animation.ANIMATIONTYPE_FLOAT, |
|
|
|
|
Animation.ANIMATIONLOOPMODE_CYCLE |
|
|
|
|
); |
|
|
|
|
let keys_a = [ |
|
|
|
|
{ frame: 0, value: camera.alpha }, |
|
|
|
|
{ frame: allFrame, value: alpha }, |
|
|
|
|
]; |
|
|
|
|
anim_a.setKeys(keys_a); |
|
|
|
|
|
|
|
|
|
//beta
|
|
|
|
|
let anim_b = new Animation( |
|
|
|
|
'CameraAnim_b', |
|
|
|
|
'beta', |
|
|
|
|
60, |
|
|
|
|
Animation.ANIMATIONTYPE_FLOAT, |
|
|
|
|
Animation.ANIMATIONLOOPMODE_CYCLE |
|
|
|
|
); |
|
|
|
|
let keys_b = [ |
|
|
|
|
{ frame: 0, value: camera.beta }, |
|
|
|
|
{ frame: allFrame, value: beta }, |
|
|
|
|
]; |
|
|
|
|
anim_b.setKeys(keys_b); |
|
|
|
|
|
|
|
|
|
camera.animations = []; |
|
|
|
|
camera.animations.push(anim_target); |
|
|
|
|
camera.animations.push(anim_radius); |
|
|
|
|
camera.animations.push(anim_a); |
|
|
|
|
camera.animations.push(anim_b); |
|
|
|
|
|
|
|
|
|
camera._scene.beginAnimation(camera, 0, allFrame, false); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//动画移动摄像机target
|
|
|
|
|
public static AnimMoveCameraTarget( |
|
|
|
|
camera: ArcRotateCamera, |
|
|
|
|