【发布时间】:2015-12-03 18:48:28
【问题描述】:
我的the ball moving in a Bezier Curve from start to the middle of the curve 代码是:
void ballMove()
{
if(y[0]==height*1/10)
{
bezier (x[0], y[0],x[1], y[1], x[2], y[2], x[3], y[3]);
float x0; float x1; float x2; float x3;
float y0; float y1; float y2; float y3;
x0 = x[0]; x1 = x[1]; x2 = x[2]; x3 = x[3];
y0 = y[0]; y1 = y[1]; y2 = y[2]; y3 = y[3];
float t = (frameCount/100.0)%1;
float x = bezierPoint(x0, x1, x2, x3, t);
float y = bezierPoint( y0, y1, y2, y3, t);
if(t>=0.5)
{
t=0;
}
while(t==0.5)
{
a=x;
b=y;
}
while(t>0.5)
{
ellipse(a,b,30,30);
}
fill(255,0,0);
if(t!=0)
{
ellipse(x, y, 15, 15);
}
}
}
我已经在设置、绘制等中定义了所有内容,但我只想在按下空格时将球从贝塞尔曲线的起点发射到中间一次。
当前版本向我展示了循环。我怎样才能做到这一点?
尝试了所有方法,例如返回、中断、更改 t 参数等,但代码不起作用。我是新来的处理。
你有什么建议吗?
【问题讨论】:
-
你能发一个MCVE而不是一个断开连接的方法吗?
标签: processing