javascript - p5.js Shape Adjustments Leaving Previous Outlines Visible -


i trying adjust shape of object using value derived slider on screen using p5.js.

the issue having outline of drawn shapes remain, giving after-trail effect.

i have tried nostroke() modifier not draw shape. nofill() gives weirder, yet still incorrect, behavoir.

code example: https://codepen.io/galleywest/pen/oejxyy

var slider  function setup() {   createcanvas(600, 600)   slider = createslider(0, 50, 0) }  function draw() {   rect(10, 10, 80, 80, slider.value()) } 

how can mitigate behavior?

you need call background() function clear out old frames.

var slider  function setup() {   createcanvas(600, 600)   slider = createslider(0, 50, 0) }  function draw() {   background(255, 0, 0); //draws red background   rect(10, 10, 80, 80, slider.value()) } 

more info can found in the reference.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -