【发布时间】:2021-12-29 17:53:28
【问题描述】:
所以,我正在创建一个动画曲线顶点。基本上,它是一条有幅度的线。该图像是我想要实现的粗略草图 现在我想填充它,创建沙丘或山脉的想法,但是当我这样做时,在第一个点和最后一个点之间创建了一条假想线,并且没有以正确的方式填充它
int count = 50;
float time;
float amp;
// line param
float spacing = 45;
class dunes {
void drawDunes() {
stroke(211, 132, 52);
strokeWeight(2);
noFill();
frameRate(24);
//translate(-width, -height);
//scale(3);
time += .03;
amp = map(width, 0, width, 5, 15);
pushMatrix();
translate(width/2 - count*spacing/2, 0);
beginShape();
curveVertex(0, height/2);
for (int i = 0; i < count; i++) {
float x = i * spacing;
float y = height-250 + (sin(x + time) * amp + random(-.4, .4));
curveVertex(x, y);
}
curveVertex(count*spacing, height/2);
endShape();
popMatrix();
}
}
如何填充像正弦波一样的curveVertex?
【问题讨论】:
-
技术说明:curveVertex“什么都不是”,因为它是用于构建路径的指令,因此您有一个动画“路径”,使用 curveVertex 指令构建。跨度>
标签: processing curve vertex