Skip to content

Commit c774832

Browse files
committed
docs: add demo app
1 parent c79abfe commit c774832

File tree

16 files changed

+298
-1
lines changed

16 files changed

+298
-1
lines changed

apps/demo/.eslintrc.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"extends": ["../../.eslintrc.json"],
3+
"ignorePatterns": ["!**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts"],
7+
"rules": {
8+
"@angular-eslint/directive-selector": "off",
9+
"@angular-eslint/directive-class-suffix": "off",
10+
"@angular-eslint/component-selector": "off",
11+
"@angular-eslint/component-class-suffix": "off",
12+
"@typescript-eslint/no-empty-function": "off",
13+
"@typescript-eslint/ban-ts-comment": "off",
14+
"@typescript-eslint/no-explicit-any": "off",
15+
"@typescript-eslint/ban-types": "off",
16+
"@typescript-eslint/member-ordering": "off",
17+
"@typescript-eslint/no-non-null-assertion": "off"
18+
},
19+
"extends": ["plugin:@nrwl/nx/angular", "plugin:@angular-eslint/template/process-inline-templates"]
20+
},
21+
{
22+
"files": ["*.html"],
23+
"extends": ["plugin:@nrwl/nx/angular-template"],
24+
"rules": {}
25+
}
26+
]
27+
}

apps/demo/project.json

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"name": "demo",
3+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
4+
"projectType": "application",
5+
"sourceRoot": "apps/demo/src",
6+
"prefix": "demo",
7+
"targets": {
8+
"build": {
9+
"executor": "@angular-devkit/build-angular:browser",
10+
"outputs": ["{options.outputPath}"],
11+
"options": {
12+
"outputPath": "dist/apps/demo",
13+
"index": "apps/demo/src/index.html",
14+
"main": "apps/demo/src/main.ts",
15+
"polyfills": ["zone.js"],
16+
"tsConfig": "apps/demo/tsconfig.app.json",
17+
"assets": ["apps/demo/src/favicon.ico", "apps/demo/src/assets"],
18+
"styles": ["apps/demo/src/styles.css"],
19+
"scripts": []
20+
},
21+
"configurations": {
22+
"production": {
23+
"budgets": [
24+
{
25+
"type": "initial",
26+
"maximumWarning": "500kb",
27+
"maximumError": "1mb"
28+
},
29+
{
30+
"type": "anyComponentStyle",
31+
"maximumWarning": "2kb",
32+
"maximumError": "4kb"
33+
}
34+
],
35+
"outputHashing": "all"
36+
},
37+
"development": {
38+
"buildOptimizer": false,
39+
"optimization": false,
40+
"vendorChunk": true,
41+
"extractLicenses": false,
42+
"sourceMap": true,
43+
"namedChunks": true
44+
}
45+
},
46+
"defaultConfiguration": "production"
47+
},
48+
"serve": {
49+
"executor": "@angular-devkit/build-angular:dev-server",
50+
"configurations": {
51+
"production": {
52+
"browserTarget": "demo:build:production"
53+
},
54+
"development": {
55+
"browserTarget": "demo:build:development"
56+
}
57+
},
58+
"defaultConfiguration": "development"
59+
},
60+
"extract-i18n": {
61+
"executor": "@angular-devkit/build-angular:extract-i18n",
62+
"options": {
63+
"browserTarget": "demo:build"
64+
}
65+
},
66+
"lint": {
67+
"executor": "@nrwl/linter:eslint",
68+
"outputs": ["{options.outputFile}"],
69+
"options": {
70+
"lintFilePatterns": ["apps/demo/**/*.ts", "apps/demo/**/*.html"]
71+
}
72+
}
73+
},
74+
"tags": []
75+
}

apps/demo/src/app/app.component.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Component } from '@angular/core';
2+
import { RouterOutlet } from '@angular/router';
3+
4+
@Component({
5+
standalone: true,
6+
selector: 'demo-root',
7+
template: ` <router-outlet />`,
8+
imports: [RouterOutlet],
9+
})
10+
export class AppComponent { }

apps/demo/src/app/app.routes.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { Routes } from '@angular/router';
2+
3+
export const routes: Routes = [
4+
{ path: '', redirectTo: 'test', pathMatch: 'full' },
5+
{ path: 'test', loadComponent: () => import('./test/test.component') },
6+
];
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
2+
import { NgtArgs, NgtBeforeRenderEvent } from 'angular-three';
3+
4+
@Component({
5+
selector: 'demo-test-scene',
6+
standalone: true,
7+
template: `
8+
<ngt-mesh (beforeRender)="onBeforeRender($any($event))">
9+
<ngt-box-geometry *args="[2, 2, 2]" />
10+
<ngt-mesh-basic-material color="goldenrod" />
11+
</ngt-mesh>
12+
`,
13+
imports: [NgtArgs],
14+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
15+
})
16+
export class Scene {
17+
onBeforeRender({ object }: NgtBeforeRenderEvent<THREE.Mesh>) {
18+
object.rotation.x += 0.01;
19+
object.rotation.y += 0.01;
20+
}
21+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Component } from '@angular/core';
2+
import { NgtCanvas } from 'angular-three';
3+
import { Scene } from './scene.component';
4+
5+
@Component({
6+
selector: 'demo-test',
7+
standalone: true,
8+
template: `<ngt-canvas [scene]="Scene" />`,
9+
imports: [NgtCanvas],
10+
})
11+
export default class DemoTest {
12+
readonly Scene = Scene;
13+
}

apps/demo/src/assets/.gitkeep

Whitespace-only changes.

apps/demo/src/favicon.ico

14.7 KB
Binary file not shown.

apps/demo/src/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>Demo</title>
6+
<base href="/" />
7+
<meta name="viewport" content="width=device-width, initial-scale=1" />
8+
<link rel="icon" type="image/x-icon" href="favicon.ico" />
9+
</head>
10+
<body>
11+
<demo-root></demo-root>
12+
</body>
13+
</html>

apps/demo/src/main.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { bootstrapApplication } from '@angular/platform-browser';
2+
import { provideRouter } from '@angular/router';
3+
import { extend } from 'angular-three';
4+
import * as THREE from 'three';
5+
import { AppComponent } from './app/app.component';
6+
import { routes } from './app/app.routes';
7+
8+
extend(THREE);
9+
10+
bootstrapApplication(AppComponent, { providers: [provideRouter(routes)] }).catch((err) => console.error(err));

0 commit comments

Comments
 (0)