1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
import matplotlib.pyplot as plt
import pytweening
def showTween(tweenFunc):
# Example list of (x, y) tuples
points = []
for i in range(0, 1000):
i = i / 1000
points.append((i, tweenFunc(i)))
# Separate the x and y coordinates
x_coords, y_coords = zip(*points)
# Plot the points
plt.scatter(x_coords, y_coords)
# Set the x and y limits
plt.xlim(-0.4, 1.4)
plt.ylim(-0.4, 1.4)
plt.axvline(x=0.0, color='gray', linestyle='--')
plt.axvline(x=1.0, color='gray', linestyle='--')
plt.axhline(y=0.0, color='gray', linestyle='--')
plt.axhline(y=1.0, color='gray', linestyle='--')
plt.title(tweenFunc.__qualname__)
# Display the plot
plt.show()
graphs = (
pytweening.easeInQuad,
pytweening.easeOutQuad,
pytweening.easeInOutQuad,
pytweening.easeInCubic,
pytweening.easeOutCubic,
pytweening.easeInOutCubic,
pytweening.easeInQuart,
pytweening.easeOutQuart,
pytweening.easeInOutQuart,
pytweening.easeInQuint,
pytweening.easeOutQuint,
pytweening.easeInOutQuint,
pytweening.easeInSine,
pytweening.easeOutSine,
pytweening.easeInOutSine,
pytweening.easeInExpo,
pytweening.easeOutExpo,
pytweening.easeInOutExpo,
pytweening.easeInCirc,
pytweening.easeOutCirc,
pytweening.easeInOutCirc,
pytweening.easeInElastic,
pytweening.easeOutElastic,
pytweening.easeInOutElastic,
pytweening.easeInBack,
pytweening.easeOutBack,
pytweening.easeInOutBack,
pytweening.easeInBounce,
pytweening.easeOutBounce,
pytweening.easeInOutBounce,
pytweening.easeInPoly,
pytweening.easeOutPoly,
pytweening.easeInOutPoly,
)
for graph in graphs:
showTween(graph)
|