Skip to content

Commit ffe0275

Browse files
committed
float story
1 parent 0ea3280 commit ffe0275

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import { CUSTOM_ELEMENTS_SCHEMA, Component, Input } from '@angular/core';
2+
import { NgtArgs } from 'angular-three';
3+
import { NgtsFloat, type NgtsFloatState } from 'angular-three-soba/staging';
4+
import * as THREE from 'three';
5+
import { makeDecorators, makeStoryObject, number } from '../setup-canvas';
6+
7+
@Component({
8+
standalone: true,
9+
template: `
10+
<ngts-float
11+
[position]="[0, 1.1, 0]"
12+
[rotation]="[Math.PI / 3.5, 0, 0]"
13+
[floatingRange]="floatingRange"
14+
[floatIntensity]="floatIntensity"
15+
[rotationIntensity]="rotationIntensity"
16+
[speed]="speed"
17+
>
18+
<ngt-mesh>
19+
<ngt-box-geometry *args="[2, 2, 2]" />
20+
<ngt-mesh-standard-material [wireframe]="true" color="white" />
21+
</ngt-mesh>
22+
</ngts-float>
23+
24+
<ngt-mesh [position]="[0, -6, 0]" [rotation]="[Math.PI / -2, 0, 0]">
25+
<ngt-plane-geometry *args="[200, 200, 75, 75]" />
26+
<ngt-mesh-basic-material [wireframe]="true" color="red" [side]="DoubleSide" />
27+
</ngt-mesh>
28+
`,
29+
imports: [NgtsFloat, NgtArgs],
30+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
31+
})
32+
class DefaultFloatStory {
33+
Math = Math;
34+
DoubleSide = THREE.DoubleSide;
35+
36+
@Input() floatingRange: NgtsFloatState['floatingRange'] = [undefined, 1];
37+
@Input() floatIntensity: NgtsFloatState['floatIntensity'] = 2;
38+
@Input() rotationIntensity: NgtsFloatState['rotationIntensity'] = 4;
39+
@Input() speed: NgtsFloatState['speed'] = 5;
40+
}
41+
42+
export default {
43+
title: 'Staging/Float',
44+
decorators: makeDecorators(),
45+
};
46+
47+
export const Default = makeStoryObject(DefaultFloatStory, {
48+
canvasOptions: { camera: { position: [0, 0, 10] } },
49+
argsOptions: {
50+
floatingRange: [number(0), number(1)],
51+
floatIntensity: number(2),
52+
rotationIntensity: number(4),
53+
speed: number(5),
54+
},
55+
});

0 commit comments

Comments
 (0)