Code Monkey home page Code Monkey logo

tigercurve's Introduction

TigerCurve

生成运行曲线函数

用法

1. 在8个数(0-7)为周期的循环中,到达目标值4,时间为5秒,返回一个速度曲线。这个曲线函数只有一个参数time,返回当前的位置。 如果为手动停止,时间传-1,调用stop停止。如需调整停止的快慢,根据源文件中的注释调整相应参数即可。

实例:

var func = getCurve(8,4,5)
var result = func(3) //在第3秒的位置,为result

var func = getCurve(8,4,-1) //手动停止
func.stop() //主动停止,会调整加速度,自动停在目标值。

效果图(曲线轨迹在最后一张图左边):

two

2. 从4个点中,选择目标值,闪烁由慢到快,最后停在目标点

实例:

var func = getFourCurve(8,4,5)
var result = func(3) //在第三秒需要显示的点数组

效果图(曲线轨迹在最后一张图右边):

one

曲线轨迹:

three

tigercurve's People

Contributors

zx6733090 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.