Coder Social home page Coder Social logo

Comments (8)

CubeOfCheese avatar CubeOfCheese commented on April 16, 2024 1

You accidentally posted your sketch.js twice instead of your raindrop class.
I think you might be able to work around this by pushing and popping your raindrop object to an array and drawing that array. I also opened an issue that worked in the p5 online simulator, so maybe our problems are related.

from react.

F-Moody avatar F-Moody commented on April 16, 2024

Thanks! fixed that.

from react.

CubeOfCheese avatar CubeOfCheese commented on April 16, 2024

I am running into the same problem as you are now and I tested my suggestion of using an array, but I realized that it does not have any effect. What is interesting is that they are not all independent objects, they are only left over images of where the object used to be.

from react.

CubeOfCheese avatar CubeOfCheese commented on April 16, 2024

I believe that this is not only a problem with objects but also regular p5 drawings such as in this example.
p5.draw = function () { p5.ellipse(p5.mouseX, p5.mouseY, 30); }
Rather than having a circle follow my mouse as it should, it leaves a trail of circles as shown here.

Screen Shot 2019-07-08 at 4 18 58 PM

from react.

and-who avatar and-who commented on April 16, 2024

Question, do you clear the FrameBuffer on the beginning of the new draw cycle?
e.g. with setting the Background?
https://github.com/and-who/react-p5-wrapper/blob/2275f7972522b8b6a449a5cea2e1a79e9acb5d3b/example/src/sketches/sketch.js#L15

from react.

F-Moody avatar F-Moody commented on April 16, 2024

Funny enough, i've just tried that and it works now.
Can you explain me why?

from react.

and-who avatar and-who commented on April 16, 2024

I assume the following, since it works in other GraphicSystems similar.

p5 stores the calculated Image in an FrameBuffer.
To clear the Frame Buffer would be additional operations, so why not keep it, because you could use it in your next Frame.

I actually have an Example how you could use it :D
On my Webpage I create a nice Effect by drawing with some Transparency over my last rendered image and moving the circles a bit:
http://wolfandreas.com/

from react.

CubeOfCheese avatar CubeOfCheese commented on April 16, 2024

Wow! Thank you. I think this issue can be closed now. This makes total sense now.

from react.

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.