Skip to content

messizqin/Matplotlib-BezierCurve-Animator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Matplotlib Bezier Curve Animator


Python 3.7.3
Matplotlib 3.2.1

Data science application for free distribution
Illustrate motion of bezier curve based on given points

Output


Bezier Curve Level 2

l2

Bezier Curve Level 3

l3

Bezier Curve Level 7

l7

Bezier Curve Level 12

l12



Requirements


  1. Lang: None
  2. Python 3 installed
  3. Matplotlib installed


Usage


Illustrate all animation of a bezier curve

from matplotlib import pyplot as plt
from bezier import illustrate

fig = plt.figure()

points = [[0, 0], [3, 3], [6, 0]]
b = illustrate(fig, points, interval=50, n=100)

plt.show()

Sketch a bezier curve

from matplotlib import pyplot as plt
from bezier import sketch

fig = plt.figure()
plt.xlim(-1, 11)
plt.ylim(-2, 8)
b = sketch(fig, [[0, 0], [5, 5], [10, 0]], color='b')
plt.show()

Moving line, moving dot motion

from matplotlib import pyplot as plt
from bezier import Bezier
import numpy as np

fig = plt.figure()
plt.xlim(0, 10)
plt.ylim(0, 10)
left_x = np.linspace(2, 8, 100)
left_y = [8 for x in range(100)]
right_x = np.linspace(2, 8, 100)
right_y = [2 for x in range(100)]
b = Bezier(fig)
a1 = b.vector_animate(left_x, left_y, right_x, right_y, color='k', no_line=True)
a2 = b.line_animate(left_x, left_y, right_x, right_y, color='b')
plt.show()



Feature


  1. Animate points transformation


Limitations


  1. Don't pass in too much points, a number between 2 to 10 will be fine, any larger number may cause your machine overstressed


About

Animate n level Bezier Curve by given points

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages