# From Javascript P5 to Processing 3.x

**URL:** <https://discourse.processing.org/t/from-javascript-p5-to-processing-3-x/27399>\
**Category:** Coding Questions\
**Created:** [January 27, 2021, 5:58am UTC](https://discourse.processing.org/t/from-javascript-p5-to-processing-3-x/27399 "2021-01-27T05:58:48Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![HerClau](https://avatars.discourse-cdn.com/v4/letter/h/4bbf92/32.png) [@HerClau](https://discourse.processing.org/u/HerClau)\
**Post date:** [January 27, 2021, 10:36am UTC](https://discourse.processing.org/t/from-javascript-p5-to-processing-3-x/27399/5 "2021-01-27T10:36:13Z")

</div>

> [@GoToLoop](#):
>
> `for (int i = 0; i < time; posx[i] = map(i++, 0, time, 0, W));`

So far my progress:

~~  
final int W = 680, H = 200; // dimensions of canvas  
final int time = 400; // number of x tick values  
final int step = W/time; // time step

float data ; // to store number of infected people  
int count = 0; // steps counter  
int pos, fy, c, infected, colors, l, f;

void setup() {  
size(W, H);  
fill(255, 30, 70, 90);

// array containing the x positions of the line graph, scaled to fit the canvas  
//posx = Float32Array.from({ length: time }, (\_, i) =\> map(i, 0, time, 0, W));  
float posx = new float[time];  
for (int i = 0; i \< time; posx[i] = map(i++, 0, time, 0, W));

// function to map the number of infected people to a specific height (here the height of the canvas)  
fy = \_ =\> map(\_, 3, 0, H, 10);

// colors based on height stored in an array list.  
colors = d3.range(H).map(i =\> d3.interpolateWarm(norm(i, 0, H)))

}

```auto
I don't know how to translate the last two lines.
I do not understand them:
fy, is declared as in int
but I don't understand the oprarator "_"! which follows after the sign =.
and d3 is declared internally within void? !!
```

---

_[View the full topic](https://discourse.processing.org/t/from-javascript-p5-to-processing-3-x/27399)._
