Animation add keyFrame

This commit is contained in:
pengfei.zhou
2021-09-07 20:10:44 +08:00
committed by osborn
parent d7d19b17d0
commit 41e610e424
12 changed files with 443 additions and 69 deletions

View File

@@ -2855,6 +2855,7 @@ class Animation {
key: e.key,
fromValue: e.fromValue,
toValue: e.toValue,
keyFrames: e.keyFrames,
});
}
return {
@@ -2886,6 +2887,12 @@ class ScaleAnimation extends Animation {
this.changeables.set("scaleX", this.scaleXChangeable);
this.changeables.set("scaleY", this.scaleYChangeable);
}
set xKeyFrames(keyFrames) {
this.scaleXChangeable.keyFrames = keyFrames;
}
set yKeyFrames(keyFrames) {
this.scaleYChangeable.keyFrames = keyFrames;
}
set fromScaleX(v) {
this.scaleXChangeable.fromValue = v;
}
@@ -2927,6 +2934,12 @@ class TranslationAnimation extends Animation {
this.changeables.set("translationX", this.translationXChangeable);
this.changeables.set("translationY", this.translationYChangeable);
}
set xKeyFrames(keyFrames) {
this.translationXChangeable.keyFrames = keyFrames;
}
set yKeyFrames(keyFrames) {
this.translationYChangeable.keyFrames = keyFrames;
}
set fromTranslationX(v) {
this.translationXChangeable.fromValue = v;
}
@@ -2977,6 +2990,9 @@ class RotationAnimation extends Animation {
get toRotation() {
return this.rotationChaneable.toValue;
}
set keyFrames(keyFrames) {
this.rotationChaneable.keyFrames = keyFrames;
}
}
/**
* Rotation range is [0..2]
@@ -3003,6 +3019,9 @@ class RotationXAnimation extends Animation {
get toRotation() {
return this.rotationChaneable.toValue;
}
set keyFrames(keyFrames) {
this.rotationChaneable.keyFrames = keyFrames;
}
}
/**
* Rotation range is [0..2]
@@ -3029,6 +3048,9 @@ class RotationYAnimation extends Animation {
get toRotation() {
return this.rotationChaneable.toValue;
}
set keyFrames(keyFrames) {
this.rotationChaneable.keyFrames = keyFrames;
}
}
class BackgroundColorAnimation extends Animation {
constructor() {
@@ -3052,6 +3074,9 @@ class BackgroundColorAnimation extends Animation {
get toColor() {
return new Color(this.backgroundColorChangeable.toValue);
}
set keyFrames(keyFrames) {
this.backgroundColorChangeable.keyFrames = keyFrames.map(e => { return { percent: e.percent, value: e.value.toModel() }; });
}
}
/**
* Alpha range is [0..1]
@@ -3078,6 +3103,9 @@ class AlphaAnimation extends Animation {
get to() {
return this.opacityChangeable.toValue;
}
set keyFrames(keyFrames) {
this.opacityChangeable.keyFrames = keyFrames;
}
}
class AnimationSet {
constructor() {

File diff suppressed because one or more lines are too long