Coder Social home page Coder Social logo

stuymedova / easings Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 13 KB

Easing functions for smooth motion in animation

Home Page: https://deno.land/x/easings

License: MIT License

TypeScript 100.00%
typescript deno denoland deno-module deno-mod easing-functions easings easing-equations

easings's Introduction

Easings

Easing functions

  • Back easings: backInOut(t), backIn(t), backOut(t)
  • Bounce easings: bounceInOut(t), bounceIn(t), bounceOut(t)
  • Circle easings: circleInOut(t), circleIn(t), circleOut(t)
  • Elastic easings: elasticInOut(t), elasticIn(t), elasticOut(t)
  • Exponential easings: expoInOut(t), expoIn(t), expoOut(t)
  • Linear easings: linear(t)
  • Sine easings: sineInOut(t), sineIn(t), sineOut(t)
  • Quadratic easings: quadInOut(t), quadIn(t), quadOut(t)
  • Quartic easings: quartInOut(t), quartIn(t), quartOut(t)
  • Quintic easings: quintInOut(t), quintIn(t), quintOut(t)

Input: time t, typically in the range [0, 1]
Output: “eased” time , also typically in the range [0, 1]

Demo/Usage

import * as easings from 'https://deno.land/x/easings/mod.ts';

for (let t = 0; t <= 1; t += 0.05) {
  const eased = easings.cubicInOut(t);
  const str = repeat('*', eased * 20);
  console.log(str);
}

function repeat(str, num) {
  let result = '';
  num = Math.round(num);
  while (num--) {
    if(num >= 0) result += str;
    else num = 0
  }
  return result;
}

Output:


*
*
**
***
*****
*******
**********
*************
***************
*****************
******************
*******************
*******************
********************
********************
********************

More on easing

Easing Graphs / D3 / Observable*
Easing Animations / D3 / Observable*

*Note that D3 has a slightly different API

easings's People

Contributors

stuymedova avatar

Stargazers

 avatar

Watchers

 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.