Giter Site home page Giter Site logo

aframe-mss's Introduction

aframe-mss

Mixin Style Sheets: CSS for A-Frame.

logo

Usage

Declaratively declare mixins and components in a stylesheet form:

/* example.mss */

red {
  material {
    color: #393E51;
  }
}

white {
  material {
    color: #E9E6C9;
  }
}

blue {
  material {
    color: #566683;
  }
}

box {
  geometry {
    primitive: box;
  }
}

sphere {
  geometry {
    primitive: sphere;
  }
}

sky {
  geometry {
    primitive: sphere;
    radius: 5000;
    segmentsHeight: 20;
    segmentsWidth: 64;
  }
  material {
    shader: flat;
  }
  scale: -1 1 1;
}

left { position: -1 0 0; }
right { position: 1 0 0; }

Then import using <a-style> and use via mixins. <a-style> will parse the MSS and inject <a-mixin>s.

<html>
  <head>
    <title>My A-Frame Scene</title>
    <script src="https://aframe.io/releases/0.3.0/aframe.min.js"></script>
    <script src="https://rawgit.com/ngokevin/aframe-mss/master/dist/aframe-mss.min.js"></script>
  </head>

  <body>
    <a-scene>
      <a-assets>
        <a-style src="basic.mss"></a-style>
      </a-assets>

      <a-entity mixin="left red box"></a-entity>
      <a-entity mixin="right blue sphere"></a-entity>
      <a-entity mixin="white sky"></a-entity>
    </a-scene>
  </body>
</html>

aframe-mss's People

Contributors

ngokevin avatar

Stargazers

liasica avatar Mike Corbett avatar MJimRenman avatar Zachary Capalbo avatar Arttu Koskela avatar Paul Melero avatar Chris Dolphin avatar Joe Pea avatar Zetaphor avatar  avatar Karan Ganesan avatar Etienne Pinchon avatar Fabio Dias Rollo avatar Sashko avatar Ryan Eppers avatar Adnan Kičin avatar Andrés Cuervo avatar Mike avatar zreevaz avatar Gabriel avatar Christopher Van avatar Jonalex Herrera avatar Marko Kungla avatar Casper Fabricius avatar Aaron Faucher avatar Ryan avatar richardanaya2_2048b.Q6_K.gguf avatar Ben Pyrik avatar Andrew R McHugh avatar Conor Dalton avatar Slawomir Rodak avatar Dean H Slama Jr avatar

Watchers

 avatar Ryan Eppers avatar Jonalex Herrera avatar  avatar  avatar

aframe-mss's Issues

Directly modify entities using selectors

Define using selectors:

.ball {
  geometry { primitive: sphere; }
  material { color: orange; roughness: 1 }
}

Entity somehow takes into account these properties:

<a-entity class="ball"></a-entity>

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.