熱門文章

Ⓒegret.DeviceOrientation & egret.OrientationEvent 用法

陀螺儀使用範例, (我的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();

參考:iOS 12.2將限制 Web app存取iPhone動作感測器

沒有留言:

張貼留言