陀螺儀使用範例, (我的ios13測試失敗,可能是隱私問題)
let txt = new egret.TextField();
this.addChild(txt);
var orientation = new egret.DeviceOrientation();
orientation.addEventListener(egret.Event.CHANGE, (e: egret.OrientationEvent) => {
txt.text = `alpha:${e.alpha},beta:${e.beta},gamma:${e.gamma}`;
}, this);
orientation.start();
沒有留言:
張貼留言