Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
get isAnimating(): boolean {
for (const tileHandler of this.m_tileHandlerMap) {
if (tileHandler[1].isAnimating) {
return true;
}
}
return false;
}
}
/**
* Implements animated extrusion effect for the extruded objects in the [[Tile]]
*/
export class AnimatedExtrusionTileHandler {
private m_extrudedObjects: THREE.Object3D[] = [];
private m_animatedExtrusionRatio: number = ExtrusionFeature.DEFAULT_RATIO_MAX;
private m_animatedExtrusionState: AnimatedExtrusionState = AnimatedExtrusionState.None;
private m_animatedExtrusionStartTime: number | undefined = undefined;
private m_mapView: MapView;
private m_animatedExtrusionHandler: AnimatedExtrusionHandler;
constructor(
private m_tile: Tile,
extrudedObjects: Array<{ object: THREE.Object3D; materialFeature: boolean }>,
private m_animatedExtrusionDuration: number
) {
this.m_mapView = m_tile.mapView;
this.m_animatedExtrusionHandler = this.m_mapView.animatedExtrusionHandler;
extrudedObjects.forEach(extrudedObject => {
if (extrudedObject.materialFeature) {
ExtrusionFeature.addRenderHelper(extrudedObject.object);
const currentTime = Date.now();
if (
this.m_animatedExtrusionStartTime === undefined ||
this.m_animatedExtrusionStartTime <= 0
) {
this.m_animatedExtrusionStartTime = currentTime;
}
const timeProgress = Math.min(
currentTime - this.m_animatedExtrusionStartTime,
this.m_animatedExtrusionDuration
);
this.extrusionRatio = MathUtils.easeInOutCubic(
ExtrusionFeature.DEFAULT_RATIO_MIN,
ExtrusionFeature.DEFAULT_RATIO_MAX,
timeProgress / this.m_animatedExtrusionDuration
);
if (timeProgress >= this.m_animatedExtrusionDuration) {
this.m_animatedExtrusionState = AnimatedExtrusionState.Finished;
this.stopExtrusionAnimation();
}
this.m_tile.dataSource.requestUpdate();
};
}