whs.js icon indicating copy to clipboard operation
whs.js copied to clipboard

Angular Module

Open looading opened this issue 7 years ago • 8 comments

Describe your issue here.

Do you have any plan to provide a Angular moudle?

Version:
  • [x] v2.x.x
  • [ ] v1.x.x
Issue type:
  • [ ] Bug
  • [ ] Proposal/Enhancement
  • [x] Question
  • [ ] Discussion

Tested on:
Desktop
  • [ ] Chrome
  • [ ] Chrome Canary
  • [ ] Chrome dev-channel
  • [ ] Firefox
  • [ ] Opera
  • [ ] Microsoft IE
  • [ ] Microsoft Edge
Android
  • [ ] Chrome
  • [ ] Firefox
  • [ ] Opera
IOS
  • [ ] Chrome
  • [ ] Firefox
  • [ ] Opera

looading avatar Sep 22 '17 02:09 looading

@looading what should it do?

sasha240100 avatar Sep 22 '17 11:09 sasha240100

An angular module? Angular is based on live HTML editing through the change of variables. That should be something done entirely on your side, it's pretty much unrelated to 3D WebGL. DatGUI Does the same thing with a little bit of a twist. I don't understand why you would want an Angular module, please clarify.

noahcoetsee avatar Sep 22 '17 13:09 noahcoetsee

Inspired by the react-whs project, why don`t we integrate Angular and WHS? Then I thought for a moment. whether we can simply package Core/Components/Modules of the WHS into Components/Directive/Service of the Angular. Pack those int to a Angular Modules, like ng-whs.

Then. for example, if we want to create an 3D sence in a Angular Component.

  1. import module
// app.moudls.ts
import { NgWhsModule } from 'ng-whs';

...

@NgModule({
    imports: [
        NgWhsModule,
        ...
    ],
    ...
})
export class AppModule {}
  1. use ng-whs
<!-- app.component.html -->
<whs-container
    [scene]='scene'
    [camera]='camera'
    >
    <Sphere
        [geometry]='geometry'
        ...
        ></Sphere>
    <BasicSphere
        [position]='position'
        ...
        ></BasicSphere>
    <Line
        [material]='material'
        ...
        ></Line>
</whs-container>
// app.component.ts
import { Component, OnInit } from '@angular/core';
import { WhsService, Sence } from 'ng-whs';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: './app.component.scss',
})
export class AppComponent implements OnInit {
    
    public scene: Sence;
    ...
    
    constructor(private whs: WhsService) {
    }
    
    ngOnInit() {
        this.sence = this.whs.createSence();
        ...
    }
}
  1. done

At last,ng developers may only need to spend very little time to create an 3D sence which they want.

write less, more simple and more intuitive. I think it`s cool.

looading avatar Sep 25 '17 02:09 looading

@looading I've got the idea now. Yes, that can be done as separate open source project on github. Would you like to start the development? We can guarantee you support during the development

sasha240100 avatar Sep 25 '17 17:09 sasha240100

@sasha240100 Ok, i will start the development a few days later. Before that, i will do more research.

looading avatar Sep 26 '17 02:09 looading

@looading From your issue, I get the impression that you already have whs working within ng. I'm trying to do the same, but am a bit puzzled on how to approach this. Do you have a working example ?

meronbrouwer avatar Sep 27 '17 18:09 meronbrouwer

@meronbrouwer There are no examples available online at the moment.But, you can open a new issue to discuss your puzzles in detaild.

looading avatar Sep 28 '17 01:09 looading

@looading thanks for the reply. I'll create a new issue if I bump into new problems.

meronbrouwer avatar Sep 28 '17 09:09 meronbrouwer