Reputation: 87
I'm learning cocos2d(python).When i watch cocos2d Documentation on webpage(cocos2d documentation).There are some code as follows:
action = Bezier(bezier_conf.path1, 5) # Moves the sprite using the
sprite.do(action) # bezier path 'bezier_conf.path1'
# in 5 seconds
and no more code.I don't understande what is 'bezier_conf.path1' and what value is i used to defined it.
Upvotes: 1
Views: 79
Reputation: 1887
You need to install package
pip install --upgrade bezier
Small example
import numpy as np
import bezier
n1 = np.array([[0.0, 1.0],[1.5, 1.0],[1.0, 0.0],])
n2 = np.array([[0.0, 0.0],[1.0, 1.0],[1.0, 2.5],])
curve1 = bezier.Curve(n1, degree=2)
curve2 = bezier.Curve.from_nodes(n2)
intersections = curve1.intersect(curve2)
print (intersections)
The intersection between two curves is calculated in this example.You need to import bezier for your code.
Upvotes: 1