GithubHelp home page GithubHelp logo

joshskeen / aframe-star-system-component Goto Github PK

View Code? Open in Web Editor NEW

This project forked from handeyeco/aframe-star-system-component

0.0 1.0 0.0 54 KB

Quick way to add stars to an A-Frame project

Home Page: https://matthewbryancurtis.github.io/aframe-star-system-component/

License: ISC License

HTML 13.70% JavaScript 86.30%

aframe-star-system-component's Introduction

Quick way to add stars to your A-Frame project

screenshot

Basic Usage

Getting started is easy, just import A-Frame and Star-System:

<!DOCTYPE html>
<html>
<head>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/aframe/0.6.1/aframe-master.js"></script>
    <script src="https://cdn.rawgit.com/matthewbryancurtis/aframe-star-system-component/db4f1030/index.js"></script>
</head>
<body>
    <a-scene>
        <a-sky color="black"></a-sky>
        <a-entity star-system></a-entity>
    </a-scene>
</body>
</html>

If things get bogged down, you may try less particles (stars):

<a-entity star-system="count: 1000; radius: 250; depth: 0"></a-entity>

But you also might want to try more:

<a-entity star-system="count: 100000"></a-entity>

Or offset the sphere of stars:

<a-entity position="0 0 -250" star-system></a-entity>

If for some reason square stars bother you, you can use a custom image to replace the stars:

<a-entity star-system="texture: https://cdn.rawgit.com/matthewbryancurtis/aframe-star-system-component/master/assets/star.svg"></a-entity>

Demo

Demo Link

Demo code:

<!DOCTYPE html>
<html>
<head>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/aframe/0.6.1/aframe-master.js"></script>
    <script src="https://cdn.rawgit.com/matthewbryancurtis/aframe-star-system-component/db4f1030/index.js"></script>
</head>
<body>
    <a-scene>
        <a-sky color="black"></a-sky>
        <a-entity star-system></a-entity>
    </a-scene>
</body>
</html>

Properties

The way this works is it creates a bunch of particles (stars) in THREE. The particles are randomly placed between two spheres: sphere of radius 'radius' and sphere of radius 'radius + depth'. You can also load a custom sprite to replace the squares that THREE.PointsMaterial() makes.

Property Type Default Description
color String '#FFF' Color of the star particles
radius Number 300 Distance from center of sphere to inner star sphere
depth Number 300 Distance between inner sphere and outer sphere
size Number 1 Size of each individual star
count Number 10000 Number of total stars created
texture Asset '' Sprite used for individual stars (ex: PNG image)

Random Links

aframe-star-system-component's People

Watchers

 avatar

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.