Skip to main content

BezierUtils

Make interpolation curves like CSS

local ease = BezierUtils.createBezierFactory(0.25, 0.1, 0.25, 1)
for i = 0, 1.05, 0.05 do
	print(i, ":", ease(i))
end

Functions

createBezierFactory

BezierUtils.createBezierFactory(
p1xnumber,
p1ynumber,
p2xnumber,
p2ynumber
) → (aXnumber) → number

Creates a new bezier factory which can smoothly translate between 0 to 1.

Show raw api
{
    "functions": [
        {
            "name": "createBezierFactory",
            "desc": "Creates a new bezier factory which can smoothly translate between 0 to 1.",
            "params": [
                {
                    "name": "p1x",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "p1y",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "p2x",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "p2y",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(aX: number) -> number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 28,
                "path": "src/bezierutils/src/Shared/BezierUtils.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "BezierUtils",
    "desc": "Make interpolation curves like CSS\n\n* A good place to generate and test these out: http://cubic-bezier.com/\n* Based upon https://gist.github.com/gre/1926947#file-keyspline-js\n\n```lua\nlocal ease = BezierUtils.createBezierFactory(0.25, 0.1, 0.25, 1)\nfor i = 0, 1.05, 0.05 do\n\tprint(i, \":\", ease(i))\nend\n```",
    "source": {
        "line": 16,
        "path": "src/bezierutils/src/Shared/BezierUtils.lua"
    }
}