<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
      <title>Tagged with background() - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=background%28%29</link>
      <pubDate>Sun, 08 Aug 2021 15:59:07 +0000</pubDate>
         <description>Tagged with background() - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/taggedbackground%28%29/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>PGraphics text has ugly edges</title>
      <link>https://forum.processing.org/two/discussion/27841/pgraphics-text-has-ugly-edges</link>
      <pubDate>Tue, 24 Apr 2018 15:16:29 +0000</pubDate>
      <dc:creator>theliquu69</dc:creator>
      <guid isPermaLink="false">27841@/two/discussions</guid>
      <description><![CDATA[<p>Hello,</p>

<p>I'm trying to draw text inside of a <code>PGraphics</code>, but it looks ugly. Code:</p>

<pre><code>PGraphics g;

void setup() {
  size(400, 400);

  g = createGraphics(width, height);

  g.beginDraw();
  g.fill(255);
  g.text("In PGraphics", 4, 48);
  g.endDraw();
}

void draw() {
  background(32);

  fill(255);
  text("In Draw", 4, 24);

  image(g, 0, 0);
}
</code></pre>

<p>Here's a screenshot:</p>

<p><img src="https://i.imgur.com/5uxf7FU.png" alt="screenshot" /></p>

<p>What's going wrong with this? I tried adding a <code>background(0)</code> call to the <code>PGraphics</code>, but it didn't help, because the background needs to be transparent. I am going to draw color in my final sketch, so I can't really use blending modes.</p>

<p>EDIT: Just providing more details: I need to use JAVA2D, because my sketch uses clip(), and P2D breaks clip() with transform().</p>
]]></description>
   </item>
   <item>
      <title>PGraphics weird drawing problem</title>
      <link>https://forum.processing.org/two/discussion/27566/pgraphics-weird-drawing-problem</link>
      <pubDate>Sat, 31 Mar 2018 01:34:19 +0000</pubDate>
      <dc:creator>BGADII</dc:creator>
      <guid isPermaLink="false">27566@/two/discussions</guid>
      <description><![CDATA[<p><img src="https://i.imgur.com/sdCTJJd.png" alt="" /></p>

<p>Here is an example of circles and text drawn to a PGraphics buffer (top), and just regular circles/text on the side. Why is there such a huge difference in quality/appearance? There is no difference in code between the two asides from appending canvas.</p>

<pre><code>    for (int x = 1; x &lt; width/M; x ++) {
      if (line) {
        canvas.line(x*M, 0, x*M, canvasHeight);
      }
      canvas.textSize(10);
      canvas.textAlign(CENTER, CENTER);
      canvas.text(x + "m", x*M, 25*cm); 
      canvas.ellipse(x*M, 50*cm, 20*cm, 20*cm);
    }
</code></pre>
]]></description>
   </item>
   <item>
      <title>How to get the text to show over image background</title>
      <link>https://forum.processing.org/two/discussion/27412/how-to-get-the-text-to-show-over-image-background</link>
      <pubDate>Wed, 28 Mar 2018 07:30:20 +0000</pubDate>
      <dc:creator>Brandy</dc:creator>
      <guid isPermaLink="false">27412@/two/discussions</guid>
      <description><![CDATA[<p>the text won't show when the background image is added. what am i doing wrong?</p>

<pre><code>String canvasMsg = "CACTUS";
PFont font;
PImage bg;
int y;

void setup() {
  size(640, 360);
  bg = loadImage("cactus.JPG");

  fill(153, 0, 153);


  font = loadFont("ACaslonPro-Semibolditalic-48.vlw");
  textFont(font);
  textSize(100);

  textAlign(CENTER);
  text(canvasMsg, width / 2 - 10, height + 2);
}

void draw() {
  background(bg);
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>how to smooth ellipse</title>
      <link>https://forum.processing.org/two/discussion/26961/how-to-smooth-ellipse</link>
      <pubDate>Wed, 21 Mar 2018 13:17:42 +0000</pubDate>
      <dc:creator>mxloizix</dc:creator>
      <guid isPermaLink="false">26961@/two/discussions</guid>
      <description><![CDATA[<p>Hello,</p>

<p>I have made this little code for trying P5JS</p>

<pre><code>  var bubbleDiam = 40;
  var bubbleNb = 80;
  var xpos = [];
  var ypos = [];
  var hue = []; 

 function setup() {

 createCanvas(windowWidth, windowHeight);
 colorMode(HSB,360,100,100);
 noStroke();

  for( var i = 0 ; i &lt; bubbleNb ; i++){
  xpos[i] = random(bubbleDiam, windowWidth - bubbleDiam);
  ypos[i] = random(bubbleDiam, windowHeight - bubbleDiam);
  hue[i] = random(360);
  }      
}

function draw() {
 var bri = map(mouseY,0,displayHeight, 60,100);
 var vary = map(mouseX,0,displayWidth,-60,60);

  for( var i = 0 ; i &lt; bubbleNb ; i++){
    fill(hue[i] + vary, 80,bri);
    ellipse(xpos[i],ypos[i],bubbleDiam,bubbleDiam, 100);
}

}
</code></pre>

<p>but there is a strong problem of aliasing as you can see <br /></p>

<p><a rel="nofollow" href="https://forum.processing.org/two/uploads/imageupload/373/LUQBD7C0S4YT.PNG" title="temp-bubbles">temp-bubbles</a></p>

<p><img src="https://forum.processing.org/two/uploads/imageupload/373/LUQBD7C0S4YT.PNG" alt="" /></p>

<p>how can I have beautiful circles in P5js ?</p>

<p>thanks</p>
]]></description>
   </item>
   <item>
      <title>Problem drawing with p5.js</title>
      <link>https://forum.processing.org/two/discussion/26541/problem-drawing-with-p5-js</link>
      <pubDate>Mon, 26 Feb 2018 16:20:26 +0000</pubDate>
      <dc:creator>AjejeBrazorf</dc:creator>
      <guid isPermaLink="false">26541@/two/discussions</guid>
      <description><![CDATA[<p>Hi,
I state that I'm new to p5.js, i'm having an issue drawing things.
I got this code that draw a Golden Ratio Rectangle:</p>

<pre><code>var y,x;
var sliderx,slidery;
const GoldenRatio = (1 + Math.sqrt(5)) / 2;


function setup() {
  createCanvas(1920/3*2,1080/3*2);
  background(255, 204, 0);
  sliderx = createSlider(0,1500,1200,1);
  console.log(x);
  console.log(y);
}

function draw() {
  x = sliderx.value();
  y = x / GoldenRatio;
  noFill();
  rect(1,0,x-2,y);
  GoldenRatioDraw(x,y);
}

function GoldenRatioDraw(x,y){
  if(x&gt;0 &amp;&amp; y&gt;0){
  push();
  translate(y,y);
  line(0,0,0,-y);
  arc(0,-y,y * 2,y * 2,PI/2,PI);
  rotate(3* PI /2);
  translate(x-y);
  GoldenRatioDraw(y,x-y);
  pop();
  }
}
</code></pre>

<p>When I change the x value with the slider, I want it to change the dimension of the rectangle not to draw a new one and overlay the old one.(sorry for bad english :) )</p>

<p>Can you help me?</p>
]]></description>
   </item>
   <item>
      <title>Help !! My simple, interactive and dangerous "program". !!! (Chansey and Robots)</title>
      <link>https://forum.processing.org/two/discussion/26503/help-my-simple-interactive-and-dangerous-program-chansey-and-robots</link>
      <pubDate>Fri, 23 Feb 2018 19:02:29 +0000</pubDate>
      <dc:creator>DDv2FF</dc:creator>
      <guid isPermaLink="false">26503@/two/discussions</guid>
      <description><![CDATA[<p>This is one of my first projects, and I have a 3 problem that I can´t resolve! This code, draws four robots and its antennas, and there is a Chansey (a pokemon), in the middle of the canvas, she gets mad if you turnOn the robots switchers.<br />
My First problem is, I don´t know if there is a way to make a Chansey Class, because I don´t feel right with her in the Robot Class. The problem is, that she needs the information of the "turn on" behaviour.<br />
My Second problem is that I can´t remove the chanseyMessage(); once that the user reset the robots. (there is a try, but it didnt work).<br />
And my last problem, I don´t know how to make a local counter for the antennas. When the four antennas are on, something is going to happen Hehe.</p>

<pre><code>    var chansey;

    function preload() {
       chansey = loadImage("https://"+"image.ibb.co/kZzhax/pzbykg5va9uz.png");
    }
    let robots = [];

    function setup() {
       createCanvas(700, 600);
       background(20);
       for (var i = 0; i &lt; 2; i++) {
          for (var j = 0; j &lt; 2; j++) {
             robots.push(new Robot(i * 500 + 50, j * 400 + 75, 50));
          }
       }
    }

    function draw() {
       //drawing robot army.
       for (let robot of robots) {
          robot.drawRobot();
          robot.chanseyMESSAGE();
       }
       //Chansey
       image(chansey, 290, 250, 100, 100);
       //button "make chansey happy"
       stroke(255);
       fill(0);
       rect(310, 0, 60, 30);
       fill(255);
       textSize(15);
       text("Reset", 320, 20);
    }

    function mousePressed() {
       for (let antennas of robots) {
          antennas.turnOn(mouseX, mouseY);
       }
       //this make Chansey happy
       if (mouseX &lt; 375 &amp;&amp; mouseX &gt; 315 &amp;&amp; mouseY &lt; 30 &amp;&amp; mouseY &gt; 0) {
          for (let colorAntennaReset of robots) {
             colorAntennaReset.b = 1;
             colorAntennaReset.red = 0;
             colorAntennaReset.green = 100;
             colorAntennaReset.blue = 300;
             //so now the chanseyMESSAGE disapear
             colorAntennaReset.chanseyTURN = false;
          }
       }
    }
    class Robot {
       constructor(x, y, t) {
          this.x = x;
          this.y = y;
          this.t = t;
          this.swicherX = this.x + 25 / 50 * this.t;
          this.swicherY = this.y - 15 / 50 * this.t;
          this.swicherRadius = (15 / 50 * this.t) / 2;
          //swicher color
          this.b = 0;
          //roboteyes color
          this.red = 0;
          this.green = 100;
          this.blue = 300;
          //chansey inside robot class...
          this.chanseyTURN = false;
       }
       drawRobot() {
          //stick of the antenna
          stroke(0, 100, 300);
          line(this.x + 2.5 / 5 * this.t, this.y + this.t / 10, this.x + 2.5 / 5 * this.t, this.y - 3 / 5 * this.t);
          //swicher ball turnOn
          stroke(100);
          fill(255, 100, this.b);
          ellipse(this.x + 25 / 50 * this.t, this.y - 15 / 50 * this.t, 15 / 50 * this.t, 15 / 50 * this.t);
          //robot head
          stroke(0);
          fill(0, 0, 150);
          rect(this.x - this.t / 10, this.y + this.t / 5, 60 / 50 * this.t, this.t / 5);
          fill(100);
          rect(this.x, this.y, this.t, 4.5 / 5 * this.t);
          //eyes
          fill(this.red, this.green, this.blue);
          rect(this.x + 9 / 50 * this.t, this.y + this.t / 5, this.t / 5, this.t / 10);
          rect(this.x + 3.2 / 5 * this.t, this.y + 1 / 5 * this.t, this.t / 5, this.t / 10);
          //mouth
          line(this.x + 1 / 5 * this.t, this.y + 3 / 5 * this.t, this.x + 4 / 5 * this.t, this.y + 3 / 5 * this.t);
       }
       turnOn(suicidetryX, suicidetryY) {
          let proxToAntenna = dist(suicidetryX, suicidetryY, this.swicherX, this.swicherY);
          if (proxToAntenna &lt; this.swicherRadius) {
             //changing antenna color
             this.b = 255;
             // changing roboteyes color
             this.red = 255;
             this.green = 50;
             this.blue = 0;
             //making chansey ANGRY ..
             this.chanseyTURN = true;
          }
       }
       chanseyMESSAGE() {
          if (this.chanseyTURN) {
             fill(255);
             textSize(20);
             text("STOP IT", 303, 370);
          } else { //DONT SHOW THE MESSAGE }
       }
    }
</code></pre>

<p>I post it in the wrong place the first tme.</p>
]]></description>
   </item>
   <item>
      <title>Why are text and graphics so ugly and blocky?</title>
      <link>https://forum.processing.org/two/discussion/8075/why-are-text-and-graphics-so-ugly-and-blocky</link>
      <pubDate>Tue, 11 Nov 2014 10:54:48 +0000</pubDate>
      <dc:creator>PhiLho</dc:creator>
      <guid isPermaLink="false">8075@/two/discussions</guid>
      <description><![CDATA[<h1>Why are text and graphics so ugly and blocky?</h1>

<p>Often in the forum we have similar questions:<br />
"<em>Why is the text so blocky?</em>"<br />
"<em>Why these lines are not anti-aliased?</em>"<br />
"<em>Why is this circle almost squarish?</em>"<br /></p>

<p>And when asked, the user shows code looking like:</p>

<pre lang="processing">
void setup()
{
  size(400, 400);
  background(255);
}

void draw()
{
  stroke(#000055);
  fill(#000055);

  ellipse(width / 2, height / 2, width / 10, height / 10);

  textSize(50);
  text("Blocky\nText", 100, 2 * height / 3);
  textSize(10);
  text("Other\nText", 20, height / 3);

  line(100, 50, 300, 150);
  line(150, 150, 350, 100);
}
</pre>

<p>If you are an experienced user, you immediately spot the problem, and advise to move the call to <code>background()</code> at the start of <code>draw()</code>;</p>

<pre lang="processing">
void setup()
{
  size(400, 400);
}

void draw()
{
  background(255);
  stroke(#000055);
  fill(#000055);

  ellipse(width / 2, height / 2, width / 10, height / 10);

  textSize(50);
  text("Blocky\nText", 100, 2 * height / 3);
  textSize(10);
  text("Other\nText", 20, height / 3);

  line(100, 50, 300, 150);
  line(150, 150, 350, 100);
}
</pre>

<p>In versions before 2.0, adding a call to <code>smooth()</code> helped, but it is the default now.</p>

<h3>Why does it makes a difference?</h3>

<p>Processing does its drawings in anti-aliased mode: the borders are smoothed by drawing semi-transparent, toned down pixels on the borders, making a nicer transition with the background.
<code>draw()</code> is called 60 times per second (by default). It doesn't erase the background if not asked explicitly. So it draws over and over the graphics at the same place. The semi-transparent pixels cumulate on the borders, so they progressively become completely opaque. Hence the blocky look with steps.</p>

<p>Nearly all the Processing sketches (except some special effects playing on the accumulation of graphics) start <code>draw()</code> with a call to <code>background()</code>. There can be exceptions, but they are the done by people understanding deeply how Processing works.</p>
]]></description>
   </item>
   <item>
      <title>pgraphics.clear() and background() doesn't clear pgraphics</title>
      <link>https://forum.processing.org/two/discussion/26047/pgraphics-clear-and-background-doesn-t-clear-pgraphics</link>
      <pubDate>Sat, 20 Jan 2018 10:08:15 +0000</pubDate>
      <dc:creator>dehyde</dc:creator>
      <guid isPermaLink="false">26047@/two/discussions</guid>
      <description><![CDATA[<p>Hi</p>

<p>I'm trying to create a map with some 130,000 points from a csv file, and have a tooltip pop up on mouse over with the data.
Since there are so many points, redrawing background and the points will take too much time and performance drops.
I'm trying to use pgraphics to create another "layer" just for overlays like tooltips and on mouse overs.</p>

<p>for some reason clear() and background(x, x, x, 0) don't clean the pgraphics object. I'm not 100% sure why.</p>

<p>here's the code (based on load save table example code and pgraphics reference):</p>

<pre><code>PGraphics circle;
// An Array of Bubble objects
Bubble[] bubbles;
// A Table object
Table table;

void setup() {
  size(1200, 700);
  loadData();
  circle = createGraphics(100, 100);
}

void draw() {
      //background(255);
  // Display all bubbles


    for (Bubble b : bubbles) {
      b.display();
      b.rollover(mouseX, mouseY);
    }

  textAlign(LEFT);
  fill(0);
  text("Click to add bubbles.", 10, height-10);
}

void loadData() {
  // Load CSV file into a Table object
  // "header" option indicates the file has a header row
  table = loadTable("ged171.csv", "header");

  // The size of the array of Bubble objects is determined by the total number of rows in the CSV
  bubbles = new Bubble[table.getRowCount()]; 

  // You can access iterate over all the rows in a table
  int rowCount = 0;
  for (TableRow row : table.rows()) {
    // You can access the fields via their column name (or index)
    float x = row.getFloat("longitude");
    float y = row.getFloat("latitude");
    float d = row.getFloat("where_prec");
    String n = row.getString("dyad_name");
    // Make a Bubble object out of the data read
    bubbles[rowCount] = new Bubble(x*6+300, height-y*6-350, d, n);
    rowCount++;
  }
}




// A Bubble class

class Bubble {
  float x,y;
  float diameter;
  String name;

  boolean over = false;

  // Create  the Bubble
  Bubble(float x_, float y_, float diameter_, String s) {
    x = x_;
    y = y_;
    diameter = diameter_;
    name = s;
  }

  // CHecking if mouse is over the Bubble
  void rollover(float px, float py) {
    float d = dist(px,py,x,y);
    if (d &lt; diameter/2) {
      over = true; 
    } else {
      over = false;
    }
  }

  // Display the Bubble
  void display() {
    if(frameCount==1){
    noStroke();
    //strokeWeight(2);
    fill(255);
    ellipse(x,y,diameter,diameter);


    }
    if (over) {
      fill(0,0,0,255);
      textAlign(CENTER);
      text(name,x,y+diameter/2+20);
      circle.beginDraw();
      circle.clear();
      circle.endDraw();
      circle.beginDraw();
      circle.background(0,0,0,0);
      circle.ellipse(50, 50, 75, 75);
      circle.endDraw();
      image(circle, x, y);
    }
  }
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>How to randomize background color, bouncing ball</title>
      <link>https://forum.processing.org/two/discussion/25851/how-to-randomize-background-color-bouncing-ball</link>
      <pubDate>Sat, 06 Jan 2018 18:48:19 +0000</pubDate>
      <dc:creator>mattwonderwall</dc:creator>
      <guid isPermaLink="false">25851@/two/discussions</guid>
      <description><![CDATA[<p>Hi guys,</p>

<p>So I'm just getting started with processing and have little knowledge on it. Anyhow, I'm trying the bouncing ball problem and for every time it threatens to go outside the width of the screen the ball will bounce back; I've got that part covered.</p>

<p>Now I want it to not only bounce back and forth, but also change the background color for each time it hits the side.</p>

<p>What I've got so far is:</p>

<p>float ballX;
float xspeed = 3;</p>

<p>void setup(){
  size(500,400);
  ballX=0;
  background(0);</p>

<p>}</p>

<p>void draw(){
  fill(255);
  ellipse(ballX,height/2,24,24);</p>

<p>ballX = ballX + xspeed;</p>

<p>if(ballX&gt;500 || ballX&lt;0){
 xspeed=xspeed*-1;</p>

<p>if(ballX&gt;500 || ballX&lt;0){
 background(random(255),random(255),random(255));
}
 }</p>

<p>This was the only way I got the background to stay that random color until the ball hit the opposite wall and changed again. When I had background(0); in void draw it would only flash a color and than turn back to black each time it hit a wall. The only problem I have now is that the ball is traced, just a long streak of white until it hits a wall and changes color.</p>

<p>How can I change this so that it looks normal, without the ball being traced?</p>
]]></description>
   </item>
   <item>
      <title>Time based image "gallery"</title>
      <link>https://forum.processing.org/two/discussion/25650/time-based-image-gallery</link>
      <pubDate>Wed, 20 Dec 2017 15:14:03 +0000</pubDate>
      <dc:creator>Layzfat</dc:creator>
      <guid isPermaLink="false">25650@/two/discussions</guid>
      <description><![CDATA[<p>Hi,</p>

<p>I have this code where I put several images (100) and load them, i've managed to load them in my html page. And as expected they all show after each other. 
How could I make the appear one by one over time. So that every 10 second I get a new image on the same position. All images are the same size. So the centering should not be a problem.</p>

<p>my sketch.js has this for now</p>

<pre><code>let faces = [];
//var canvas;

function preload(){
  for (let i = 0; i &lt; 3; i++) {
    faces[i] = createImg('images/' + i + '.jpg');
  }
}

function setup() {
  createCanvas(800, 900);
  //canvas = createCanvas(window.innerWidth, window.innerHeight);

  // put setup code here
}

function draw() {

  image(faces, 0, 0);
  // put drawing code here
}
/*
window.onresize = function(){
  var w = window.innerWidth;
  var h = window.innerHeight;
  cansvas.size(w,h);

}
*/

It should be like an automated slideshow. 
</code></pre>
]]></description>
   </item>
   <item>
      <title>I have to assignment and i need a little bit of help</title>
      <link>https://forum.processing.org/two/discussion/25306/i-have-to-assignment-and-i-need-a-little-bit-of-help</link>
      <pubDate>Thu, 30 Nov 2017 17:25:24 +0000</pubDate>
      <dc:creator>unitehome</dc:creator>
      <guid isPermaLink="false">25306@/two/discussions</guid>
      <description><![CDATA[<p>So i am new student to processing in general to graphics and i have an assignment that i need to finish it till next week 
here you can find simple video of the assignment : <a href="https://drive.google.com/file/d/1bIoKDPcOnvDjOzBPluSXyyNWYBHkFWOe/view" target="_blank" rel="nofollow">https://drive.google.com/file/d/1bIoKDPcOnvDjOzBPluSXyyNWYBHkFWOe/view</a></p>

<p>so i almost got everything but i have one problem when i drag the mouse it draws new points/lines/curves.. but i am asked just to move the original position.</p>

<p>so here is the pastebin for my code till now : <a href="https://pastebin.com/EDMYrDVD" target="_blank" rel="nofollow">https://pastebin.com/EDMYrDVD</a></p>

<p>i hope i can get some help from you guys cheer.</p>

<p>Thank you</p>
]]></description>
   </item>
   <item>
      <title>Why does only one object appear?</title>
      <link>https://forum.processing.org/two/discussion/25262/why-does-only-one-object-appear</link>
      <pubDate>Wed, 29 Nov 2017 00:26:18 +0000</pubDate>
      <dc:creator>Lucas_p</dc:creator>
      <guid isPermaLink="false">25262@/two/discussions</guid>
      <description><![CDATA[<p>When I run the code there should be two balls moving, but it only shows one ball. I'm sure it's a dumb mistake, but I haven't been able to figure it out.</p>

<pre><code>circulo c;
circulo c1;
void setup(){
  size(700,500);
  c = new circulo(30,width-1,0,2,3);
  c1 = new circulo(25,0,height/2,4,5);
}

void draw(){
  background(255);

  c.move();
  c.display();
  c1.move();
  c1.display();
}

class circulo{

  float x;
  float velocidadX;
  float velocidadY;
  float y;
  float d;

  circulo(float diametro, float posX, float posY, float vx, float vy){
    d = diametro;
    x = posX;
    y = posY;
    velocidadX = vx;
    velocidadY = vy;
  }

  void move(){    
      y = y + velocidadY;
      x = x + velocidadX;
  if (x &gt; width){
    velocidadX = -velocidadX;
  }
  if (x &lt; 0){
    velocidadX = -velocidadX;
  } 

  if (y &gt; height){
    velocidadY= -velocidadY;
  }
  if (y &lt; 0){
    velocidadY= -velocidadY;
  }  
 }

  void display(){
  background(10);
  ellipse(x, y, d, d);  
  }

}
</code></pre>

<p>`</p>
]]></description>
   </item>
   <item>
      <title>A simple shape tool</title>
      <link>https://forum.processing.org/two/discussion/25019/a-simple-shape-tool</link>
      <pubDate>Wed, 15 Nov 2017 06:24:26 +0000</pubDate>
      <dc:creator>KunalAgnihotri</dc:creator>
      <guid isPermaLink="false">25019@/two/discussions</guid>
      <description><![CDATA[<p>Hello,</p>

<p>I’m trying to make a simple shape tool for a program. It works by adding a vertex to a shape when the mouse is clicked.</p>

<pre><code>//array to hold points
var mousepoints = [];



function setup() {
    createCanvas(400,400);
    background(200);
}

function draw() {
 print(mousepoints);   
    fill(20,200,66);
    beginShape();
    for(var i=0; i &lt;mousepoints.length; i = i + 2){
    vertex(mousepoints[i], mousepoints[i+1]);
    }


    endShape();
}

function mouseClicked(){

    append(mousepoints, mouseX);
    append(mousepoints, mouseY);    

}


function keyTyped(){

    //start a new shape

    if(key ==='a'){
    mousepoints.splice(0, mousepoints.length);
    }  
}
</code></pre>

<p><img src="" alt="" /><img src="https://forum.processing.org/two/uploads/imageupload/484/GPWQD0WT41RH.png" alt="Screen Shot 2017-11-15 at 11.49.30 AM" title="Screen Shot 2017-11-15 at 11.49.30 AM" /></p>

<p>The issue i’m facing is that when I make my shape with extrusions such as in the image, there is a fill outside the shape thats appearing(I have marked it in the red circles). Any way to resolve this?</p>
]]></description>
   </item>
   <item>
      <title>Read Potentiometer/Serial from Arduino on processing</title>
      <link>https://forum.processing.org/two/discussion/24915/read-potentiometer-serial-from-arduino-on-processing</link>
      <pubDate>Wed, 08 Nov 2017 16:46:40 +0000</pubDate>
      <dc:creator>DeDaymar</dc:creator>
      <guid isPermaLink="false">24915@/two/discussions</guid>
      <description><![CDATA[<p>Hey guys,</p>

<p>I'm working on a code which if written correctly should be able to print the value of my potentialmeter on processing. And then I dont mean with a flowing colour screen, that I can find on the internet. I want to print on the screen the number of the potentialmeter, and when I turn the wheel it, the number on processing should change.</p>

<p>I think my code does connect to the potentiometer and does print it on processing, but it keeps overwriting, the numbers dont change. It just literally writes over the previous numbers.</p>

<p><strong>My arduino code :</strong></p>

<pre><code>void setup() {
 //initialize the serial communication:
 Serial.begin(9600); } 
void loop() {
 //send the value of analog input 0:
 Serial.println(analogRead(A0));
//wait a bit for the analog-to-digital converter to stabilize after last 
//reading: delay(2); } 
</code></pre>

<p>My processing code</p>

<pre><code> import processing.serial.*;
Serial myPort;
PFont myFont;
float val;
int[] pin_val;
int lf = 10;
boolean received;
float inByte = 0;

void setup() {      

size(325,400);

fill(51,153,255);


rect(10,10,300,150);

myFont = createFont("Arial", 18);

textFont(myFont, 18);

println(Serial.list());

myPort = new Serial (this, Serial.list()[0], 9600);

pin_val = new int[0];

val = 0;

received = false;

}

void draw()

{
textSize(30);

fill(255,0,0);

textAlign(CENTER);

textFont(myFont, 18);

text("received:   "+inByte, 160,50 );                                                             //This is where I believe my fault is.
fill(255,255,255);

ellipse(162.5,260,80,80);
}

void serialEvent (Serial myPort)
 {
String inString = myPort.readStringUntil('\n');

if (inString!= null) {

// trim off any whitespace;

inString = trim(inString);

//convert to an int and map to the screen height:

inbyte = float(inString);

println(inByte);

inByte = map(inByte, 0, 1023, 0, height);

}
}
</code></pre>

<p>I know there is a blue rectangle and a white ellips, but that's part of my homework.</p>
]]></description>
   </item>
   <item>
      <title>Why does stokeWeight not erase after mousePressed event?</title>
      <link>https://forum.processing.org/two/discussion/24066/why-does-stokeweight-not-erase-after-mousepressed-event</link>
      <pubDate>Fri, 08 Sep 2017 15:49:51 +0000</pubDate>
      <dc:creator>And_orrr</dc:creator>
      <guid isPermaLink="false">24066@/two/discussions</guid>
      <description><![CDATA[<p>When I specify a mousePressed-event over an area, I want the default stroke weight of 1 to go up to 4 and have a colour change of the stroke to pink. This works.</p>

<p>When I press the button again though, the code draws a default stroke weight over the thick pink stoke, without 'erasing' this thick pink stroke, whereas I would like the line to simply go back to: 'white' and 'default thickness of 1'.</p>

<p>Why doesn't the previous colored strokeWeight erase after the mousePressed-event? I'm very thankful for any advice!</p>

<p>Here's the code:</p>

<pre><code>    boolean button = false; 
    int x = 50;
    int y = 50;
    int w = 100;
    int h = 75;

    void setup() {
      size(500,500);

    }

    void draw() {
      if (button) {
        stroke(#E55AD5);        
        strokeWeight(4);
        strokeJoin(ROUND);

    } else {
       stroke(255);
       strokeWeight(1); 

      }

      noFill();               
      rect(x,y,w,h);
    }

    void mousePressed() {
      if (mouseX &gt; x &amp;&amp; mouseX &lt; x+w &amp;&amp; mouseY &gt; y &amp;&amp; mouseY &lt; y+h) {
        button = !button;
      }
    }
</code></pre>
]]></description>
   </item>
   <item>
      <title>Flashing when re-drawing?</title>
      <link>https://forum.processing.org/two/discussion/23825/flashing-when-re-drawing</link>
      <pubDate>Tue, 15 Aug 2017 19:59:52 +0000</pubDate>
      <dc:creator>netrate</dc:creator>
      <guid isPermaLink="false">23825@/two/discussions</guid>
      <description><![CDATA[<p>I am creating a small maze game.  Right now I have the very basics of it.  I have a rectangle that will move around the screen, and a wall around the window.  The only problem is that every time the rectangle moves, the walls also get redrawn and it flashes.</p>

<p>Do I need to put the walls in a separate function?
What would be the best way around this?
Loop or no loop?</p>

<p>Here is the code :</p>

<pre><code>add_library("minim")

x1=100
x2=25
y1=20
y2=25

def setup():
    global sf
    size(200, 200)
    background(255) # white
    minim=Minim(this)
    sf=minim.loadFile("light ping.mp3", 2048)

def draw():
    global x1,y1,x2,y2
    fill(155)
    stroke(1)
    rect(x1, y1, x2, y2)
    noStroke()

    rect(0, 0, 5, height-30)
    rect(0, height-30, width, 5)
    rect(width-5, 0, 5, height-30)
    rect(0,0, width, 5)


def keyReleased():

    global x1, y1, x2, y2
    rect(x1, y1, x2, y2)
    if (key == CODED):
        if (keyCode == LEFT) and x1&gt;=1:
            x1=x1-10
            print(x1)
            background(255)
            rect(x1, y1, x2, y2)


        elif (keyCode == RIGHT) and x1&lt;=169:
            x1=x1+10
            print(x1)
            background(255)
            rect(x1,y1,x2,y2)

        elif (keyCode == UP) and y1&gt;=1:
            y1=y1-10
            print(y1)
            background(255)
            rect(x1,y1,x2,y2)


        elif (keyCode == DOWN) and y1&lt;=169:
            y1=y1+10
            print(y1)
            background(255)
            rect(x1,y1,x2,y2)
        else:
            sf.play()
            sf.rewind()
</code></pre>
]]></description>
   </item>
   <item>
      <title>Arrayed object method not working...</title>
      <link>https://forum.processing.org/two/discussion/23334/arrayed-object-method-not-working</link>
      <pubDate>Thu, 06 Jul 2017 16:50:58 +0000</pubDate>
      <dc:creator>tkwanjp</dc:creator>
      <guid isPermaLink="false">23334@/two/discussions</guid>
      <description><![CDATA[<pre><code>    var x = 0; // x position always starts at 0
    var y; // y postion

    var yoko; // horizontal length
    var tate; // vertical length

    var color_r; // r value of rgb
    var color_g; // g value of rgb
    var color_b; // b value of rgb

    var speed; // speed. value of increment

    var blocks = []; // Array of Block objects


    function setup() {
        createCanvas(windowWidth, windowHeight);
        noStroke();

        // create Block objects
        for (var i = 0; i &lt; 2; i ++) {
            blocks[i] = new Block();
        }

    }

    function draw() {

        // move blocks
        for (var i = 0; i &lt; blocks.length; i ++) {
            blocks[i].moveBlock;
        }
    }


    function Block() {

        // Set the ratio of horizontal-vertical length
        this.yoko = random(60, 300);
        this.tate = random(30, 120);

        // y is given at any given height of the screen
        this.y = random(windowHeight - this.tate);
        this.x = x;

        // set the color from 0 to 255
        this.color_r = random(255);
        this.color_g = random(255);
        this.color_b = random(255);

        // set the speed from 1 to 5
        this.speed = random(1, 5);


        this.moveBlock = function() {
            // set the color
            fill(this.color_r, this.color_g, this.color_b);
            // draw rectangle at random position and ratio
            rect(this.x, this.y, this.width, this.height);
            // move the rectangle from left-&gt;right
            this.x += this.speed;
            background(255); // reset the background
        };

    }
</code></pre>

<p>Hi,<br />
This code tries to move 2 random rectangles from left to right on the canvas.</p>

<p>I've tried to find a bug over chrome debugger, but can't figure it out.
It looks like something is wrong inside the object method though.
It is my first trial to use objects in p5.js.</p>

<p>I will appreciate for any help, suggestions.</p>

<p>Thanks</p>
]]></description>
   </item>
   <item>
      <title>How do I make a line that is in the left corner and that I can move with the mouse but leave notrail</title>
      <link>https://forum.processing.org/two/discussion/22369/how-do-i-make-a-line-that-is-in-the-left-corner-and-that-i-can-move-with-the-mouse-but-leave-notrail</link>
      <pubDate>Wed, 03 May 2017 17:34:24 +0000</pubDate>
      <dc:creator>Xaniac</dc:creator>
      <guid isPermaLink="false">22369@/two/discussions</guid>
      <description><![CDATA[<p>So basically a friend told me to do that and I'm not that good at processing so, I Think he ment that by movign the mouse the line would follow me but not draw any layers on the background, so how do I do this? Anyone? Codes from the sick coders?</p>
]]></description>
   </item>
   <item>
      <title>Drawing from mousePressed?</title>
      <link>https://forum.processing.org/two/discussion/21482/drawing-from-mousepressed</link>
      <pubDate>Sun, 19 Mar 2017 20:29:06 +0000</pubDate>
      <dc:creator>pyan83</dc:creator>
      <guid isPermaLink="false">21482@/two/discussions</guid>
      <description><![CDATA[<p>Ok, so I'm sure there is a stupidly easy answer and I'm totally embarrassed to ask this...</p>

<p>I want to draw a circle when the mouse is clicked at mouseX, mouseY but it doesn't seem to work. Can you explain why?</p>

<pre><code>function setup() {
    createCanvas(600, 600);
}

function draw() {
    background(200);
}

function mousePressed() {
    ellipse(mouseX, mouseY, 180);
}
</code></pre>

<p>I have been trying to google and search the forums for an answer. I did find a KahnAcademy <a rel="nofollow" href="https://www.khanacademy.org/computer-programming/mouseclicked-processingjs/1897113673">answer</a> which is pretty much the same code but they're using processing.js.</p>
]]></description>
   </item>
   <item>
      <title>Background in draw()</title>
      <link>https://forum.processing.org/two/discussion/21258/background-in-draw</link>
      <pubDate>Wed, 08 Mar 2017 17:39:13 +0000</pubDate>
      <dc:creator>PRouse</dc:creator>
      <guid isPermaLink="false">21258@/two/discussions</guid>
      <description><![CDATA[<p>I'm writing a simple code where I can drag the mouse around and a color streak will appear on screen where my mouse goes.</p>

<pre><code>`void setup(){
  size(1200, 1200);
  frameRate(30);
}

void draw(){
   background(255);
  //background(random(255), random(255), random(255));
}

void mouseDragged() {
  stroke(random(255), random(255), random(255));
  strokeWeight(random(20));
  line(pmouseX, pmouseY, mouseX, mouseY);
}`
</code></pre>

<p>The issue I'm having is with the background in draw(). I do want the background color to continuously load, but I also want the background to change to a new color each time some event is triggered (preferably a mouse release), and continuously load only that color until another trigger occurs. Right now I have the background just set to white.</p>

<p>So to reiterate the program logic:</p>

<p>1)Program starts with background continuously running initial color.</p>

<p>2)Mouse pressed and dragged creating colorful streak.</p>

<p>3)Mouse released triggering background change to new random color.</p>

<p>4)Background continuously runs the new random color.</p>

<p>5)Back to (2).</p>
]]></description>
   </item>
   <item>
      <title>The Case of Transparent Canvas</title>
      <link>https://forum.processing.org/two/discussion/20691/the-case-of-transparent-canvas</link>
      <pubDate>Mon, 06 Feb 2017 19:22:21 +0000</pubDate>
      <dc:creator>pranjalchaubey</dc:creator>
      <guid isPermaLink="false">20691@/two/discussions</guid>
      <description><![CDATA[<p>I am doing a simple experiment, and failing.</p>

<p>I have a simple setup where a circle follows the mouse pointer, using the standard 'easing' technique. 
I keep redrawing the 'background' of the canvas while successively increasing the x &amp; y coords of the circle, in each call of the 'draw' function. The background of the canvas has been set as 'red'.</p>

<p>Now, I simply want to make the background of the canvas disappear (ie, become transparent) after a certain number of seconds. The problem is, when I set the background as transparent ('rgba(255, 255, 255, 0)'), the circle instead of following the mouse, starts to draw itself over like a thick line. This is equivalent to not calling the 'background' function inside the 'draw' function.</p>

<p>Not sure what I am doing wrong here. 
PS - I don't want a white background, I want a transparent background.</p>
]]></description>
   </item>
   <item>
      <title>Problems with random image displaying</title>
      <link>https://forum.processing.org/two/discussion/19830/problems-with-random-image-displaying</link>
      <pubDate>Mon, 19 Dec 2016 19:18:42 +0000</pubDate>
      <dc:creator>niekocaster</dc:creator>
      <guid isPermaLink="false">19830@/two/discussions</guid>
      <description><![CDATA[<p>hello processing community, i'm new to programming(processing is the first thing i've tried). and I was having some problems with my code.
I'm trying to make my background change every few seconds for a brief amount of time, but it just won't work,
can you help me out? Thanks in advance :)</p>

<blockquote class="Quote">
  <p>PImage bg;<br />
  PImage bg2;</p>
  
  <p>void setup() {<br />
  framerate(10);<br />
  size(720, 720);<br />
  bg = loadImage("bg.jpg");<br />
  bg2 = loadImage("bg22.jpg");<br />
  }<br />
  void draw() {<br />
  background(bg);<br />
  float X = random(60);<br />
  if(X == 1) {<br />
  background(bg2);<br />
  }<br />
  }</p>
</blockquote>
]]></description>
   </item>
   <item>
      <title>Setting img as background - Coordinate out of bounds</title>
      <link>https://forum.processing.org/two/discussion/18227/setting-img-as-background-coordinate-out-of-bounds</link>
      <pubDate>Wed, 21 Sep 2016 04:29:44 +0000</pubDate>
      <dc:creator>nach</dc:creator>
      <guid isPermaLink="false">18227@/two/discussions</guid>
      <description><![CDATA[<p>Hey guys, I'm trying to display and image as my background in the <code>void setup()</code> but it shows me the <em>ArrayIndexOutOfBoundException: Coordinate out of bounds!</em> error.
However, when I use <code>background(img);</code> in the <code>void draw()</code> , it works.</p>

<pre><code>PImage sourceImg;
int dw, dh;

void setup () {
  sourceImg = loadImage("test2.jpg");
  surface.setResizable(true);
  dw = sourceImg.width;
  dh = sourceImg.height;
  surface.setSize(dw, dh);
  background(sourceImg); //HERE IT GIVES ME THE ERROR
}

void draw() {
  //background(sourceImg); //HERE IT WORKS
}
</code></pre>

<p>I don't know how to fix this. I need the background image to be drawn one time at the start of the program. What does that error mean?</p>

<p>Thx in advance!</p>
]]></description>
   </item>
   <item>
      <title>How to set processing to automatically detect an image size and set it as a background?</title>
      <link>https://forum.processing.org/two/discussion/18033/how-to-set-processing-to-automatically-detect-an-image-size-and-set-it-as-a-background</link>
      <pubDate>Thu, 01 Sep 2016 14:42:54 +0000</pubDate>
      <dc:creator>testnia</dc:creator>
      <guid isPermaLink="false">18033@/two/discussions</guid>
      <description><![CDATA[<p>From my understanding, setting a background image in processing requires the size of the window to match the dimension of the image.</p>

<pre><code>PImage img = loadImage("background.jpg"); //a 100x100 background image.
size(100,100);
background(img);
</code></pre>

<p>However, since size() does not take in variables, how are we suppose to define a background with variable dimensions?</p>

<p>I have tested with the surface.setSize() function but it does not see to work.</p>

<p>Example:</p>

<pre><code>PImage img = loadImage("background.jpg"); //a 100x100 background image.
surface.setSize(img.width,img.height);
background(img);
</code></pre>
]]></description>
   </item>
   <item>
      <title>p5js texts look fuzzy</title>
      <link>https://forum.processing.org/two/discussion/17612/p5js-texts-look-fuzzy</link>
      <pubDate>Thu, 21 Jul 2016 20:44:04 +0000</pubDate>
      <dc:creator>jeriscc</dc:creator>
      <guid isPermaLink="false">17612@/two/discussions</guid>
      <description><![CDATA[<p>Hi everyone,</p>

<p>I'm trying to display some text in the p5js canvas but no matter what I do, the texts just look very fuzzy and distorted.  Taking the unrelated stuff away, here's my code for my text.</p>

<pre><code>var font;
var font_bold;

function preload() {
    font = loadFont('assets/fonts/Open_Sans/OpenSans-Regular.ttf');
    font_bold = loadFont('assets/fonts/Open_Sans/OpenSans-Bold.ttf');
}

function setup() {
    createCanvas(810, 620);
    //etc...
}

function draw() {
    graph(graphPoint[0], graphPoint[1], graphHeight, graphWidth);
}

function graph(graph_x,
    graph_y,
    graph_h,
    graph_w) {

    textFont(font_bold);
    fill(textColor);
    text("AffordanceViz", 30,
    40);
    textFont(font);
    textSize(20);
    // etc...
};
</code></pre>

<p>I'm really stuck, help would be greatly appreciated :)</p>

<p>Best,
-J</p>
]]></description>
   </item>
   <item>
      <title>Creating a background which fades trough all color values</title>
      <link>https://forum.processing.org/two/discussion/16506/creating-a-background-which-fades-trough-all-color-values</link>
      <pubDate>Mon, 09 May 2016 09:44:03 +0000</pubDate>
      <dc:creator>Bostro</dc:creator>
      <guid isPermaLink="false">16506@/two/discussions</guid>
      <description><![CDATA[<p>Hello everyone,
I am a beginner in processing and need some help :/
I am looking for a code that allows me to create a background which fades trough all color values.
I've already searched on google without any result, just some fades from black to white. After some experimets I wasnt able to create that kind of background with an smooth fade between different colors.
If anyone can come up with an easy, begginer friendly solution I would really apreciate it.</p>
]]></description>
   </item>
   <item>
      <title>Why does background() not clear the display here?</title>
      <link>https://forum.processing.org/two/discussion/15939/why-does-background-not-clear-the-display-here</link>
      <pubDate>Sat, 09 Apr 2016 19:16:33 +0000</pubDate>
      <dc:creator>colinmorris</dc:creator>
      <guid isPermaLink="false">15939@/two/discussions</guid>
      <description><![CDATA[<p>I've been searching for how to clear the display, and the standard answer seems to be <code>background()</code>. But this hasn't been working in my sketch. I think it's because I was doing manipulation of <code>pixels</code>. Here's a small example that illustrates:</p>

<pre><code>void setup() {
  size (600, 400);
  loadPixels();
  noStroke();
}

void draw() {
}

void circle_pixels(int cx, int cy, float rad, color c) {
  for (int x=0; x&lt;600; x++) {
    for (int y=0; y&lt;400; y++) {
      int idx = y*600+x;
      if (sq(x-cx) + sq(y-cy) &lt;= sq(rad)) {
        pixels[idx] = c;
      }
    }
  }
  updatePixels();
}

void circle(int cx, int cy, float rad, color c) {
  fill(c);
  ellipse(cx, cy, rad, rad);
}

void mouseClicked() {
  background(128);
  color rand_color = color(int(random(255)), int(random(255)), int(random(255)));
  // This doesn't work. Old circles stick around.
  circle_pixels(300, 200, random(300), rand_color);
  // This works. Only shows one circle at once.
  //circle(300, 200, random(300), rand_color);
}
</code></pre>

<p>Can someone help me understand the difference in behaviour here?</p>

<p>If I am doing pixel manipulation, is the recommended way to clear the display just to set <code>pixels[x,y]</code> to grey for each (x,y) coordinate?</p>
]]></description>
   </item>
   <item>
      <title>looking to detect drawn shapes</title>
      <link>https://forum.processing.org/two/discussion/15081/looking-to-detect-drawn-shapes</link>
      <pubDate>Tue, 23 Feb 2016 21:41:44 +0000</pubDate>
      <dc:creator>Jai</dc:creator>
      <guid isPermaLink="false">15081@/two/discussions</guid>
      <description><![CDATA[<p>hello guys i come from Daniel's video Processing Tutorial and i was talking to him on there about this topic i posted, so ill just post what i posted on his comment section as he advised me to do.</p>

<blockquote class="Quote">
  <p>looking for a algorithm that can detect what type of shape has or are being drawn in the window using the mouse? i would like to learn how to detect weather a circle has been drawn and if a line has been drawn from the middle of the screen? off set-it to either side of the screen on X or Y but starting in from home ? (middle of screen) "unless its a circle"</p>
  
  <p>i need to do some IF statements saying to do something IF any of those conditions has been made</p>
  
  <p>this is the code i came up with but some how its not working out for me what i wanted was for the background to be black and only turn red if i drag mouse to either side of the window "x" (left or right) and blue if i go to either side of the window "y" ( up or down ) i tried other logical operators such as || and &amp;&amp; NOPE no luck</p>
</blockquote>

<pre><code>void setup() {
size(800, 360);
}

void draw() {
background(0);

if (mouseX &gt; 499) {
background(255, 0, 0);

} else if (mouseX &gt; 299) {
background(255, 0, 0);

}

if (mouseY &gt; 266) {
background(0, 0, 255);

} else if (mouseY &gt; 100) {
background(0, 0, 255);

}


stroke(255);
line(300, 0, 300, height);// X Left
line(500, 0, 500, height);// X Right
line(-30000, 175, 30000, height);// Y Top
line(-30000, -175, 30000, height);// Y Bottom
}﻿  
</code></pre>

<p><img src="https://forum.processing.org/two/uploads/imageupload/714/KTSVEVHAFLH7.PNG" alt="Capture" title="Capture" /></p>
]]></description>
   </item>
   <item>
      <title>Set background during animation (noobie)</title>
      <link>https://forum.processing.org/two/discussion/14113/set-background-during-animation-noobie</link>
      <pubDate>Tue, 22 Dec 2015 14:27:55 +0000</pubDate>
      <dc:creator>DFRgth456</dc:creator>
      <guid isPermaLink="false">14113@/two/discussions</guid>
      <description><![CDATA[<p>Hello,</p>

<p>I am sure that this question has been ask before. I had really tried to dig in (forum, friends) but I am still stuck.
I think it is a very simple thing and more a misunderstanding.
By the way sorry about my poor english.</p>

<p>I'm doing an animation like a twill fabric machine. Two objects go and goes leaving a colored "string" behind. Right to left, top o bottom. The color can be set with 'b' and 'n'. We can freeze with a press mouse. 
All is perfectly fine, by I would like set the background by a key (here 'c' and 'v', black or white), but it does not work, the background seems to run over the previous drewn string.
I tried by placing a rectangle at level -1, float, Matrix etc. nothing is working. I think it is a lack of logic P5 comprehension
Thanks a lot, have a nice day</p>

<pre><code>int x;
int y;
int deplaceX;
int deplaceY;
int changementX = 1;
float fond = 255;
int v=585; //X
int w=585; //Y
int deplaceV;
int deplaceW;
int f;


void setup(){
  size(600,600); 
  noStroke(); 
 background(f); 
}

void draw(){
  smooth();

 if ( key == 'f')  {
  f = 255; 
}


//FOND

/*background(fond);
  fond = changementX;

  if ( key == 'v') {

 changementX= 255;
}

  if ( key == 'c')  {
  changementX = 0;
}*/


//FORMES
  if ( key == 'n') fill(random(100,250),0,0);
  if ( key == 'b') fill(0,0, random(170,250));
  ellipse(x, y, 15, 15);
  rect(v, w, 15, 15);



///DESCEND CERCLE

  x=x+deplaceX+3;
  w=w+deplaceW-3;

if (x&gt;width)
{deplaceX= -20; //retour
y=y+20; //à la ligne
}

if(x&lt;20)
{
 deplaceX=1;
}

///VERSGAUCHE CARRE

if (w&lt;1)
{deplaceW= 20;
v=v-20;
}

if(w&gt;560)
{
deplaceW=-1;
}



}

//COMMANDES SOURIS
void mousePressed() {
  noLoop();  
}

void mouseReleased() {
  loop(); 
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>How do I get rid of the white edges on these blurred ellipses?</title>
      <link>https://forum.processing.org/two/discussion/13817/how-do-i-get-rid-of-the-white-edges-on-these-blurred-ellipses</link>
      <pubDate>Mon, 07 Dec 2015 03:24:51 +0000</pubDate>
      <dc:creator>krashe1313</dc:creator>
      <guid isPermaLink="false">13817@/two/discussions</guid>
      <description><![CDATA[<p>So I'm working on a project that randomizes the color and placement of ellipses. Which works(?), based tweaking what I found in the Processing guides on their website. Problem is, if you look at the picture screen shot, where the circles overlap there is a white blurred edge rather than the color of one circle blurring into the next.</p>

<p>Any idea on how to fix this? Or do I need my eyes checked? Thanks!</p>

<pre><code>PImage cir;
    void setup() {
      size(400, 400);


      background(255);
      for(int x = 0; x &lt; 100; x++)
      {
        PGraphics pg = createGraphics(200,200);
        pg.beginDraw();
        pg.background(255,255,255,0);
        pg.fill(random(255), random(255), random(255));
        pg.noStroke();
        pg.ellipse(100,100,50,50);
        pg.filter(BLUR,5);
        pg.endDraw();
        cir = pg.get();
        imageMode(CENTER);
        image( cir, random(width), random(height));
       }
        println("done");
    }
    void draw() {

    }
</code></pre>

<p><img src="http://s21.postimg.org/n07lkzdfb/blurred_Circles.png" alt="" /></p>
]]></description>
   </item>
   </channel>
</rss>