本文整理匯總了TypeScript中@interactjs/utils.pointer.setCoordDeltas方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript pointer.setCoordDeltas方法的具體用法?TypeScript pointer.setCoordDeltas怎麽用?TypeScript pointer.setCoordDeltas使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@interactjs/utils.pointer
的用法示例。
在下文中一共展示了pointer.setCoordDeltas方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: inertiaTick
function inertiaTick (interaction: Interact.Interaction) {
updateInertiaCoords(interaction)
utils.pointer.setCoordDeltas(interaction.coords.delta, interaction.coords.prev, interaction.coords.cur)
utils.pointer.setCoordVelocity(interaction.coords.velocity, interaction.coords.delta)
const state = interaction.inertia
const options = getOptions(interaction)
const lambda = options.resistance
const t = interaction._now() / 1000 - state.t0
if (t < state.te) {
const progress = 1 - (Math.exp(-lambda * t) - state.lambda_v0) / state.one_ve_v0
if (state.modifiedXe === state.xe && state.modifiedYe === state.ye) {
state.sx = state.xe * progress
state.sy = state.ye * progress
}
else {
const quadPoint = utils.getQuadraticCurvePoint(
0, 0,
state.xe, state.ye,
state.modifiedXe, state.modifiedYe,
progress)
state.sx = quadPoint.x
state.sy = quadPoint.y
}
interaction.move()
state.timeout = raf.request(() => inertiaTick(interaction))
}
else {
state.sx = state.modifiedXe
state.sy = state.modifiedYe
interaction.move()
interaction.end(state.startEvent)
state.active = false
interaction.simulation = null
}
utils.pointer.copyCoords(interaction.coords.prev, interaction.coords.cur)
}