0
반복 된 연속 패턴으로 움직이는이 작은 애니메이션이 있습니다.rect가 오버레이 될 때 텍스트 채우기 색 변경 - 처리
캔버스의 중간에 반복되는 모양의 텍스트가 흰색으로 표시됩니다. 내가 해결하려고하는 것은 흰색 막대가 검정으로 변하는 텍스트를 지나칠 때입니다. 그래서 흰 막대의 절반이 "텍스트"의 T를 넘기 때문에 T의 절반은 검은 색이고 덮지 않은 절반은 여전히 대각선의 흰색입니다.
글자를 분할하면됩니까? 마스킹을하거나 벡터 이미지를 사용하면됩니까?
다음은 내가 달성하고자하는 그래픽 예입니다.
drawLine wob1;
drawLine wob2;
drawLine wob3;
drawLine wob4;
drawLine wob5;
PFont helv;
drawText title;
void setup() {
//frame.setResizable(true);
size(320, 480);
smooth();
frameRate(50);
wob1 = new drawLine(0);
wob2 = new drawLine(200);
wob3 = new drawLine(400);
wob4 = new drawLine(600);
wob5 = new drawLine(800);
title = new drawText();
}
void draw() {
background(#000000);
wob1.increment();
wob1.display(#ffffff);
wob1.pos();
wob1.boundary();
wob2.increment();
wob2.display(#ffffff);
wob2.boundary();
wob3.increment();
wob3.display(#ffffff);
wob3.boundary();
wob4.increment();
wob4.display(#ffffff);
wob4.boundary();
wob5.increment();
wob5.display(#ffffff);
wob5.boundary();
title.rendertitle(#ffffff;
}
class drawLine {
int x = -480;
int y = 0;
int count;
drawLine(int offset) {
this.x = this.x + offset;
}
void increment() {
this.x += 3;
this.y += 4;
}
void display(int col) {
//noStroke();
fill(col);
//translate(0,0);
rectMode(CENTER);
rotate(-PI/3.0);
rect(x,y,100,3000);
rotate(PI/3.0);
}
void pos() {
println(this.x);
//if(this.x >= -218 && this.x <= 207){ colr = #000000; } else { colr = #ffffff; }
}
void boundary() {
if(this.x > 520) {
this.x = -480; this.y = 0;
}
}
}
class drawText {
drawText() {
helv = loadFont("Helvetica-Bold.vlw");
}
void rendertitle(int colr) {
fill(colr);
textFont(helv, 30);
text("Text goes here", width/2, height/2, 240, 50);
}
}
고맙습니다. 완벽하게 작동 :) – tamago