@14islands/lerp 中文文档教程

发布于 4年前 浏览 22 项目主页 更新于 3年前

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

Sandbox demo

License

MIT, see LICENSE.md for details.

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文