This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/doric-js/lib/src/ui/animation.d.ts

222 lines
5.9 KiB
TypeScript
Raw Normal View History

import { Color } from "../util/color";
2020-01-03 14:44:51 +08:00
import { Modeling, Model } from "../util/types";
export declare type AnimatedKey = "translationX" | "translationY" | "scaleX" | "scaleY" | "rotation" | "pivotX" | "pivotY" | "rotationX" | "rotationY" | "backgroundColor" | "alpha";
2020-01-03 14:44:51 +08:00
export declare enum RepeatMode {
RESTART = 1,
REVERSE = 2
}
export interface IAnimation extends Modeling {
duration: number;
delay?: number;
2021-04-21 18:59:29 +08:00
id: string;
2020-01-03 14:44:51 +08:00
}
export interface Changeable {
fromValue: number;
toValue: number;
key: AnimatedKey;
repeatCount?: number;
repeatMode?: RepeatMode;
2021-09-07 20:10:44 +08:00
keyFrames?: {
percent: number;
value: number;
}[];
2020-01-03 14:44:51 +08:00
}
export declare enum FillMode {
/**
* The receiver is removed from the presentation when the animation is completed.
*/
Removed = 0,
/**
* The receiver remains visible in its final state when the animation is completed.
*/
Forward = 1,
/**
* The receiver clamps values before zero to zero when the animation is completed.
*/
Backward = 2,
/**
* The receiver clamps values at both ends of the objects time space
*/
Both = 3
}
export declare enum TimingFunction {
/**
* The system default timing function. Use this function to ensure that the timing of your animations matches that of most system animations.
*/
Default = 0,
/**
* Linear pacing, which causes an animation to occur evenly over its duration.
*/
Linear = 1,
/**
* Ease-in pacing, which causes an animation to begin slowly and then speed up as it progresses.
*/
EaseIn = 2,
/**
* Ease-out pacing, which causes an animation to begin quickly and then slow as it progresses.
*/
EaseOut = 3,
/**
* Ease-in-ease-out pacing, which causes an animation to begin slowly, accelerate through the middle of its duration, and then slow again before completing.
*/
EaseInEaseOut = 4
}
declare abstract class Animation implements IAnimation {
changeables: Map<AnimatedKey, Changeable>;
duration: number;
repeatCount?: number;
repeatMode?: RepeatMode;
delay?: number;
fillMode: FillMode;
timingFunction?: TimingFunction;
2021-04-21 18:59:29 +08:00
id: string;
2020-01-03 14:44:51 +08:00
toModel(): {
type: string;
delay: number | undefined;
duration: number;
changeables: {
key: AnimatedKey;
fromValue: number;
toValue: number;
2021-09-07 20:10:44 +08:00
keyFrames: {
percent: number;
value: number;
}[] | undefined;
2020-01-03 14:44:51 +08:00
}[];
repeatCount: number | undefined;
repeatMode: RepeatMode | undefined;
fillMode: FillMode;
timingFunction: TimingFunction | undefined;
2021-04-21 18:59:29 +08:00
id: string;
2020-01-03 14:44:51 +08:00
};
}
export declare class ScaleAnimation extends Animation {
private scaleXChangeable;
private scaleYChangeable;
constructor();
2021-09-07 20:10:44 +08:00
set xKeyFrames(keyFrames: {
percent: number;
value: number;
}[]);
set yKeyFrames(keyFrames: {
percent: number;
value: number;
}[]);
2020-01-17 14:55:39 +08:00
set fromScaleX(v: number);
get fromScaleX(): number;
set toScaleX(v: number);
get toScaleX(): number;
set fromScaleY(v: number);
get fromScaleY(): number;
set toScaleY(v: number);
get toScaleY(): number;
2020-01-03 14:44:51 +08:00
}
export declare class TranslationAnimation extends Animation {
private translationXChangeable;
private translationYChangeable;
constructor();
2021-09-07 20:10:44 +08:00
set xKeyFrames(keyFrames: {
percent: number;
value: number;
}[]);
set yKeyFrames(keyFrames: {
percent: number;
value: number;
}[]);
2020-01-17 14:55:39 +08:00
set fromTranslationX(v: number);
get fromTranslationX(): number;
set toTranslationX(v: number);
get toTranslationX(): number;
set fromTranslationY(v: number);
get fromTranslationY(): number;
set toTranslationY(v: number);
get toTranslationY(): number;
2020-01-03 14:44:51 +08:00
}
/**
* Rotation range is [0..2]
*/
2020-01-03 14:44:51 +08:00
export declare class RotationAnimation extends Animation {
private rotationChaneable;
constructor();
2020-01-17 14:55:39 +08:00
set fromRotation(v: number);
get fromRotation(): number;
set toRotation(v: number);
get toRotation(): number;
2021-09-07 20:10:44 +08:00
set keyFrames(keyFrames: {
percent: number;
value: number;
}[]);
2020-01-03 14:44:51 +08:00
}
/**
* Rotation range is [0..2]
*/
export declare class RotationXAnimation extends Animation {
private rotationChaneable;
constructor();
set fromRotation(v: number);
get fromRotation(): number;
set toRotation(v: number);
get toRotation(): number;
2021-09-07 20:10:44 +08:00
set keyFrames(keyFrames: {
percent: number;
value: number;
}[]);
}
/**
* Rotation range is [0..2]
*/
export declare class RotationYAnimation extends Animation {
private rotationChaneable;
constructor();
set fromRotation(v: number);
get fromRotation(): number;
set toRotation(v: number);
get toRotation(): number;
2021-09-07 20:10:44 +08:00
set keyFrames(keyFrames: {
percent: number;
value: number;
}[]);
}
export declare class BackgroundColorAnimation extends Animation {
private backgroundColorChangeable;
constructor();
set fromColor(color: Color);
get fromColor(): Color;
set toColor(v: Color);
get toColor(): Color;
2021-09-07 20:10:44 +08:00
set keyFrames(keyFrames: {
percent: number;
value: Color;
}[]);
}
/**
* Alpha range is [0..1]
*/
export declare class AlphaAnimation extends Animation {
private opacityChangeable;
constructor();
set from(v: number);
get from(): number;
set to(v: number);
get to(): number;
2021-09-07 20:10:44 +08:00
set keyFrames(keyFrames: {
percent: number;
value: number;
}[]);
}
2020-01-03 14:44:51 +08:00
export declare class AnimationSet implements IAnimation {
private animations;
2020-04-15 10:31:22 +08:00
private _duration;
2020-01-03 14:44:51 +08:00
delay?: number;
2021-04-21 18:59:29 +08:00
id: string;
2020-01-03 14:44:51 +08:00
addAnimation(anim: IAnimation): void;
2020-01-17 14:55:39 +08:00
get duration(): number;
set duration(v: number);
2020-01-03 14:44:51 +08:00
toModel(): {
animations: Model;
delay: number | undefined;
2021-04-21 18:59:29 +08:00
id: string;
2020-01-03 14:44:51 +08:00
};
}
export {};