Implementation ideas:
√ from multi-touch to get across the trajectory, the number of control points, the general use of queues, new points to extrude the point of the end of the team. This is expressed as point[16];
√ Cycle; Point and point[i+1] form the line L, calculate the slope of the line, the angle θ from the slope (can review the polar coordinates), so as to get the normal equation of L (xcosθ+ysinθ-p=0);
With width W (-W), the point is shifted along the normal direction, resulting in a trajectory of 2 translations.
Here the absolute value of W, the head should be wider, the tail contraction to 0.
The key algorithm, the expert will see a joke.
1 Cgpoint pt = ccpsub (p1, p2); 2 glfloat angle = ccptoangle (PT); 3 4 glfloat x = sinf (angle) * W; 5 glfloat y = COSF (angle) * W; 6 vertex->x = p1.x+x; 7 vertex->y = p1.y-y;
Attachment address:
"Turn" achieves fruit Ninja's knife-light effect