interp

package module
v0.0.0-...-14d56d1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2017 License: MIT Imports: 1 Imported by: 1

README

Interp

A collection of basic interpolation functions.

Step, Linearstep, Smoothstep

Step plots

Easein, Easeout

Easein plots

Easeout plots

Smothstep vs Easein/Easeout

Smothstep vs Easein/out plots

Documentation

Overview

The interp package is a collection of interpolation functions.

Most functions are controlled by the first argument t as it ranges between 0.0 and 1.0.

With the exception of 'Clamp', functions in this package take one of three forms.

_: Functions that do not end with 'step' or 'mix' return normalized values that are not clamped.

_Step: Function that end with 'step', return normalized values that clamp between 0.0 and 1.0

_Mix: Functions that end with 'mix', return results that are not normalized, and rage across the provided arguments

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clamp

func Clamp(t float64, x float64, y float64) (r float64)

Clamp returns t, constrained within the range of x and y.

func Easein

func Easein(t float64, exp float64) float64

func Easeinstep

func Easeinstep(t float64, exp float64) float64

func Easeout

func Easeout(t float64, exp float64) float64

func Easeoutstep

func Easeoutstep(t float64, exp float64) float64

func Linearstep

func Linearstep(t float64) (r float64)

Linear mapping of t, in the rage 0.0 to 1.0

func Map

func Map(t float64, x float64, y float64) float64

Map is the inverse of Mix, output is 0.0 when t == x and 1.0 when t == y

func Mix

func Mix(t float64, x float64, y float64) float64

Mix returns x when t is 0 and y when t is 1.0, and blends between x and y between 0.0 and 1.0. Mix does not clamp results if t is outside the range 0.0 to 1.0, the results is a value along along the slope of x and y. In this context 't' is sometimes referred to as 'alpha'

func Smoothmix

func Smoothmix(t float64, x float64, y float64) (r float64)

Smoothmix returns a smoothstep value between 0.0 and 1.0 as t ranges between x and y.

func Smoothstep

func Smoothstep(t float64) float64

Smoothstep return a value between 0.0 and 1.0 that eases in and out as as t ranges between 0.0 and 1.0

func Step

func Step(t float64, x float64) float64

Step return 0 if t is less than x, otherwise it returns 1.

Types

This section is empty.

Directories

Path Synopsis
cmd
plot command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL