public void test() {
做网站、成都网站设计的开发,更需要了解用户,从用户角度来建设网站,获得较好的用户体验。成都创新互联多年互联网经验,见的多,沟通容易、能帮助客户提出的运营建议。作为成都一家网络公司,打造的就是网站建设产品直销的概念。选择成都创新互联,不只是建站,我们把建站作为产品,不断的更新、完善,让每位来访用户感受到浩方产品的价值服务。
CvPoint controlPoint[] = new CvPoint[4];
controlPoint[0] = new CvPoint(50, 60); //起点
controlPoint[1] = new CvPoint(130, 200); //控制点
controlPoint[2] = new CvPoint(300, 360); //控制点
controlPoint[3] = new CvPoint(400, 600); //终点
int n = controlPoint.length - 1; //
int i, r;
float u;
bezierPoint.clear();
// u的步长决定了曲线点的精度
for (u = 0; u = 1; u += 0.01) {
CvPoint p[] = new CvPoint[n + 1];
for (i = 0; i = n; i++) {
p[i] = new CvPoint(controlPoint[i].x, controlPoint[i].y);
}
for (r = 1; r = n; r++) {
for (i = 0; i = n - r; i++) {
p[i].x = (1 - u) * p[i].x + u * p[i + 1].x;
p[i].y = (1 - u) * p[i].y + u * p[i + 1].y;
}
}
bezierPoint.add(p[0]);
}
for (CvPoint point : bezierPoint) {
System.out.println(point.x + "," + point.y);
}
}
namespace Line
{
public partial class Form1 : Form
{
int l1, l2, l3, l4;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
l1 = e.X; l2 = e.Y;
}
private void Form1_MouseUp(object sender, MouseEventArgs e)
{
l3 = e.X; l4 = e.Y;
Paint()
}
private void Paint(object sender, PaintEventArgs e)
{
Graphics graLine = e.Graphics;
Pen myPen = new Pen(Color.Blue);
graLine.DrawLine(myPen, l1, l2, l3, l4);
}
}
}
参考资料
graLine.DrawLine(myPen, l1, l2, l3, l4);
更改.DrawLine为曲线即可
只是第二点和第三点的坐标而已,肯定有算法。具体看你要实现什么业务。
CCSprite *sprite3=[CCSprite spriteWithFile:@"giantAnt.png"]; sprite3.position=ccp(100,100); [self addChild:sprite3 z:999 tag:9987]; id move = [CCBezierTo actionWithDuration:5.0f bezier:config]; id speed =[CCSpeed actionWithAction:move speed:1.0f]; [speed setTag:222]; [sprite3 runAction:speed]; 如何要减速的话就执行这行代码[(CCSpeed*)[[self getChildByTag:9987] getActionByTag:222] setSpeed:0.5f];加速[(CCSpeed*)[[self getChildByTag:9987] getActionByTag:222] setSpeed:1.5f];