# Transparency in background Processing vs P5.js

**URL:** <https://discourse.processing.org/t/transparency-in-background-processing-vs-p5-js/40570>\
**Category:** Coding Questions\
**Created:** [January 12, 2023, 11:01pm UTC](https://discourse.processing.org/t/transparency-in-background-processing-vs-p5-js/40570 "2023-01-12T23:01:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![adrinalino](https://avatars.discourse-cdn.com/v4/letter/a/34f0e0/32.png) [@adrinalino](https://discourse.processing.org/u/adrinalino)\
**Post date:** [January 12, 2023, 11:01pm UTC](https://discourse.processing.org/t/transparency-in-background-processing-vs-p5-js/40570/1 "2023-01-12T23:01:08Z")

</div>

Hi there,  
I wanted my moving particles to leave a trail.  
In “The coding train” I noticed that this can me done in P5.js by calling “background(0,20);”  
20 Being the transparency of the background.  
This does not work in Processing. Can this be solved in another way?  
Another way of leaving a trail is by storing the last positions in an array and draw them again but that would make my program slow.

code in P5.js leaving a trail :  
var x = 0.0;  
var y = 0.0;  
function setup () {  
createCanvas(900, 900);  
noStroke();  
}

function draw() {  
background(0, 20);  
x += 1;  
y += 1;

fill(255);  
circle (x, y, 10);  
}

code in Processing leaving no trail :  
float x = 0.0;  
float y = 0.0;  
void setup () {  
size(900, 900);  
noStroke();  
}

void draw() {  
background(0,0,0,20);  
x += 1;  
y += 1;

fill(255);  
circle (x, y, 10);  
}

Thanks in advance.  
Cheers,  
Adrian.

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [January 12, 2023, 11:03pm UTC](https://discourse.processing.org/t/transparency-in-background-processing-vs-p5-js/40570/2 "2023-01-12T23:03:23Z")

</div>

> [@adrinalino](#):
>
> This does not work in Processing. Can this be solved in another way?

Maybe use **fill()** + **rect()**? 🤷‍♂️
