UNPKG

@flashport/flashport

Version:

FlashPort is a TypeScript 2D graphics library that largely replicates the Flash ActionScript 3.0 library

272 lines (271 loc) 12.3 kB
/** * Tweener * Transition controller for movieclips, sounds, textfields and other objects * * @author Zeh Fernando, Nate Chatellier, Arthur Debert, Francis Turmel * @version 1.33.74 */ export declare class Tweener { private static _mainTimeline; private static __tweener_controller__; private static _engineExists; private static _inited; private static _currentTime; private static _currentTimeFrame; private static _tweenList; private static _timeScale; private static _transitionList; private static _specialPropertyList; private static _specialPropertyModifierList; private static _specialPropertySplitterList; static autoOverwrite: boolean; /** * There's no constructor. * @private */ constructor(); /** * Adds a new tweening. * * @param (first-n param) Object Object that should be tweened: a movieclip, textfield, etc.. OR an array of objects * @param (last param) Object Object containing the specified parameters in any order, as well as the properties that should be tweened and their values * @param .time Number Time in seconds or frames for the tweening to take (defaults 2) * @param .delay Number Delay time (defaults 0) * @param .useFrames Boolean Whether to use frames instead of seconds for time control (defaults false) * @param .transition String/Function Type of transition equation... (defaults to "easeoutexpo") * @param .onStart Function * Direct property, See the TweenListObj class * @param .onUpdate Function * Direct property, See the TweenListObj class * @param .onComplete Function * Direct property, See the TweenListObj class * @param .onOverwrite Function * Direct property, See the TweenListObj class * @param .onStartParams Array * Direct property, See the TweenListObj class * @param .onUpdateParams Array * Direct property, See the TweenListObj class * @param .onCompleteParams Array * Direct property, See the TweenListObj class * @param .onOverwriteParams Array * Direct property, See the TweenListObj class * @param .rounded Boolean * Direct property, See the TweenListObj class * @param .skipUpdates Number * Direct property, See the TweenListObj class * @return Boolean TRUE if the tween was successfully added, FALSE if otherwise */ static addTween: (p_scopes?: any, p_parameters?: any) => boolean; /** * Adds a new caller tweening. * * @param (first-n param) Object that should be tweened: a movieclip, textfield, etc.. OR an array of objects * @param (last param) Object containing the specified parameters in any order, as well as the properties that should be tweened and their values * @param .time Number Time in seconds or frames for the tweening to take (defaults 2) * @param .delay Number Delay time (defaults 0) * @param .count Number Number of times this caller should be called * @param .transition String/Function Type of transition equation... (defaults to "easeoutexpo") * @param .onStart Function Event called when tween starts * @param .onUpdate Function Event called when tween updates * @param .onComplete Function Event called when tween ends * @param .waitFrames Boolean Whether to wait (or not) one frame for each call * @return <code>true</code> if the tween was successfully added, <code>false</code> if otherwise. */ static addCaller: (p_scopes?: any, p_parameters?: any) => boolean; /** * Remove an specified tweening of a specified object the tweening list, if it conflicts with the given time. * * @param p_scope Object List of objects affected * @param p_properties Object List of properties affected (PropertyInfoObj instances) * @param p_timeStart Number Time when the new tween starts * @param p_timeComplete Number Time when the new tween ends * @return Boolean Whether or not it actually deleted something */ static removeTweensByTime: (p_scope: any, p_properties: any, p_timeStart: number, p_timeComplete: number) => boolean; /** * Remove tweenings from a given object from the tweening list. * * @param p_tween Object Object that must have its tweens removed * @param (2nd-last params) Object Property(ies) that must be removed * @return Boolean Whether or not it successfully removed this tweening */ static removeTweens: (p_scope: any, ...args: any[]) => boolean; /** * Remove all tweenings from the engine. * * @return <code>true</code> if it successfully removed any tweening, <code>false</code> if otherwise. */ static removeAllTweens: () => boolean; /** * Pause tweenings for a given object. * * @param p_scope Object that must have its tweens paused * @param (2nd-last params) Property(ies) that must be paused * @return <code>true</code> if it successfully paused any tweening, <code>false</code> if otherwise. */ static pauseTweens: (p_scope: any, ...args: any[]) => boolean; /** * Pause all tweenings on the engine. * * @return <code>true</code> if it successfully paused any tweening, <code>false</code> if otherwise. * @see #resumeAllTweens() */ static pauseAllTweens: () => boolean; /** * Resume tweenings from a given object. * * @param p_scope Object Object that must have its tweens resumed * @param (2nd-last params) Object Property(ies) that must be resumed * @return Boolean Whether or not it successfully resumed something */ static resumeTweens: (p_scope: any, ...args: any[]) => boolean; /** * Resume all tweenings on the engine. * * @return <code>true</code> if it successfully resumed any tweening, <code>false</code> if otherwise. * @see #pauseAllTweens() */ static resumeAllTweens: () => boolean; /** * Do some generic action on specific tweenings (pause, resume, remove, more?) * * @param p_function Function Function to run on the tweenings that match * @param p_scope Object Object that must have its tweens affected by the function * @param p_properties Array Array of strings that must be affected * @return Boolean Whether or not it successfully affected something */ private static affectTweens; /** * Splits a tweening in two * * @param p_tween Number Object that must have its tweens split * @param p_properties Array Array of strings containing the list of properties that must be separated * @return Number The index number of the new tween */ static splitTweens: (p_tween: number, p_properties: any[]) => number; /** * Updates all existing tweenings. * * @return Boolean FALSE if no update was made because there's no tweening (even delayed ones) */ private static updateTweens; /** * Remove a specific tweening from the tweening list. * * @param p_tween Number Index of the tween to be removed on the tweenings list * @return Boolean Whether or not it successfully removed this tweening */ static removeTweenByIndex: (i: number, p_finalRemoval?: boolean) => boolean; /** * Pauses a specific tween. * * @param p_tween Number Index of the tween to be paused * @return Boolean Whether or not it successfully paused this tweening */ static pauseTweenByIndex: (p_tween: number) => boolean; /** * Resumes a specific tween. * * @param p_tween Number Index of the tween to be resumed * @return Boolean Whether or not it successfully resumed this tweening */ static resumeTweenByIndex: (p_tween: number) => boolean; /** * Updates a specific tween. * * @param i Number Index (from the tween list) of the tween that should be updated * @return Boolean FALSE if it's already finished and should be deleted, TRUE if otherwise */ private static updateTweenByIndex; /** * Initiates the Tweener--should only be ran once. */ static init: (...rest: any[]) => void; /** * Adds a new function to the available transition list "shortcuts". * * @param p_name String Shorthand transition name * @param p_function Function The proper equation function */ static registerTransition: (p_name: string, p_function: Function) => void; /** * Adds a new special property to the available special property list. * * @param p_name Name of the "special" property. * @param p_getFunction Function that gets the value. * @param p_setFunction Function that sets the value. */ static registerSpecialProperty: (p_name: string, p_getFunction: Function, p_setFunction: Function, p_parameters?: any[], p_preProcessFunction?: Function) => void; /** * Adds a new special property modifier to the available modifier list. * * @param p_name Name of the "special" property modifier. * @param p_modifyFunction Function that modifies the value. * @param p_getFunction Function that gets the value. */ static registerSpecialPropertyModifier: (p_name: string, p_modifyFunction: Function, p_getFunction: Function) => void; /** * Adds a new special property splitter to the available splitter list. * * @param p_name Name of the "special" property splitter. * @param p_splitFunction Function that splits the value. */ static registerSpecialPropertySplitter: (p_name: string, p_splitFunction: Function, p_parameters?: any[]) => void; static setController(main: any): void; /** * Starts the Tweener class engine. It is supposed to be running every time a tween exists. */ private static startEngine; /** * Stops the Tweener class engine. */ private static stopEngine; /** * Updates the time to enforce time grid-based updates. */ static updateTime: () => void; /** * Updates the current frame count */ static updateFrame: () => void; /** * Ran once every frame. It's the main engine; updates all existing tweenings. */ static onEnterFrame: (e: Event) => void; /** * Sets the new time scale. * * @param p_time Number New time scale (0.5 = slow, 1 = normal, 2 = 2x fast forward, etc) */ static setTimeScale: (p_time: number) => void; /** * Finds whether or not an object has any tweening. * * @param p_scope Target object. * @return <code>true</code> if there's a tweening occuring on this object (paused, delayed, or active), <code>false</code> if otherwise. */ static isTweening: (p_scope: any) => boolean; /** * Returns an array containing a list of the properties being tweened for this object. * * @param p_scope Target object. * @return Total number of properties being tweened (including delayed or paused tweens). */ static getTweens: (p_scope: any) => any[]; /** * Returns the number of properties being tweened for a given object. * * @param p_scope Target object. * @return Total number of properties being tweened (including delayed or paused tweens). */ static getTweenCount: (p_scope: any) => number; private static handleError; /** * Get the current tweening time (no matter if it uses frames or time as basis), given a specific tweening * * @param p_tweening TweenListObj Tween information */ static getCurrentTweeningTime: (p_tweening: any) => number; /** * Return the current tweener version * * @return String The number of the current Tweener version */ static getVersion: () => string; /** * Output an error message * * @param p_message String The error message to output */ static printError: (p_message: string) => void; }