narraleaf-react
Version:
A React visual novel player framework
97 lines (96 loc) • 4.9 kB
TypeScript
import { Actionable } from "../../action/actionable";
import { Transform } from "../../elements/transform/transform";
import { Chained, Proxied } from "../../action/chain";
import { LogicAction } from "../../action/logicAction";
import { EventfulDisplayable } from "../../../player/elements/displayable/type";
import type { TransformDefinitions } from "../../elements/transform/type";
export declare abstract class Displayable<StateData extends Record<string, any>, Self extends Displayable<any, any, any>, TransformType extends TransformDefinitions.Types = TransformDefinitions.Types> extends Actionable<StateData, Self> implements EventfulDisplayable {
/**
* Set Image Position
*
* @param position - The position of the image, expected {@link RawPosition} or {@link IPosition}
* @param duration - The duration of the position animation
* @param easing - The easing of the position animation
* @chainable
*/
pos(position: TransformDefinitions.ImageTransformProps["position"], duration?: number, easing?: TransformDefinitions.EasingDefinition): Proxied<Self, Chained<LogicAction.Actions>>;
/**
* Set the zoom of the current staging sequence.
* @param zoom - The zoom of the transform. use `1` to keep the original size
*/
zoom(zoom: number, duration?: number, easing?: TransformDefinitions.EasingDefinition): Proxied<Self, Chained<LogicAction.Actions>>;
/**
* Set the scale of the current staging sequence on x axis.
* @param scaleX - The scale of the transform on x axis.
*/
scaleX(scaleX: number, duration?: number, easing?: TransformDefinitions.EasingDefinition): Proxied<Self, Chained<LogicAction.Actions>>;
/**
* Set the scale of the current staging sequence on y axis.
* @param scaleY - The scale of the transform on y axis.
*/
scaleY(scaleY: number, duration?: number, easing?: TransformDefinitions.EasingDefinition): Proxied<Self, Chained<LogicAction.Actions>>;
/**
* Set the scale of the current staging sequence.
* @param scaleX - The scale of the transform on x axis. use negative value to invert the scale
* @param scaleY - The scale of the transform on y axis. use negative value to invert the scale
*/
scale(scaleX: number, scaleY: number, duration?: number, easing?: TransformDefinitions.EasingDefinition): Proxied<Self, Chained<LogicAction.Actions>>;
/**
* Set the scale of the current staging sequence on x and y axis.
* @param scaleX - The scale of the transform on x axis. use negative value to invert the scale
* @param scaleY - The scale of the transform on y axis. use negative value to invert the scale
* @alias {@link Displayable.scale}
*/
scaleXY(scaleX: number, scaleY: number, duration?: number, easing?: TransformDefinitions.EasingDefinition): Proxied<Self, Chained<LogicAction.Actions>>;
/**
* Set Image Rotation
* @param rotation - The rotation of the image, in degrees
* @param duration - The duration of the rotation animation
* @param easing - The easing of the rotation animation
* @chainable
*/
rotate(rotation: number, duration?: number, easing?: TransformDefinitions.EasingDefinition): Proxied<Self, Chained<LogicAction.Actions>>;
/**
* Set Image Opacity
* @param opacity - The opacity of the image, between 0 and 1
* @param duration - The duration of the opacity animation
* @param easing - The easing of the opacity animation
* @chainable
*/
opacity(opacity: number, duration?: number, easing?: TransformDefinitions.EasingDefinition): Proxied<Self, Chained<LogicAction.Actions>>;
/**
* Apply a transform to the Displayable
* @chainable
*/
transform(transform: Transform<TransformType>): Proxied<Self, Chained<LogicAction.Actions, Self>>;
/**
* Show the Displayable
*
* if options are provided, the displayable will show with the provided transform options
* @example
* ```ts
* text.show({
* duration: 1000,
* });
* ```
* @chainable
*/
show(): Proxied<Self, Chained<LogicAction.Actions>>;
show(options: Transform<TransformType>): Proxied<Self, Chained<LogicAction.Actions>>;
show(options: Partial<TransformDefinitions.CommonTransformProps>): Proxied<Self, Chained<LogicAction.Actions>>;
/**
* Hide the Displayable
*
* if options are provided, the displayable will hide with the provided transform options
* @example
* ```ts
* text.hide({
* duration: 1000,
* });
* ```
* @chainable
*/
hide(): Proxied<Self, Chained<LogicAction.Actions>>;
hide(options: Transform<TransformType>): Proxied<Self, Chained<LogicAction.Actions>>;
hide(options: Partial<TransformDefinitions.CommonTransformProps>): Proxied<Self, Chained<LogicAction.Actions>>;
}