光滑潮湿或吐温算法 [英] Smooth damp or tween algorithm

查看:143
本文介绍了光滑潮湿或吐温算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道的算法平滑潮湿或有人叫它,补间。我想它在Lua preferably但任何帮助。

I would like to know an algorithm for smooth damp or as some people call it, tween. I would like it in Lua preferably but anything will help.

我已经试过看统一的教程,但没有一个算法不能转移code来代替顺利潮湿的功能。

I have tried watching unity tutorials but can't transfer the code without a algorithm to substitute for the smooth damp function.

推荐答案

如果我理解正确的问题,你正在寻找一个宽松的功能。有一个Lua库,它提供了一套在GitHub上缓和功能: https://github.com/EmmanuelOga/easing

If I understand the question correctly, you're looking for an easing function. There is a Lua library that provides a set of easing functions on GitHub: https://github.com/EmmanuelOga/easing

一个例子是:

local function inOutQuad(t, b, c, d)
  t = t / d * 2
  if t < 1 then
    return c / 2 * pow(t, 2) + b
  else
    return -c / 2 * ((t - 1) * (t - 3) - 1) + b
  end
end

其中t =时间,B =开始值,C =价值变动,以及d =持续的时间。

Where t = time, b = begin value, c = change in value, and d = duration.

在这些缓和功能的更多信息,请直接从罗伯特·彭纳在这里(这是上述功能源自)的 http://www.robertpenner.com/easing/

More information on these easing functions is available directly from Robert Penner here (this is where the function above is derived from): http://www.robertpenner.com/easing/

这篇关于光滑潮湿或吐温算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆