зеркало из https://github.com/github/plax.git
Merge branch 'gyrorange'
This commit is contained in:
Коммит
a8c8ee628d
|
@ -31,6 +31,7 @@
|
||||||
layers = [],
|
layers = [],
|
||||||
plaxActivityTarget = $(window),
|
plaxActivityTarget = $(window),
|
||||||
motionMax = 1,
|
motionMax = 1,
|
||||||
|
motionMin = -1,
|
||||||
motionStartX = null,
|
motionStartX = null,
|
||||||
motionStartY = null,
|
motionStartY = null,
|
||||||
ignoreMoveable = false
|
ignoreMoveable = false
|
||||||
|
@ -168,6 +169,12 @@
|
||||||
// Admittedly fuzzy measurements
|
// Admittedly fuzzy measurements
|
||||||
x = values.x / 30
|
x = values.x / 30
|
||||||
y = values.y / 30
|
y = values.y / 30
|
||||||
|
// Ensure not outside of expected range, -1 to 1
|
||||||
|
x = x < motionMin ? motionMin : (x > motionMax ? motionMax : x)
|
||||||
|
y = y < motionMin ? motionMin : (y > motionMax ? motionMax : y)
|
||||||
|
// Normalize from -1 to 1 => 0 to 1
|
||||||
|
x = (x + 1) / 2
|
||||||
|
y = (y + 1) / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
var hRatio = x/((moveable() == true) ? motionMax : plaxActivityTarget.width()),
|
var hRatio = x/((moveable() == true) ? motionMax : plaxActivityTarget.width()),
|
||||||
|
|
Загрузка…
Ссылка в новой задаче