ngokevin / aframe-mss

:womans_hat: Mixin Style Sheets: CSS for A-Frame.

Home Page:https://ngokevin.github.io/aframe-mss/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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>

About

:womans_hat: Mixin Style Sheets: CSS for A-Frame.

https://ngokevin.github.io/aframe-mss/

License:MIT License


Languages

Language:JavaScript 92.8%Language:Yacc 5.0%Language:Lex 1.9%Language:CartoCSS 0.3%