Giter Site home page Giter Site logo

afauch / aframe-mss Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ngokevin/aframe-mss

0.0 2.0 0.0 706 KB

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

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

License: MIT License

JavaScript 92.82% Lex 1.91% Yacc 4.99% CartoCSS 0.28%

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>

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.