熱門文章

Ⓒegret.Motion & egret.MotionEvent 用法

加速度使用範例, (我的ios13測試失敗, 可能是隱私問題)

let info = new egret.TextField();
this.addChild(info);
var motion = new egret.Motion();
motion.addEventListener(egret.Event.CHANGE, (e: egret.MotionEvent) => {
    info.text = "加速度: \nx:"+e.accelerationIncludingGravity.x
                        +",\ny:"+e.accelerationIncludingGravity.y
                        +",\nz:"+e.accelerationIncludingGravity.z;
}, this);
motion.start();

沒有留言:

張貼留言