Giter Site home page Giter Site logo

coreyshuman / constellation Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 2.0 880 KB

A configurable physics-based animation in JavaScript which can produce many designs and effects, including constellation-like star fields. You can interact with the animation using the mouse or multiple touch points on touch devices.

License: GNU Lesser General Public License v3.0

JavaScript 100.00%

constellation's Introduction

Constellation

Constellation Banner Image

A configurable physics-based animation in JavaScript which can produce many designs and effects, including constellation-like star fields. You can interact with the animation using the mouse or multiple touch points on touch devices.

View a demo here: https://coreyshuman.github.io/Constellation/demo

Demo Collage

Example Usage:

<html>
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      #canvasdiv {
        height: 100%;
      }
    </style>
  </head>
  <body>
    <div id="canvasdiv"></div>
    <script src="constellation.js"></script>
    <script type="text/javascript">
      (function () {
        var constellation = new Constellation({
          canvasContainer: "canvasdiv",
        });
        constellation.init();
        constellation.start();
      })();
    </script>
  </body>
</html>

License

This source code is licensed under the GNU Lesser General Public License v3.0.

Summary of the license terms, per choosealicense.com:

GNU LGPLv3

Permissions of this copyleft license are conditioned on making available complete source code of licensed works and modifications under the same license or the GNU GPLv3. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. However, a larger work using the licensed work through interfaces provided by the licensed work may be distributed under different terms and without source code for the larger work.

Review the included LICENSE file for full license terms.

constellation's People

Contributors

coreyshuman avatar

Stargazers

Elanna Grossman avatar Jackson R avatar

Watchers

James Cloos avatar  avatar  avatar

constellation's Issues

Touch events conflict with mobile browser built-in motions

Swiping actions in the demo conflict with browser actions, especially in chrome. For example:

  • Swiping right to open menu drawer also triggers "go back" action
  • Swiping down triggers "refresh" action
  • Swiping up triggers scroll even when not selecting the menu drawer

The usage of event.preventDefault() doesn't address the issue and triggers an error:

[Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive. See <URL>

Queued line draw are significantly slower in Firefox (Gecko)

Queued line draw performance in Gecko:
FPS: 7
image

Non-queued line draw performance in Gecko:
FPS: 62
image

Comparison: queued line draw performance in Chrome (V8):
FPS: 237
image

Comparison: non-queued line draw performance in Chrome (V8):
FPS: 150
image

Code

Most time appears to be spent in the 'moveTo()' function call here:

ctx.moveTo(line.x1, line.y1);

Possible solutions

  • Select queue or non-queued based on browser (accurate browser detection becomes a maintenance issue)
  • Troubleshoot/research moveTo() performance in Gecko and work on alternative implementation or submit fix upstream.

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.