Add BackgroundColorAnimation and AlphaAnimation
This commit is contained in:
208
doric-web/dist/index.js
vendored
208
doric-web/dist/index.js
vendored
@@ -2705,6 +2705,80 @@ __decorate$b([
|
||||
__metadata$b("design:returntype", void 0)
|
||||
], Panel.prototype, "__enableSnapshot__", null);
|
||||
|
||||
/**
|
||||
* Store color as format AARRGGBB or RRGGBB
|
||||
*/
|
||||
class Color {
|
||||
constructor(v) {
|
||||
this._value = 0;
|
||||
this._value = v | 0x0;
|
||||
}
|
||||
static parse(str) {
|
||||
if (!str.startsWith("#")) {
|
||||
throw new Error(`Parse color error with ${str}`);
|
||||
}
|
||||
const val = parseInt(str.substr(1), 16);
|
||||
if (str.length === 7) {
|
||||
return new Color(val | 0xff000000);
|
||||
}
|
||||
else if (str.length === 9) {
|
||||
return new Color(val);
|
||||
}
|
||||
else {
|
||||
throw new Error(`Parse color error with ${str}`);
|
||||
}
|
||||
}
|
||||
static safeParse(str, defVal = Color.TRANSPARENT) {
|
||||
let color = defVal;
|
||||
try {
|
||||
color = Color.parse(str);
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
finally {
|
||||
return color;
|
||||
}
|
||||
}
|
||||
alpha(v) {
|
||||
v = v * 255;
|
||||
return new Color((this._value & 0xffffff) | ((v & 0xff) << 24));
|
||||
}
|
||||
toModel() {
|
||||
return this._value;
|
||||
}
|
||||
}
|
||||
Color.BLACK = new Color(0xFF000000);
|
||||
Color.DKGRAY = new Color(0xFF444444);
|
||||
Color.GRAY = new Color(0xFF888888);
|
||||
Color.LTGRAY = new Color(0xFFCCCCCC);
|
||||
Color.WHITE = new Color(0xFFFFFFFF);
|
||||
Color.RED = new Color(0xFFFF0000);
|
||||
Color.GREEN = new Color(0xFF00FF00);
|
||||
Color.BLUE = new Color(0xFF0000FF);
|
||||
Color.YELLOW = new Color(0xFFFFFF00);
|
||||
Color.CYAN = new Color(0xFF00FFFF);
|
||||
Color.MAGENTA = new Color(0xFFFF00FF);
|
||||
Color.TRANSPARENT = new Color(0);
|
||||
exports.GradientOrientation = void 0;
|
||||
(function (GradientOrientation) {
|
||||
/** draw the gradient from the top to the bottom */
|
||||
GradientOrientation[GradientOrientation["TOP_BOTTOM"] = 0] = "TOP_BOTTOM";
|
||||
/** draw the gradient from the top-right to the bottom-left */
|
||||
GradientOrientation[GradientOrientation["TR_BL"] = 1] = "TR_BL";
|
||||
/** draw the gradient from the right to the left */
|
||||
GradientOrientation[GradientOrientation["RIGHT_LEFT"] = 2] = "RIGHT_LEFT";
|
||||
/** draw the gradient from the bottom-right to the top-left */
|
||||
GradientOrientation[GradientOrientation["BR_TL"] = 3] = "BR_TL";
|
||||
/** draw the gradient from the bottom to the top */
|
||||
GradientOrientation[GradientOrientation["BOTTOM_TOP"] = 4] = "BOTTOM_TOP";
|
||||
/** draw the gradient from the bottom-left to the top-right */
|
||||
GradientOrientation[GradientOrientation["BL_TR"] = 5] = "BL_TR";
|
||||
/** draw the gradient from the left to the right */
|
||||
GradientOrientation[GradientOrientation["LEFT_RIGHT"] = 6] = "LEFT_RIGHT";
|
||||
/** draw the gradient from the top-left to the bottom-right */
|
||||
GradientOrientation[GradientOrientation["TL_BR"] = 7] = "TL_BR";
|
||||
})(exports.GradientOrientation || (exports.GradientOrientation = {}));
|
||||
|
||||
/*
|
||||
* Copyright [2019] [Doric.Pub]
|
||||
*
|
||||
@@ -2878,6 +2952,9 @@ class TranslationAnimation extends Animation {
|
||||
return this.translationYChangeable.toValue;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Rotation range is [0..2]
|
||||
*/
|
||||
class RotationAnimation extends Animation {
|
||||
constructor() {
|
||||
super();
|
||||
@@ -2901,6 +2978,9 @@ class RotationAnimation extends Animation {
|
||||
return this.rotationChaneable.toValue;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Rotation range is [0..2]
|
||||
*/
|
||||
class RotationXAnimation extends Animation {
|
||||
constructor() {
|
||||
super();
|
||||
@@ -2924,6 +3004,9 @@ class RotationXAnimation extends Animation {
|
||||
return this.rotationChaneable.toValue;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Rotation range is [0..2]
|
||||
*/
|
||||
class RotationYAnimation extends Animation {
|
||||
constructor() {
|
||||
super();
|
||||
@@ -2947,6 +3030,55 @@ class RotationYAnimation extends Animation {
|
||||
return this.rotationChaneable.toValue;
|
||||
}
|
||||
}
|
||||
class BackgroundColorAnimation extends Animation {
|
||||
constructor() {
|
||||
super();
|
||||
this.backgroundColorChangeable = {
|
||||
key: "backgroundColor",
|
||||
fromValue: Color.TRANSPARENT._value,
|
||||
toValue: Color.TRANSPARENT._value,
|
||||
};
|
||||
this.changeables.set("backgroundColor", this.backgroundColorChangeable);
|
||||
}
|
||||
set fromColor(color) {
|
||||
this.backgroundColorChangeable.fromValue = color._value;
|
||||
}
|
||||
get fromColor() {
|
||||
return new Color(this.backgroundColorChangeable.fromValue);
|
||||
}
|
||||
set toColor(v) {
|
||||
this.backgroundColorChangeable.toValue = v._value;
|
||||
}
|
||||
get toColor() {
|
||||
return new Color(this.backgroundColorChangeable.toValue);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Alpha range is [0..1]
|
||||
*/
|
||||
class AlphaAnimation extends Animation {
|
||||
constructor() {
|
||||
super();
|
||||
this.opacityChangeable = {
|
||||
key: "alpha",
|
||||
fromValue: 1,
|
||||
toValue: 1,
|
||||
};
|
||||
this.changeables.set("alpha", this.opacityChangeable);
|
||||
}
|
||||
set from(v) {
|
||||
this.opacityChangeable.fromValue = v;
|
||||
}
|
||||
get from() {
|
||||
return this.opacityChangeable.fromValue;
|
||||
}
|
||||
set to(v) {
|
||||
this.opacityChangeable.toValue = v;
|
||||
}
|
||||
get to() {
|
||||
return this.opacityChangeable.toValue;
|
||||
}
|
||||
}
|
||||
class AnimationSet {
|
||||
constructor() {
|
||||
this.animations = [];
|
||||
@@ -3058,80 +3190,6 @@ function text(config) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Store color as format AARRGGBB or RRGGBB
|
||||
*/
|
||||
class Color {
|
||||
constructor(v) {
|
||||
this._value = 0;
|
||||
this._value = v | 0x0;
|
||||
}
|
||||
static parse(str) {
|
||||
if (!str.startsWith("#")) {
|
||||
throw new Error(`Parse color error with ${str}`);
|
||||
}
|
||||
const val = parseInt(str.substr(1), 16);
|
||||
if (str.length === 7) {
|
||||
return new Color(val | 0xff000000);
|
||||
}
|
||||
else if (str.length === 9) {
|
||||
return new Color(val);
|
||||
}
|
||||
else {
|
||||
throw new Error(`Parse color error with ${str}`);
|
||||
}
|
||||
}
|
||||
static safeParse(str, defVal = Color.TRANSPARENT) {
|
||||
let color = defVal;
|
||||
try {
|
||||
color = Color.parse(str);
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
finally {
|
||||
return color;
|
||||
}
|
||||
}
|
||||
alpha(v) {
|
||||
v = v * 255;
|
||||
return new Color((this._value & 0xffffff) | ((v & 0xff) << 24));
|
||||
}
|
||||
toModel() {
|
||||
return this._value;
|
||||
}
|
||||
}
|
||||
Color.BLACK = new Color(0xFF000000);
|
||||
Color.DKGRAY = new Color(0xFF444444);
|
||||
Color.GRAY = new Color(0xFF888888);
|
||||
Color.LTGRAY = new Color(0xFFCCCCCC);
|
||||
Color.WHITE = new Color(0xFFFFFFFF);
|
||||
Color.RED = new Color(0xFFFF0000);
|
||||
Color.GREEN = new Color(0xFF00FF00);
|
||||
Color.BLUE = new Color(0xFF0000FF);
|
||||
Color.YELLOW = new Color(0xFFFFFF00);
|
||||
Color.CYAN = new Color(0xFF00FFFF);
|
||||
Color.MAGENTA = new Color(0xFFFF00FF);
|
||||
Color.TRANSPARENT = new Color(0);
|
||||
exports.GradientOrientation = void 0;
|
||||
(function (GradientOrientation) {
|
||||
/** draw the gradient from the top to the bottom */
|
||||
GradientOrientation[GradientOrientation["TOP_BOTTOM"] = 0] = "TOP_BOTTOM";
|
||||
/** draw the gradient from the top-right to the bottom-left */
|
||||
GradientOrientation[GradientOrientation["TR_BL"] = 1] = "TR_BL";
|
||||
/** draw the gradient from the right to the left */
|
||||
GradientOrientation[GradientOrientation["RIGHT_LEFT"] = 2] = "RIGHT_LEFT";
|
||||
/** draw the gradient from the bottom-right to the top-left */
|
||||
GradientOrientation[GradientOrientation["BR_TL"] = 3] = "BR_TL";
|
||||
/** draw the gradient from the bottom to the top */
|
||||
GradientOrientation[GradientOrientation["BOTTOM_TOP"] = 4] = "BOTTOM_TOP";
|
||||
/** draw the gradient from the bottom-left to the top-right */
|
||||
GradientOrientation[GradientOrientation["BL_TR"] = 5] = "BL_TR";
|
||||
/** draw the gradient from the left to the right */
|
||||
GradientOrientation[GradientOrientation["LEFT_RIGHT"] = 6] = "LEFT_RIGHT";
|
||||
/** draw the gradient from the top-left to the bottom-right */
|
||||
GradientOrientation[GradientOrientation["TL_BR"] = 7] = "TL_BR";
|
||||
})(exports.GradientOrientation || (exports.GradientOrientation = {}));
|
||||
|
||||
var __decorate$9 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
@@ -4713,8 +4771,10 @@ class ModularPanel extends Module {
|
||||
}
|
||||
}
|
||||
|
||||
exports.AlphaAnimation = AlphaAnimation;
|
||||
exports.AnimationSet = AnimationSet;
|
||||
exports.BOTTOM = BOTTOM;
|
||||
exports.BackgroundColorAnimation = BackgroundColorAnimation;
|
||||
exports.CENTER = CENTER;
|
||||
exports.CENTER_X = CENTER_X;
|
||||
exports.CENTER_Y = CENTER_Y;
|
||||
|
2
doric-web/dist/index.js.map
vendored
2
doric-web/dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user