@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
50 lines (49 loc) • 2.12 kB
TypeScript
/**
* W3C Device Orientation control (http://w3c.github.io/deviceorientation/spec-source-orientation.html)
*/
import { EventDispatcher, Quaternion } from 'three';
import { ScreenOrientation } from './DeviceOrientationControlsUtils';
export declare const DEFAULT_SMOOTH_AMOUNT = 0.01;
export declare const COMPASS_READJUST_TIMESTEP_START = 1000;
export declare const COMPASS_READJUST_TIMESTEP_MAX = 5000;
export declare const COMPASS_READJUST_TIMESTEP_INCREMENT = 1000;
interface WindowEventMapExtended extends WindowEventMap {
deviceorientationabsolute: DeviceOrientationEvent;
}
declare global {
interface Window {
addEventListener<K extends keyof WindowEventMapExtended>(type: K, listener: (this: Window, ev: WindowEventMapExtended[K]) => any, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof WindowEventMapExtended>(type: K, listener: (this: Window, ev: WindowEventMapExtended[K]) => any, options?: boolean | EventListenerOptions): void;
}
}
declare class DeviceOrientationControls extends EventDispatcher<{
change: any;
}> {
protected _relativeQuaternion: Quaternion;
protected _blendedQuaternion: Quaternion;
enabled: boolean;
protected _relativeEvent: Partial<DeviceOrientationEvent>;
protected _screenOrientation: ScreenOrientation;
alphaOffset: number;
protected _smoothAmount: number;
protected _yAngleOffset: number | undefined;
protected _currentYAngleOffset: number;
protected _targetYAngleOffset: number;
protected _absoluteYAngle: number | undefined;
_compassReadjustTimestep: number;
private _absoluteYAngleProcessedAt;
constructor();
private onDeviceOrientationChangeEvent;
private onDeviceOrientationAbsoluteChangeEvent;
private _setAbsoluteAngleY;
private onScreenOrientationChangeEvent;
private _bound;
connect(): void;
disconnect(): void;
private lastQuaternion;
update(): void;
quaternion(target: Quaternion): void;
setSmoothAmount(smoothAmount: number): void;
dispose: () => void;
}
export { DeviceOrientationControls };