How to use the @here/harp-materials.ExtrusionFeature.DEFAULT_RATIO_MAX function in @here/harp-materials

To help you get started, we’ve selected a few @here/harp-materials examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github heremaps / harp.gl / @here / harp-mapview / lib / AnimatedExtrusionHandler.ts View on Github external
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);
github heremaps / harp.gl / @here / harp-mapview / lib / AnimatedExtrusionHandler.ts View on Github external
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();
    };
}