Note that there are some explanatory texts on larger screens.

plurals
  1. POChange text fill colour when rect is overlayed - Processing
    primarykey
    data
    text
    <p>I have this little animation here that animates in a repeated seamless pattern.</p> <p>I have text, colored white, in the middle of the canvas that the looped shapes pass over. What I am trying to work out is when the white bars pass over the text it turns black. So as half the white bar goes over the T of "Text", half the T would be black and the half not covered would be still white on a diagonal.</p> <p>Would this be done with splitting up the letters? By doing masking, or using vector images?</p> <p>Here is a graphic example of what I'm trying to achieve. </p> <p><a href="http://imm.io/2Qsb" rel="nofollow noreferrer">http://imm.io/2Qsb</a></p> <pre class="lang-java prettyprint-override"><code>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 &gt;= -218 &amp;&amp; this.x &lt;= 207){ colr = #000000; } else { colr = #ffffff; } } void boundary() { if(this.x &gt; 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); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload