2
에 그라데이션 색상을 사용하여 곡선을 그립니다. I이 방법나는이 그림 <a href="https://i.stack.imgur.com/RE4ub.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RE4ub.png" alt="gradient color curve image"></a></p> <p>여기 내 곡선 그리기 코드는하지만,이 코드는 하나 개의 색상 작동처럼 그라데이션 색상을 사용하여 곡선을 그리는 방법을 libgdx 자바
shapeRenderer.filledRect(x, y, width, height, lightBlue, lightBlue, darkBlue, darkBlue);
및
shapeRenderer.line(x, y, x2, y2, Color.RED, Color.GREEN);
다음 사각형 및 두 의해 그라데이션 색을 이용하여 선을 그릴 수
public class Test extends ApplicationAdapter{
//create paths
private Bezier<Vector2> path1;
private ShapeRenderer sr;
@Override
public void create() {
// set up random control points
int width = Gdx.graphics.getWidth();
int height = Gdx.graphics.getHeight();
int points = 4;
Vector2[] controlPoints = new Vector2[points];
for (int i = 0; i < points; i++) {
int x = (int) (Math.random() * width) ;
int y = (int) (Math.random() * height);
Vector2 point = new Vector2(x, y);
controlPoints[i] = point;
}
path1 = new Bezier<Vector2>(controlPoints);
sr = new ShapeRenderer();
sr.setAutoShapeType(true);
}
@Override
public void render() {
Gdx.gl.glClearColor(0f, 0f, 0f, 0f);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
sr.begin();
sr.setColor(Color.WHITE);
//draw path1
for(int i = 0; i < 100; ++i){
float t = i /100f;
// create vectors to store start and end points of this section of the curve
Vector2 st = new Vector2();
Vector2 end = new Vector2();
// get the start point of this curve section
path1.valueAt(st,t);
// get the next start point(this point's end)
path1.valueAt(end, t-0.01f);
// draw the curve
sr.line(st.x, st.y, end.x, end.y);
}
sr.end();
}
@Override
public void dispose() {
}
}는하지만 난 곡선을 그릴 필요 그라디언트 색상을 사용하여 나는 많은 것을 수색했으며 어떤 해결책도 아직 찾지 못했습니다.
제발 도와주세요.
감사합니다. 그것은 작동합니다 .. 정말 고마워요. –