Coder Social home page Coder Social logo

yalinerkaya / angular-template-for-threejs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from makimenko/angular-template-for-threejs

0.0 0.0 0.0 121.28 MB

Angular Template For Three.js

Home Page: https://makimenko.github.io/angular-template-for-threejs/storybook

License: MIT License

JavaScript 0.81% TypeScript 98.39% HTML 0.72% SCSS 0.09%

angular-template-for-threejs's Introduction

GitHub repo CI build status Known Vulnerabilities Code coverage by codecov.io npm version Storybook link

Angular Template For Three.js (atft)

Leverage Three.js in your Angular app using simple components:

<atft-orbit-controls [rotateSpeed]=1 [zoomSpeed]=1.2>
  <atft-renderer-canvas>
    <atft-perspective-camera
      [fov]=60 [near]=1 [far]=1100
      positionX=20 [positionY]=50 [positionZ]=50>
    </atft-perspective-camera>
    <atft-scene>
      <atft-axes-helper [size]=200></atft-axes-helper>
      <atft-grid-helper [size]=100 [divisions]=10></atft-grid-helper>
    </atft-scene>
  </atft-renderer-canvas>
</atft-orbit-controls>

Storybook

Explore provided Angular components in isolation!

Click below to see the demo in a web browser:

Goals of this repo

  • Implement npm atft library
    • Bindings for Three.js
    • SceneComponent with basic usage of scene, camera, lights, helpers, renderer
    • Integrated Three.js examples as components (e.g. OrbitControls, OBJLoader, ObjectLoader)
  • Develop and test library components in isolation via Storybook

Usage in your Angular project

  1. Set up an Angular project and install dependencies:

    npm i three dagre atft yaml --save
    npm i @types/dagre @types/three --save-dev
    
  2. Import library into your module:

    import { AtftModule } from 'atft';
    ...
      imports: [
        ...
        AtftModule
      ]
     ...
  3. Use atft library components in src/app.component.html:

    <atft-orbit-controls [rotateSpeed]=1 [zoomSpeed]=1.2>
      <atft-renderer-canvas #mainRenderer>
        <atft-perspective-camera
          [fov]=60 [near]=1 [far]=1100
          [positionX]=20 [positionY]=50 [positionZ]=50>
        </atft-perspective-camera>
        <atft-scene>
          <atft-axes-helper [size]=200></atft-axes-helper>
          <atft-grid-helper [size]=100 [divisions]=10></atft-grid-helper>
        </atft-scene>
      </atft-renderer-canvas>
    </atft-orbit-controls>
  4. (optionally) if you want to fit 3D scene canvas into entire screen (horizontally and vertically):

    in src/styles.css:

     html, body {
         height: 100%;
         margin: 0;
     }  

    in src/app/app.component.css:

     :host {
         height: 100%;
         display: flex;
     } 

Used by

Sample vect project, which is based on atft library:

Development

Build Library

  1. git clone https://github.com/makimenko/angular-template-for-threejs.git
  2. npm install
  3. ng build atft

Run Tests

  • npm test

Run Storybook

Run and watch locally: npm run storybook

Our storybook config is in ./storybook and our stories in ./src/stories. See the official Storybook.js documentation for more information.

API Documentation

For mode details see API documentation

Release and Changelog

To automatically generate changelog and bump atft version:

npm run release

Contributors

Feel free to join us! Just submit your ideas via pull-requests :)

angular-template-for-threejs's People

Contributors

makimenko avatar snyk-bot avatar greenkeeper[bot] avatar comfreek avatar alexx855 avatar dependabot[bot] avatar serthys avatar esanya avatar codacy-badger 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.