All Projects → etienne-dldc → humpf

etienne-dldc / humpf

Licence: MIT license
📐 Damped Spring as a function of time

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to humpf

leaflet-velocity
Visualise velocity data on a leaflet layer
Stars: ✭ 467 (+1845.83%)
Mutual labels:  velocity
Velocity
The modern, next-generation Minecraft server proxy.
Stars: ✭ 1,153 (+4704.17%)
Mutual labels:  velocity
go-satellite
Calculate orbital information of satellites in GoLang.
Stars: ✭ 55 (+129.17%)
Mutual labels:  velocity
Negativity
Github of Negativity, a Minecraft AntiCheat. Premium at 8€:
Stars: ✭ 184 (+666.67%)
Mutual labels:  velocity
RealIP
The Spigot, Bungee and Velocity plugin that parses client IP addresses passed from the TCPShield network.
Stars: ✭ 121 (+404.17%)
Mutual labels:  velocity
LiteCommands
☄️ LiteCommands - Annotation based Command framework for Velocity, Bukkit, Paper, BungeeCord and your other implementations.
Stars: ✭ 39 (+62.5%)
Mutual labels:  velocity
YanXuanRefresh
仿网易严选下拉刷新动画效果
Stars: ✭ 37 (+54.17%)
Mutual labels:  anim
HotelLink
WebSite; Hotel Service Web Site Java Spring Boot
Stars: ✭ 14 (-41.67%)
Mutual labels:  velocity
CutAndDisplace
Boundary Element MATLAB code. Modelling faults and deformation
Stars: ✭ 40 (+66.67%)
Mutual labels:  friction
correlation flow
ROS package for Correlation Flow (ICRA 2018)
Stars: ✭ 28 (+16.67%)
Mutual labels:  velocity
Android-Activity-Transition-Custom-Animation
No description or website provided.
Stars: ✭ 42 (+75%)
Mutual labels:  anim
escapevelocity
A subset reimplementation of Apache Velocity with a much simpler API.
Stars: ✭ 28 (+16.67%)
Mutual labels:  velocity
ElytraProxy
Really customizable Minecraft proxy server with Auth, AntiBot, etc, based on Velocity. Supports 1.7 - 1.17.1
Stars: ✭ 29 (+20.83%)
Mutual labels:  velocity
Velocity
🚀Velocity template engine for JavaScript and PHP.
Stars: ✭ 33 (+37.5%)
Mutual labels:  velocity
RuoYi-fast
🎉 (RuoYi)官方仓库 基于SpringBoot的权限管理系统 易读易懂、界面简洁美观。 核心技术采用Spring、MyBatis、Shiro没有任何其它重度依赖。直接运行即可用
Stars: ✭ 117 (+387.5%)
Mutual labels:  velocity
Debuggery
A small plugin designed to expose API values at runtime.
Stars: ✭ 36 (+50%)
Mutual labels:  velocity
docs-maven-skin
Minimalist HTML5 and Bootstrap based Maven Skin for using Maven Site as a documentation site.
Stars: ✭ 31 (+29.17%)
Mutual labels:  velocity
RxAnimator
An RxJava2 binding for android Animator
Stars: ✭ 80 (+233.33%)
Mutual labels:  anim
projectile
An artist-friendly tool for throwing stuff around inside Blender
Stars: ✭ 136 (+466.67%)
Mutual labels:  velocity
spr
Spring-driven motion library
Stars: ✭ 43 (+79.17%)
Mutual labels:  springs

humpf logo

📐 Humpf Build Status

Damped Spring position as a function of time

What is this

This a library that let you animate using a Damped Springs. The awesome thing about springs is that they can model all king of motions:

  • From A to B with a rebound at the end
  • From A to B smoothly
  • Decay (like pushing something)

Difference with other libraries

Most library out there will model spring by updating a value: on each frame they compute the forces applyed on the value and upate it accordingly. Humpf is different because it does not update a value but give you a function that take the time as parameter and return the position and velocity (speed) at that position in time.

Gist

import { Spring } from 'humpf';

const spring = Spring();

spring(0); // { pos: 0, vel: 0 }
spring(100); //  { pos: 26.4241, vel: 36.7879  }
spring(200); //  { pos: 59.3994, vel: 27.0670 }
spring(300); //  { pos: 80.0851, vel: 14.9361 }
spring(500); //  { pos: 95.9572, vel: 3.3689 }
spring(1000); //  { pos: 99.95006, vel: 0.0453 }
spring(10000); //  { pos: 100, vel: 0 }

Options

You can pass different options to the spring to change it's behavior:

// all the options (see below for more details)
Spring({
  position: 0, // initial velocity
  equilibrium: 100, // position to approach (aka "to")
  velocity: 0, // initial velocity
  angularFrequency: 1, // how fast does it move ?
  dampingRatio: 1, // how much is it slowed down ?
  timeStart: 0, // time at which the annimation should start
  timeScale: 1 / 100, // [ADVANCED] change time scale
});

position (default 0)

This is the initiale position of the spring: the value when it starts (at timeStart).

equilibrium (default 100)

The equilibrium position of the spring: the value it will reach over time. If your spring bounce it will occilate around this value.

velocity (default 0)

The initial velocity of the spring. 0 mean it's stationary.

Example: If your spring goes from 0 to 100, a positive velocity mean it's already going up so it will go faster. A negative velocity means it's going in the oposite direction and will go down a little before going up.

angularFrequency (default 0)

The angular frequency of your spring define how fast it wants to move. If you have a very bouncy spring (not much friction), the angular frequency define how many back and forth will happen.

Example: 10 mean a lot of back and forth, so your spring will move fast. 0.5 is much lower so your spring will be slower

dampingRatio (default 1)

The damping ratio define how much resistance (friction) is opposed to your spring.
If the damping ratio is less than 1 your spring will overshoot and bounce. If it's under 1 it will not.
If the damping ratio is 1 it will reach the equilibrium as fast as possible without bouncing.

timeStart (default 0)

The time at which the spring should start.
Usually you want to pass the current time to start a spring "now".

Note: spring does not work in reverse, so you you try to get a value for a time before timeStart it will return the initial state.

timeScale (default 1 / 100)

The timeScale allow you to change how time is interpreted. The default value 1/100 will make your spring to take about a second to reach equilibrium. You probably don't need to change this.

Math equations

Most of the maths come from http://www.ryanjuckett.com/programming/damped-springs/.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].