@14islands/lerp 中文文档教程
Frame rate independent linear interpolation function
这是一个基于这篇文章。 它在后台使用 https://www.npmjs.com/package/lerp。
var lerp = require('@14islands/lerp')
var res = lerp(a, b, t, frameDelta, targetFps);
Usage
// classic lerp - works as expected
lerp(start, end, progress)
// Interpolates and adjusts for the frame delta. Default target is 60fps.
const frameDelta = clock.getDelta()
lerp(start, end, alpha, frameDeltaMs)
// Adjust for frame delta targeting a 120fps refresh rate.
const frameDelta = clock.getDelta()
lerp(start, end, alpha, frameDelta, 120)
Demo
License
麻省理工学院,参见LICENSE.md 了解详情。
Frame rate independent linear interpolation function
This is a frame rate independent linear interpolation function based on this article. It uses https://www.npmjs.com/package/lerp under the hood.
var lerp = require('@14islands/lerp')
var res = lerp(a, b, t, frameDelta, targetFps);
Usage
// classic lerp - works as expected
lerp(start, end, progress)
// Interpolates and adjusts for the frame delta. Default target is 60fps.
const frameDelta = clock.getDelta()
lerp(start, end, alpha, frameDeltaMs)
// Adjust for frame delta targeting a 120fps refresh rate.
const frameDelta = clock.getDelta()
lerp(start, end, alpha, frameDelta, 120)
Demo
License
MIT, see LICENSE.md for details.