Git Product home page Git Product logo

Comments (1)

jorgelainfiesta avatar jorgelainfiesta commented on June 6, 2024

We merged #107 to solve this issue. But whether that is enough to close this issue is up for discussion.

The problem occurs because the canvas is drawn at specific dimensions when it's initialized. When FogBackground is inserted in the DOM, it draws the particles based on the current page size. We have no way to tell if the page has changes size to adjust the canvas animation.

We could somehow observe this change, perhaps using ResizeObserver or an heuristic (ie. updating the canvas size on route change or when the particles intensity changes).

However, there are two complexities. If the new area is bigger, there will be an uneven distribution of particles in the canvas on such change: the new canvas area will have to wait a few seconds for the particles to fill it. If the area is smaller, the position of some particles may become invalid and would require new calculations.

The current solution uses position: fixed to avoid this problem because the background moves with the scroll. It has some room for improvement to guarantee that there will be no space in which the background is rendered if the page grows. A side benefit it has is that it renders exactly what it needs, while adjusting the height of the canvas would render non-visible areas as well.

Whether we keep the position fixed or go for a more sophisticated solution depends, I'd say, on subtle differences in the user experience.

from breethe-client.

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.