Git Product home page Git Product logo

Comments (7)

abhikpal avatar abhikpal commented on May 29, 2024

Thanks for reporting this! I can reproduce this on my machine.. so I'll take a look : )

from p5.

gotham13 avatar gotham13 commented on May 29, 2024

@abhikpal I found the source of this problem. This line is resetting the background color.

renderer.background_color = prev_background_color

from p5.

gotham13 avatar gotham13 commented on May 29, 2024

commenting this out keeps the background color but I dont know the use of this line, Its probably important

from p5.

vaishnavsm avatar vaishnavsm commented on May 29, 2024

The function background() does not, in fact, set a background color or image. It instead draws the background or image once and resets all the parameters, as the push_style context manager is used.
This is (apparently) required for images, and has been maintained for colors, probably for consistency in working.

This is probably not the intended behavior from the code, though, as is clear from the docstring and the renderer.background_color = background_color.normalized line.

Sending a fix.

from p5.

Awerito avatar Awerito commented on May 29, 2024

commenting this out keeps the background color but I dont know the use of this line, Its probably important

I comment that line and the background is fix but everything else draw in setup slill being erased when I draw something in the draw loop

from p5.

CodeCox avatar CodeCox commented on May 29, 2024

still an issue in v0.7.1

What's the status on this?
(A PR was merged a while back but the the issue is still open?)

from p5.

Skerminkel avatar Skerminkel commented on May 29, 2024

Still hasn't been sorted out, but I found a workaround for anyone searching for this problem.

Instead of setting your background in setup, do it once in draw (I just use an if statement). I don't know if this will mess with images, but it works if you just want to change your background at least.

from p5.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.