It also seems from the Internet that the principle here is to use the rotation of the beiser curve bow and arrow to produce the parabolic effect of the bow and arrow. Besell curve: ccbezierconfigbezr; bezr. controlPoint_1start; bezr. controlPoint_2ccp (start. x + (end. x-start.x) * 0.5, start. y + (end. y-start.y) * 0.5 + 100)
It also seems from the Internet that the principle here is to use the rotation of the beiser curve bow and arrow to produce the parabolic effect of the bow and arrow. Besell curve: ccBezierConfig besuppliers; besuppliers. controlPoint_1 = start; bezr. controlPoint_2 = ccp (start. x + (end. x-start.x) * 0.5, start. y + (end. y-start.y) * 0.5 + 100)
It also looks like it on the Internet. Record it here
The principle is to use the beiser curve + the rotation of the bow and arrow to produce the parabolic effect of the bow and arrow.
Betel curve:
ccBezierConfig bezier;bezier.controlPoint_1 = start;bezier.controlPoint_2 = ccp(start.x+(end.x-start.x)*0.5,start.y+(end.y-start.y)*0.5+100);bezier.endPosition = ccp(end.x, end.y);float duration = 1.0f;CCBezierTo *actionBezier = CCBezierTo::create(duration,bezier);
ControlPoint_1 is the starting point, endPosition is the ending point of the beiser curve animation, and the most important controlPoint_2 is the trend of the curve, which determines the highest point of the curve. If you want to learn more about the beiser curve, please refer to here: http://www.jasondavies.com/animated-bezier/
Then there is the rotation Animation:
float angle = 45.0f;CCRotateTo *actionRotate =CCRotateTo::create(duration,angle);
Finally, let the two animations play simultaneously:
CCSpawn* actionSpawn = CCSpawn::createWithTwoActions(actionBezier,actionRotate);
All right, all done.
However, after doing so, I feel that the archery effect is still unsatisfactory. After all, it is a opportunistic method. To optimize the visual effect, you can adjust the animation playback speed.