CodingTrain / CodingTrain/Suggestion-Box

[Quantum Continuum]: Challenge - how to enable fill good function?

Open
#677 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
570
Forks
85
PR merge metrics
No merged PRs in 30d

Description

![](http://static.skaip.org/img/emoticons/180x180/f6fcff/rainbow.gif) ![](http://static.skaip.org/img/emoticons/180x180/f6fcff/rainbowsmile.gif)
### Good morning, Dear @shiffman! Good morning, Dear P5JS-citizens!

Let me ask some different alternatives regarding `"How to enable fill good function?"`

Here's my trial to solve it:

- [Live example of "fill good" function - https://gvitalie.github.io/demolution/hello/](https://gvitalie.github.io/demolution/hello/)
- [Code on GitHub - https://github.com/gvitalie/demolution/tree/gh-pages](https://github.com/gvitalie/demolution/tree/gh-pages)

> see line of code with `fill(good);`

```javascript
# sketch.js

function setup() {
createCanvas(windowWidth, windowHeight);
// frameRate(3);
rectMode(CENTER);
// noLoop();
}

function draw() {
background(127);

let step = 30;
for (let i = 0; i <= width; i += step){
for (let j = 0; j <= height; j += step){

// Enable fill(good) function.
let good = hups();
fill(good);
(round(random(0,1))) ? ellipse(i, j, step)
: rect(i, j, step, step);
}
}

}

// Fill good environment.
function hups(){
let c = [random(0, 255), random(0, 255), random(0, 255)];
return c
}

```

## The rezult:
_NOTE: Clicking on image below will open a Google Photos Shared Album_
[![](https://lh3.googleusercontent.com/cwKCnjj9FgBGOb5kjD9WnV5UwC8IK0qMK83c2aRRO9dDpmBiAKUELgBPqUvonAg8VZfAZ592Kd6Gdrv1wbvtBqIXUPVrGbggel7feLP3-ThrdJIWongxeRhnYNOeygtdgLETvhIhoAkRhImrykn2T1CcIGT4VkvMf0cdzOfYurM85zDJfXOlY7pdG8tVceo-Qhx8edFwm6p0tIyWUn0HlE3W36D-gNK08vQljSBG0vHBcXYgr1x4GfWrRGIAT7f-CoPxVvJXn7bp61bsdBsEFdKFnRccKHTpp5eor7eUhGAXRlNdIjmjQyrHQmtyoBaDxJ1P8ApN8L-NGcit4BdBbhUj1t1XRJ0bTGSY3A56rjI-fzGHdYjDA-mpsLeQA0F6XKybjmHzx5tpUhdRpV6VIDr3-hABlBT7VpOiB2Md7Znwmxnp7YsI4tzL9EAUti__ryL5EmOLj-GyDqyrRVnkoKmyB_AZIoR4F297mBEh5mltUdBEwyIZDW5IWj69FMA7LOGrgAnWGTveToOZDH0EjLpgifutaK93HflxaOoTC7iibdb_NyKbQ8G74T7EVsx7XUtyP-jpLGYEWP7HOMi9jyKPw9KzC3JTeuuOK5SVKA=w1280-h1024-no)](https://photos.app.goo.gl/k99UV77J3uyXZvCX2)

# Fill good - Picasso stylus

[Live demo example @ https://gvitalie.github.io/demolution/fillgood/](https://gvitalie.github.io/demolution/fillgood/)

```javascript
# sketch.js

function setup() {
createCanvas(windowWidth, windowHeight);
frameRate(5);
rectMode(CENTER);
// noLoop();
}

function draw() {
background(127);

let step = 30;
for (let i = 0; i <= width; i += step){
for (let j = 0; j <= height; j += step){

let good = hups();
stroke(good);
strokeWeight(random(10, 30));
(round(random(0, 1))) ? line(i, j, i + step, j + step)
: line(i, j + step, i + step, j);
}
}

}

function hups(){
let c = [random(0, 255), random(0, 255), random(0, 255)];
return c
}

```

![](https://lh3.googleusercontent.com/Lbvj7NZMnnwzV9y5cI7yEE65KP3asbsJUP_CF0ImMzFTs5Xpoig81G5AyNWXYjDoAXOJrzvqxbwBh06KytKfvaByZtY9xTA93yEGXQww_93t0nfPyjR4NWHlXVFoqCejvmDhh4eNSWRzgl7nPP9sr42kESuI3gfjOBvpYcp1M7rKz8q4fZEVrtksaE19gEuMD47Jwx5CRU2_lh4uekiMdyXdYLQxjkOf5n7Wc-jzSdha2CmHMCw3xDtkAr8ssjfv4vt0vb9oQOT6IBWe1de4cZWDrvh5K9a1nheEJueFb_gdOMLKmqauolU7ty-Ymnkdh_qmLVbYhPGvqzsAl60iWQljYzyBURR0o1a9zyKOVMpD_mGQwDBkRw6KQERxV21WNJcSnLJ2uVml0jTM5HOHZ8kofdUEDTkjZnZ1fLKxtt358vPdDlh0-xo72FZ9POJBLK3SLtPh2AwJNadovvl5AzN9hyfSm-N7en1qQSSZHEQxhK69wt7kMuPHTnBMslQXh5Z2LmfjwqQKok0CTvrvuJvMJdozeluuZT1LQF8S2IJOY19E7aqO3HAgsQAVuAJ0THlO-_YAMPVEg2bYMe-AXjncxgryvIDCzuB1MAiuPADPg5FO3TLWPI9ifVLVy7UtdvrGI9VZPk4ID3Do6Hl1eJIN8L47stGvQfA=w1280-h1024-no)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.