Giter VIP home page Giter VIP logo

space-2d's People

Contributors

wwwtyro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

space-2d's Issues

[Feature request] Transparent background

It could be good to have the white dots of the stars and the nebulae and everything to be generated on a transparent bachground, instead of a black background. That way, you can generate two starscapes and make them move at different speeds, to create a parallax effect.

Download canvas image onclick

Not really an issue. But not sure where else I could write this.

I wanted to use your script to create space wallpapers for myself.

Since the canvas context is webgl I needed to preserve the drawing buffer. Otherwise the canvas blob will be blank.

//addition to the canvas settings in bundle.js
var canvas = document.getElementById('render-canvas');
var glContextAttributes = { preserveDrawingBuffer: true };
var gl = canvas.getContext("experimental-webgl", glContextAttributes);
canvas.width = 2560; //window.innerWidth - (300 + 16 + 16 + 16);
canvas.height = 1440; //window.innerHeight - (16 + 16);

I rerender the image by reloading the browser. Maybe you find a better solution that makes the preserveDrawingBuffer work with the gui redraw.

//download img as png on canvas click
  (function() {
    var canvas = document.querySelector("#render-canvas");
    var uri;
    canvas.onclick = function(evt) {
      evt.preventDefault();
      canvas.toBlob(function(blob) {
        if(uri)
          (window.URL||window.webkitURL).revokeObjectURL(uri);
        uri = (window.URL||window.webkitURL).createObjectURL(blob);
        var a = document.createElement('a');
        a.href = uri;
        a.download="stars.png";
        document.body.appendChild(a);
        a.onclick = function(evt) { this.parentNode.removeChild(this); }
        a.click();
      });
    }
  })();

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.