Skip to content

Instantly share code, notes, and snippets.

@aneasystone
Created March 13, 2018 02:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aneasystone/8a0d1c2d4e9fe3c0adf350b774056123 to your computer and use it in GitHub Desktop.
Save aneasystone/8a0d1c2d4e9fe3c0adf350b774056123 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by aneasystone on 2018/3/13
import pylab as pl
# https://github.com/gdsmith/jquery.easing/blob/master/jquery.easing.js
def ease_in_quad(x):
return x * x
def ease_out_quad(x):
return 1 - (1 - x) * (1 - x)
def get_tracks(ease_func):
ts = []
if ease_func in globals():
ease = globals()[ease_func]
for i in range(100):
ts.append(ease(i/100.0))
return ts
tracks = get_tracks('ease_out_quad')
print(tracks)
plot2 = pl.plot(range(len(tracks)), tracks, 'r')
pl.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment