UNPKG

@awayjs/scene

Version:
148 lines 7.62 kB
import { IAsset } from '@awayjs/core'; import { IFilter } from '../adapters/IFilter'; import { MovieClip } from '../display/MovieClip'; import { DisplayObject } from '../display/DisplayObject'; import { DisplayObjectContainer } from '../display/DisplayObjectContainer'; import { ISceneGraphFactory } from '../factories/ISceneGraphFactory'; import { IFrameLabel } from './IFrameLabel'; import { TimelineActionType as AType } from './TimelineActionType'; import { IFrameScript } from './IFrameScript'; type TApplyFunction = (timeline: Timeline, child: DisplayObject, ratget: MovieClip, i: number) => void; export declare class Timeline { readonly factory: ISceneGraphFactory; static readonly applyFunctionMap: Record<AType, TApplyFunction>; private _blocked; _update_indices: number[]; _update_frames: number[]; isButton: boolean; _labels: StringMap<IFrameLabel>; avm1InitActions: Object; avm1ButtonActions: any[]; avm1Exports: Object; private _framescripts; private _framescripts_translated; keyframe_to_frameidx: Object; keyframe_indices: number[]; keyframe_firstframes: number[]; keyframe_constructframes: number[]; keyframe_durations: ArrayBufferView; frame_command_indices: ArrayBufferView; frame_recipe: ArrayBufferView; command_index_stream: ArrayBufferView; command_length_stream: ArrayBufferView; add_child_stream: ArrayBufferView; add_sounds_stream: ArrayBufferView; remove_child_stream: ArrayBufferView; update_child_stream: ArrayBufferView; update_child_props_length_stream: ArrayBufferView; update_child_props_indices_stream: ArrayBufferView; property_index_stream: ArrayBufferView; property_type_stream: ArrayBufferView; properties_stream_int: ArrayBufferView; properties_stream_f32_mtx_all: ArrayBufferView; properties_stream_f32_mtx_scale_rot: ArrayBufferView; properties_stream_f32_mtx_pos: ArrayBufferView; properties_stream_f32_ct: ArrayBufferView; properties_stream_strings: string[]; properties_stream_filters: IFilter[]; placeObjectTagsForSessionIDs: NumberMap<any>; graphicsPool: any; audioPool: any; numKeyFrames: number; /** * in AS3 framescript are getting added to mc by calling "mc.addFrameScript" from within the mc.constructor * because timelines are shared between all instances of a mc, * only the first instance of a mc should be allowd to add framescripts to the timeline * to check this, we track the id of mc-instance that adds the first framescript, * and only allow additional framescripts to be added from same instance **/ private _initalMcID; constructor(factory: ISceneGraphFactory); resetScripts(): void; init(): void; /** * for AS3: * - called from constructor of MC * for AS2: * - called when decoding swf-tags to timeline-streams * @param script - * @param frame_idx - the index of the frame (not the keyframe-index) * @param target_mc - the mc-instance that is calling this function */ add_framescript(script: any, frame_idx: number, target_mc: MovieClip, isAVM1?: boolean): void; /** * get a array of framescripts for a specific frame * for AVM1 "checkForTranslation" should be true, so we get translated framescripts * @param target_mc * @param frame_idx * @param checkForTranslation */ get_script_for_frame(target_mc: MovieClip, frame_idx: number, checkForTranslation?: boolean): IFrameScript[]; get numFrames(): number; getKeyframeIndexForFrameIndex(frame_index: number): number; getChildInstance(symbolID: number, sessionID: number): IAsset; extractHitArea(target_mc: MovieClip): DisplayObjectContainer; /** * Get the label at the current frame of the target_mc MovieClip instance. * If the current frame has no label, it returns null * @param target_mc */ getCurrentFrameLabel(target_mc: MovieClip): string; /** * Get the label at the current frame of the target_mc MovieClip instance. * If the current frame has no label it returns the name of the previous frame that includes a label. * If the current frame and previous frames do not include a label, it returns null * @param target_mc */ getCurrentLabel(target_mc: MovieClip): string; jumpToLabel(target_mc: MovieClip, label: string, offset?: number): void; /** * Get scripts for a specific frame * atm this is only called from AVM1MovieClip._callFrame * @param target_mc * @param label * @param isAVM1 */ getScriptForLabel(target_mc: MovieClip, label: string, isAVM1?: boolean): IFrameScript[]; /** * move the playhead of the timeline to a specific frame * @param target_mc * @param frame_idx * @param queue_script * @param queue_pass2 * @param forceReconstruct */ gotoFrame(target_mc: MovieClip, frame_idx: number, queue_script?: boolean, queue_pass2?: boolean, forceReconstruct?: boolean): void; applyCollectedUpdateCommands(target_mc: MovieClip): void; /** * constructs the next frame of the timeline * expects the target_mc.currentFrameIndex to already be set to the next frame * @param target_mc * @param queueScript * @param scriptPass1 */ constructNextFrame(target_mc: MovieClip, queueScript?: boolean, scriptPass1?: boolean): void; remove_childs_continous(sourceMovieClip: MovieClip, frame_command_idx: number): void; add_childs_continous(target_mc: MovieClip, frame_command_idx: number): void; start_sounds(target_mc: MovieClip, frame_command_idx: number): void; update_childs(target_mc: MovieClip, frame_command_idx: number, frameIdx?: number): void; static update_mtx_all(timeline: Timeline, child: DisplayObject, _target_mc: MovieClip, i: number): void; static update_colortransform(timeline: Timeline, child: DisplayObject, _target_mc: MovieClip, i: number): void; static update_masks(timeline: Timeline, child: DisplayObject, target_mc: MovieClip, i: number): void; static update_name(timeline: Timeline, child: DisplayObject, target_mc: MovieClip, i: number): void; static update_button_name(timeline: Timeline, target: DisplayObject, sourceMovieClip: MovieClip, i: number): void; static update_visibility(_timeline: Timeline, child: DisplayObject, target_mc: MovieClip, i: number): void; static update_mtx_scale_rot(timeline: Timeline, child: DisplayObject, _target_mc: MovieClip, i: number): void; static update_mtx_pos(timeline: Timeline, child: DisplayObject, target_mc: MovieClip, i: number): void; static enable_maskmode(_timeline: Timeline, child: DisplayObject, _target_mc: MovieClip, _i: number): void; static remove_masks(_timeline: Timeline, child: DisplayObject, _target_mc: MovieClip, _i: number): void; static update_filters(timeline: Timeline, child: DisplayObject, _target_mc: MovieClip, i: number): void; static swap_graphics(timeline: Timeline, child: DisplayObject, _target_mc: MovieClip, i: number): void; static start_audio(_timeline: Timeline, _child: DisplayObject, _target_mc: MovieClip, _i: number): void; static set_ratio(_timeline: Timeline, child: DisplayObject, _target_mc: MovieClip, i: number): void; static update_blendmode(_timeline: Timeline, child: DisplayObject, _target_mc: MovieClip, i: number): void; static update_rendermode(_timeline: Timeline, _child: DisplayObject, _target_mc: MovieClip, i: number): void; dispose(): void; } export {}; //# sourceMappingURL=Timeline.d.ts.map