packageDocumentation module import { ScreenViewport } from "@itwin/core-frontend" ; import { PlaybackSettings , TimelineDataProvider } from "./interfaces" ; alpha export class BaseTimelineDataProvider implements TimelineDataProvider { public readonly id = "TestTimelineDataProvider" ; public start : Date | undefined ; public end : Date | undefined ; public viewId = "" ; public supportsTimelineAnimation = false ; public animationFraction : number = 0 ; protected _viewport : ScreenViewport | undefined ; constructor ( viewport ? ) { this . _viewport = viewport ; if ( viewport ) this . viewId = viewport . view . id ; } protected _settings : PlaybackSettings = { duration : 20 * 1000 , loop : true } ; public async loadTimelineData ( ) { return false ; } /** Called to get the initial scrubber location */ public get initialDuration ( ) : number { return this . duration * this . animationFraction ; } /** Called to get playback duration  */ public get duration ( ) : number { return ( this . getSettings ( ) . duration ) ? this . getSettings ( ) . duration ! : 20000 ; } public set viewport ( viewport ) { this . _viewport = viewport ; if ( viewport ) this . viewId = viewport . view . id ; else this . viewId = "" ; } public get viewport ( ) : ScreenViewport | undefined { return this . _viewport ; } public get loop ( ) : boolean { return ( undefined === this . getSettings ( ) . loop ) ? false : this . getSettings ( ) . loop ! ; } public getSettings ( ) { return this . _settings ; } public updateSettings ( settings ) { this . _settings = { ... this . _settings , ... settings } ; } public onPlaybackSettingChanged = ( _settings ) => { } ; public onAnimationFractionChanged = ( _animationFraction ) => { } ; }