three-low-poly 0.9.21 → 0.9.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -1
- package/dist/index.cjs +356 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +580 -63
- package/dist/index.iife.js +79 -10
- package/dist/index.iife.js.map +1 -1
- package/dist/index.mjs +5695 -0
- package/dist/index.mjs.map +1 -0
- package/dist/uv-grid.jpg +0 -0
- package/package.json +17 -19
- package/dist/index.cjs.js +0 -287
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.es.js +0 -5147
- package/dist/index.es.js.map +0 -1
- package/dist/index.umd.js +0 -287
- package/dist/index.umd.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { BufferGeometry } from 'three';
|
|
|
3
3
|
import { Camera } from 'three';
|
|
4
4
|
import { Color } from 'three';
|
|
5
5
|
import { DataTexture } from 'three';
|
|
6
|
+
import { ExtrudeGeometry } from 'three';
|
|
6
7
|
import { Group } from 'three';
|
|
7
8
|
import { InstancedMesh } from 'three';
|
|
8
9
|
import { Light } from 'three';
|
|
@@ -18,10 +19,50 @@ import { PerspectiveCamera } from 'three';
|
|
|
18
19
|
import { ShaderMaterial } from 'three';
|
|
19
20
|
import { Shape } from 'three';
|
|
20
21
|
import { SphereGeometry } from 'three';
|
|
22
|
+
import * as THREE from 'three';
|
|
21
23
|
import { Uniform } from 'three';
|
|
22
24
|
import { Vector2 } from 'three';
|
|
23
25
|
import { Vector3 } from 'three';
|
|
24
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Shader modification to support instance-specific colors.
|
|
29
|
+
* This function modifies the provided material to accept instance-specific colors.
|
|
30
|
+
*
|
|
31
|
+
* This is not generally necessary for materials that already support vertex colors,
|
|
32
|
+
* but it can be useful for custom materials or when using InstancedMesh.
|
|
33
|
+
*
|
|
34
|
+
* Instanced meshes already allow for per-instance colors, implemented as:
|
|
35
|
+
* ```ts
|
|
36
|
+
* const colors = new Float32Array(instancedMesh.count * 3);
|
|
37
|
+
* for (let i = 0; i < instancedMesh.count; i++) {
|
|
38
|
+
* const [r, g, b] = [Math.random(), Math.random(), Math.random()];
|
|
39
|
+
* colors.set([r, g, b], i * 3); // Normalized to [0, 1]
|
|
40
|
+
* }
|
|
41
|
+
* instancedMesh.instanceColor = new THREE.InstancedBufferAttribute(colors, 3);
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* Example usage:
|
|
45
|
+
* ```ts
|
|
46
|
+
* // Material
|
|
47
|
+
* const material = new THREE.MeshStandardMaterial();
|
|
48
|
+
*
|
|
49
|
+
* // Add instance color modifier
|
|
50
|
+
* addInstanceColor(material);
|
|
51
|
+
*
|
|
52
|
+
* // RGB color for each instance
|
|
53
|
+
* const colors = new Float32Array(instancedMesh.count * 3);
|
|
54
|
+
* for (let i = 0; i < instancedMesh.count; i++) {
|
|
55
|
+
* getAnalogousColors(hue).forEach((color, index) => {
|
|
56
|
+
* colors[i * 3 + index] = color / 0xff;
|
|
57
|
+
* });
|
|
58
|
+
* }
|
|
59
|
+
*
|
|
60
|
+
* // Add the instance color attribute to the geometry
|
|
61
|
+
* instancedMesh.geometry.setAttribute("instanceColor", new THREE.InstancedBufferAttribute(colors, 3));
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare function addInstanceColor(material: Material): Material;
|
|
65
|
+
|
|
25
66
|
/**
|
|
26
67
|
* Utility function to add noise-based vertex displacement to an existing Three.js material.
|
|
27
68
|
* @param {Material} material - The material to mutate, e.g., MeshStandardMaterial.
|
|
@@ -350,6 +391,15 @@ export declare class BifurcatedStaircaseGeometry extends BufferGeometry {
|
|
|
350
391
|
constructor(stepWidth?: number, stepHeight?: number, stepDepth?: number, numStepsCentral?: number, numStepsBranch?: number, branchAngle?: number);
|
|
351
392
|
}
|
|
352
393
|
|
|
394
|
+
declare interface BloomTransitionOptions extends SceneTransitionFXOptions {
|
|
395
|
+
maxBloom?: number;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
declare interface BlurTransitionOptions extends SceneTransitionFXOptions {
|
|
399
|
+
maxBlur?: number;
|
|
400
|
+
kernelSize?: number;
|
|
401
|
+
}
|
|
402
|
+
|
|
353
403
|
export declare class Bone extends Mesh<BoneGeometry, MeshStandardMaterial> {
|
|
354
404
|
constructor();
|
|
355
405
|
}
|
|
@@ -464,6 +514,18 @@ export declare class BunsenBurner extends Group {
|
|
|
464
514
|
}
|
|
465
515
|
|
|
466
516
|
export declare class Burst extends Mesh {
|
|
517
|
+
constructor({ sides, innerRadius, outerRadius, depth }?: {
|
|
518
|
+
sides?: number | undefined;
|
|
519
|
+
innerRadius?: number | undefined;
|
|
520
|
+
outerRadius?: number | undefined;
|
|
521
|
+
depth?: number | undefined;
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Extrude geometry of Burst Shape.
|
|
527
|
+
*/
|
|
528
|
+
export declare class BurstGeometry extends ExtrudeGeometry {
|
|
467
529
|
constructor(sides?: number, innerRadius?: number, outerRadius?: number, depth?: number);
|
|
468
530
|
}
|
|
469
531
|
|
|
@@ -528,7 +590,7 @@ export declare function calculateYFromSlopeIntercept(x1: number, y1: number, x2:
|
|
|
528
590
|
*
|
|
529
591
|
* Example:
|
|
530
592
|
* ```
|
|
531
|
-
*
|
|
593
|
+
* cameraDollyAnimation(camera, 5, 3000, () => {
|
|
532
594
|
* console.log("Dolly animation complete");
|
|
533
595
|
* });
|
|
534
596
|
* ```
|
|
@@ -540,7 +602,7 @@ export declare function cameraDollyAnimation(camera: Camera, distance: number, d
|
|
|
540
602
|
*
|
|
541
603
|
* Example:
|
|
542
604
|
* ```
|
|
543
|
-
*
|
|
605
|
+
* cameraFlythroughAnimation(
|
|
544
606
|
* camera,
|
|
545
607
|
* [
|
|
546
608
|
* new THREE.Vector3(0, 5, 5),
|
|
@@ -561,7 +623,7 @@ export declare function cameraFlythroughAnimation(camera: Camera, waypoints: Vec
|
|
|
561
623
|
*
|
|
562
624
|
* Example:
|
|
563
625
|
* ```
|
|
564
|
-
*
|
|
626
|
+
* cameraOrbitAnimation(camera, new THREE.Vector3(0, 0, 0), 10, 5000, () => {
|
|
565
627
|
* console.log("Orbit animation complete");
|
|
566
628
|
* });
|
|
567
629
|
* ```
|
|
@@ -573,7 +635,7 @@ export declare function cameraOrbitAnimation(camera: Camera, target: Vector3, ra
|
|
|
573
635
|
*
|
|
574
636
|
* Example:
|
|
575
637
|
* ```
|
|
576
|
-
*
|
|
638
|
+
* cameraPendulumAnimation(camera, new THREE.Vector3(0, 5, 5), 0.5, 9000, 3, () => {
|
|
577
639
|
* console.log("Pendulum animation complete");
|
|
578
640
|
* });
|
|
579
641
|
* ```
|
|
@@ -585,19 +647,100 @@ export declare function cameraPendulumAnimation(camera: Camera, center: Vector3,
|
|
|
585
647
|
*
|
|
586
648
|
* Example:
|
|
587
649
|
* ```
|
|
588
|
-
*
|
|
650
|
+
* cameraSpiralAscensionAnimation(camera, new THREE.Vector3(0, 0, 0), 10, 300, 7, 12000, () => {
|
|
589
651
|
* console.log("Spiral ascension animation complete");
|
|
590
652
|
* });
|
|
591
653
|
* ```
|
|
592
654
|
*/
|
|
593
655
|
export declare function cameraSpiralAscensionAnimation(camera: Camera, center: Vector3, radius: number, height: number, revolutions: number, duration: number, onComplete?: () => void): void;
|
|
594
656
|
|
|
657
|
+
/**
|
|
658
|
+
* CameraTransition provides smooth animated transitions between perspective and orthographic cameras.
|
|
659
|
+
*
|
|
660
|
+
* The transition works by rendering both camera views to separate render targets and blending between them.
|
|
661
|
+
* This provides a true, accurate transition between the two camera types.
|
|
662
|
+
*
|
|
663
|
+
* @example
|
|
664
|
+
* ```typescript
|
|
665
|
+
* const transition = new CameraTransition(
|
|
666
|
+
* perspectiveCamera,
|
|
667
|
+
* orthographicCamera,
|
|
668
|
+
* renderer
|
|
669
|
+
* );
|
|
670
|
+
*
|
|
671
|
+
* transition.transitionTo(orthographicCamera, {
|
|
672
|
+
* duration: 1000,
|
|
673
|
+
* easing: 'easeInOutCubic'
|
|
674
|
+
* });
|
|
675
|
+
* ```
|
|
676
|
+
*/
|
|
677
|
+
export declare class CameraTransition {
|
|
678
|
+
private perspectiveCamera;
|
|
679
|
+
private orthographicCamera;
|
|
680
|
+
private renderer;
|
|
681
|
+
private scene;
|
|
682
|
+
private currentCamera;
|
|
683
|
+
private targetCamera;
|
|
684
|
+
private transitionProgress;
|
|
685
|
+
private transitionDuration;
|
|
686
|
+
private transitionStartTime;
|
|
687
|
+
private isTransitioning;
|
|
688
|
+
private easingFunction;
|
|
689
|
+
private renderTargetA;
|
|
690
|
+
private renderTargetB;
|
|
691
|
+
private blendScene;
|
|
692
|
+
private blendCamera;
|
|
693
|
+
private blendMaterial;
|
|
694
|
+
private onUpdateCallback?;
|
|
695
|
+
private onCompleteCallback?;
|
|
696
|
+
constructor(perspectiveCamera: THREE.PerspectiveCamera, orthographicCamera: THREE.OrthographicCamera, renderer: THREE.WebGLRenderer);
|
|
697
|
+
/**
|
|
698
|
+
* Start a transition to the target camera
|
|
699
|
+
*/
|
|
700
|
+
transitionTo(targetCamera: THREE.PerspectiveCamera | THREE.OrthographicCamera, options?: CameraTransitionOptions): void;
|
|
701
|
+
/**
|
|
702
|
+
* Update the transition. Call this in your render loop.
|
|
703
|
+
*/
|
|
704
|
+
update(scene: THREE.Scene): THREE.Camera;
|
|
705
|
+
/**
|
|
706
|
+
* Render the scene with camera transition blending
|
|
707
|
+
*/
|
|
708
|
+
render(scene: THREE.Scene): void;
|
|
709
|
+
/**
|
|
710
|
+
* Get the current active camera
|
|
711
|
+
*/
|
|
712
|
+
getCurrentCamera(): THREE.Camera;
|
|
713
|
+
/**
|
|
714
|
+
* Check if a transition is currently in progress
|
|
715
|
+
*/
|
|
716
|
+
getIsTransitioning(): boolean;
|
|
717
|
+
/**
|
|
718
|
+
* Get the current transition progress (0-1)
|
|
719
|
+
*/
|
|
720
|
+
getProgress(): number;
|
|
721
|
+
/**
|
|
722
|
+
* Resize the render targets when the renderer size changes
|
|
723
|
+
*/
|
|
724
|
+
setSize(width: number, height: number): void;
|
|
725
|
+
/**
|
|
726
|
+
* Dispose of resources
|
|
727
|
+
*/
|
|
728
|
+
dispose(): void;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
export declare interface CameraTransitionOptions {
|
|
732
|
+
duration?: number;
|
|
733
|
+
easing?: EasingFunction | keyof typeof Easing;
|
|
734
|
+
onUpdate?: (progress: number) => void;
|
|
735
|
+
onComplete?: () => void;
|
|
736
|
+
}
|
|
737
|
+
|
|
595
738
|
/**
|
|
596
739
|
* Add a slight random wobble for intensity or realism (e.g., during an explosion).
|
|
597
740
|
*
|
|
598
741
|
* Example:
|
|
599
742
|
* ```
|
|
600
|
-
*
|
|
743
|
+
* cameraWobbleAnimation(camera, 0.5, 1000, () => {
|
|
601
744
|
* console.log("Wobble animation complete");
|
|
602
745
|
* });
|
|
603
746
|
* ```
|
|
@@ -610,7 +753,7 @@ export declare function cameraWobbleAnimation(camera: Camera, intensity: number,
|
|
|
610
753
|
*
|
|
611
754
|
* Example:
|
|
612
755
|
* ```
|
|
613
|
-
*
|
|
756
|
+
* cameraZoomInAnimation(camera, new THREE.Vector3(0, 0, 0), 120, 75, 2000, () => {
|
|
614
757
|
* console.log("Zoom in animation complete");
|
|
615
758
|
* });
|
|
616
759
|
* ```
|
|
@@ -723,11 +866,11 @@ export declare function centerObjectGeometry<T extends Object3D>(object: T, targ
|
|
|
723
866
|
*/
|
|
724
867
|
export declare const checkerboardTexture: (size: number) => DataTexture;
|
|
725
868
|
|
|
726
|
-
export declare const
|
|
869
|
+
export declare const circIn: (t: number) => number;
|
|
727
870
|
|
|
728
|
-
export declare const
|
|
871
|
+
export declare const circInOut: (t: number) => number;
|
|
729
872
|
|
|
730
|
-
export declare const
|
|
873
|
+
export declare const circOut: (t: number) => number;
|
|
731
874
|
|
|
732
875
|
export declare const ColorPalette: {
|
|
733
876
|
CADMIUM_RED: number;
|
|
@@ -858,24 +1001,43 @@ export declare const createDampedCurvePoints: (start: Vector2, end: Vector2, dam
|
|
|
858
1001
|
*/
|
|
859
1002
|
export declare const createExponentialCurvePoints: (start: Vector2, end: Vector2, base: number, factor: number, segments?: number) => Vector2[];
|
|
860
1003
|
|
|
1004
|
+
/**
|
|
1005
|
+
* Hexagonal tile pattern factory with density control.
|
|
1006
|
+
*
|
|
1007
|
+
* Example usage:
|
|
1008
|
+
* ```ts
|
|
1009
|
+
* const hexTile = createHexagonalTilesByCount({
|
|
1010
|
+
* width: 10,
|
|
1011
|
+
* depth: 10,
|
|
1012
|
+
* height: 0.01,
|
|
1013
|
+
* count: 10, // 10 tiles along the x-axis
|
|
1014
|
+
* gap: 0.01,
|
|
1015
|
+
* material: new THREE.MeshStandardMaterial({ color: 0xffffff }),
|
|
1016
|
+
* });
|
|
1017
|
+
*
|
|
1018
|
+
* scene.add(hexTile);
|
|
1019
|
+
* ```
|
|
1020
|
+
*/
|
|
1021
|
+
export declare function createHexagonalTilesByCount(options: HexagonalTileCountOptions): InstancedMesh;
|
|
1022
|
+
|
|
861
1023
|
/**
|
|
862
1024
|
* Hexagonal tile pattern factory.
|
|
863
1025
|
*
|
|
864
1026
|
* Example usage:
|
|
865
1027
|
* ```ts
|
|
866
|
-
* const hexTile =
|
|
1028
|
+
* const hexTile = createHexagonalTilesByRadius({
|
|
867
1029
|
* width: 10,
|
|
868
1030
|
* depth: 10,
|
|
869
1031
|
* height: 0.01,
|
|
870
1032
|
* radius: 0.1,
|
|
871
1033
|
* gap: 0.01,
|
|
872
|
-
* material: new THREE.MeshStandardMaterial({ color:
|
|
1034
|
+
* material: new THREE.MeshStandardMaterial({ color: 0xffffff }),
|
|
873
1035
|
* });
|
|
874
1036
|
*
|
|
875
1037
|
* scene.add(hexTile);
|
|
876
1038
|
* ```
|
|
877
1039
|
*/
|
|
878
|
-
export declare function
|
|
1040
|
+
export declare function createHexagonalTilesByRadius(options: HexagonalTileRadiusOptions): InstancedMesh;
|
|
879
1041
|
|
|
880
1042
|
/**
|
|
881
1043
|
* Function to create logarithmic curve points
|
|
@@ -1016,11 +1178,11 @@ declare interface CrossHeadstoneOptions {
|
|
|
1016
1178
|
|
|
1017
1179
|
export declare const cubicCurve: (t: number, p0: number, p1: number, p2: number, p3: number) => number;
|
|
1018
1180
|
|
|
1019
|
-
export declare const
|
|
1181
|
+
export declare const cubicIn: (t: number) => number;
|
|
1020
1182
|
|
|
1021
|
-
export declare const
|
|
1183
|
+
export declare const cubicInOut: (t: number) => number;
|
|
1022
1184
|
|
|
1023
|
-
export declare const
|
|
1185
|
+
export declare const cubicOut: (t: number) => number;
|
|
1024
1186
|
|
|
1025
1187
|
/**
|
|
1026
1188
|
* Cubic UV Mapping
|
|
@@ -1239,39 +1401,83 @@ export declare const displacementBrush: <T extends BufferGeometry>(geometry: T,
|
|
|
1239
1401
|
|
|
1240
1402
|
/**
|
|
1241
1403
|
* Easing functions for interpolating values over time.
|
|
1404
|
+
*
|
|
1405
|
+
* Use these functions to create smooth animations and transitions.
|
|
1406
|
+
* All easing functions take a value t between 0 and 1 and return an eased value between 0 and 1.
|
|
1407
|
+
*
|
|
1408
|
+
* @example
|
|
1409
|
+
* ```typescript
|
|
1410
|
+
* import { Easing, cubicInOut } from 'three-low-poly';
|
|
1411
|
+
*
|
|
1412
|
+
* // Using with transitions (namespace)
|
|
1413
|
+
* cameraTransition.transitionTo(camera, {
|
|
1414
|
+
* duration: 1000,
|
|
1415
|
+
* easing: Easing.cubicInOut // Function reference
|
|
1416
|
+
* });
|
|
1417
|
+
*
|
|
1418
|
+
* // Or using direct import
|
|
1419
|
+
* cameraTransition.transitionTo(camera, {
|
|
1420
|
+
* duration: 1000,
|
|
1421
|
+
* easing: cubicInOut // Direct function reference
|
|
1422
|
+
* });
|
|
1423
|
+
*
|
|
1424
|
+
* // Or using string reference
|
|
1425
|
+
* cameraTransition.transitionTo(camera, {
|
|
1426
|
+
* duration: 1000,
|
|
1427
|
+
* easing: 'cubicInOut' // String reference
|
|
1428
|
+
* });
|
|
1429
|
+
*
|
|
1430
|
+
* // Using the function directly in custom animation
|
|
1431
|
+
* const progress = 0.5;
|
|
1432
|
+
* const easedValue = Easing.cubicInOut(progress);
|
|
1433
|
+
*
|
|
1434
|
+
* // Custom animation loop
|
|
1435
|
+
* const startValue = 0;
|
|
1436
|
+
* const endValue = 100;
|
|
1437
|
+
* const t = elapsedTime / duration;
|
|
1438
|
+
* const easedT = Easing.sineInOut(t);
|
|
1439
|
+
* const currentValue = startValue + (endValue - startValue) * easedT;
|
|
1440
|
+
* ```
|
|
1242
1441
|
*/
|
|
1243
1442
|
export declare const Easing: {
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1443
|
+
sineIn: (t: number) => number;
|
|
1444
|
+
sineOut: (t: number) => number;
|
|
1445
|
+
sineInOut: (t: number) => number;
|
|
1446
|
+
quadIn: (t: number) => number;
|
|
1447
|
+
quadOut: (t: number) => number;
|
|
1448
|
+
quadInOut: (t: number) => number;
|
|
1449
|
+
cubicIn: (t: number) => number;
|
|
1450
|
+
cubicOut: (t: number) => number;
|
|
1451
|
+
cubicInOut: (t: number) => number;
|
|
1452
|
+
quartIn: (t: number) => number;
|
|
1453
|
+
quartOut: (t: number) => number;
|
|
1454
|
+
quartInOut: (t: number) => number;
|
|
1455
|
+
quintIn: (t: number) => number;
|
|
1456
|
+
quintOut: (t: number) => number;
|
|
1457
|
+
quintInOut: (t: number) => number;
|
|
1458
|
+
expoIn: (t: number) => number;
|
|
1459
|
+
expoOut: (t: number) => number;
|
|
1460
|
+
expoInOut: (t: number) => number;
|
|
1461
|
+
circIn: (t: number) => number;
|
|
1462
|
+
circOut: (t: number) => number;
|
|
1463
|
+
circInOut: (t: number) => number;
|
|
1464
|
+
linear: (t: number) => number;
|
|
1465
|
+
smoothstep: (t: number) => number;
|
|
1466
|
+
concave: (t: number) => number;
|
|
1467
|
+
convex: (t: number) => number;
|
|
1468
|
+
logarithmic: (t: number) => number;
|
|
1469
|
+
squareRoot: (t: number) => number;
|
|
1470
|
+
inverse: (t: number) => number;
|
|
1471
|
+
gaussian: (t: number) => number;
|
|
1273
1472
|
};
|
|
1274
1473
|
|
|
1474
|
+
/**
|
|
1475
|
+
* Easing function type for interpolating values over time.
|
|
1476
|
+
* @param t - Progress value between 0 and 1
|
|
1477
|
+
* @returns Eased value between 0 and 1
|
|
1478
|
+
*/
|
|
1479
|
+
export declare type EasingFunction = (t: number) => number;
|
|
1480
|
+
|
|
1275
1481
|
export declare class ElectricPanel extends Group {
|
|
1276
1482
|
constructor();
|
|
1277
1483
|
}
|
|
@@ -1349,13 +1555,13 @@ export declare class ErlenmeyerFlaskGeometry extends BufferGeometry {
|
|
|
1349
1555
|
});
|
|
1350
1556
|
}
|
|
1351
1557
|
|
|
1352
|
-
export declare const
|
|
1558
|
+
export declare const expoIn: (t: number) => number;
|
|
1353
1559
|
|
|
1354
|
-
export declare const
|
|
1560
|
+
export declare const expoInOut: (t: number) => number;
|
|
1355
1561
|
|
|
1356
|
-
export declare const
|
|
1562
|
+
export declare const exponentialCurve: (t: number, base?: number, factor?: number) => number;
|
|
1357
1563
|
|
|
1358
|
-
export declare const
|
|
1564
|
+
export declare const expoOut: (t: number) => number;
|
|
1359
1565
|
|
|
1360
1566
|
export declare const fadeShader: {
|
|
1361
1567
|
uniforms: {
|
|
@@ -1370,6 +1576,14 @@ export declare const fadeShader: {
|
|
|
1370
1576
|
fragmentShader: string;
|
|
1371
1577
|
};
|
|
1372
1578
|
|
|
1579
|
+
declare interface FadeTransitionOptions extends SceneTransitionOptions {
|
|
1580
|
+
color?: THREE.ColorRepresentation;
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1583
|
+
declare interface FadeTransitionOptions_2 extends SceneTransitionFXOptions {
|
|
1584
|
+
color?: THREE.ColorRepresentation;
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1373
1587
|
export declare const Falloff: {
|
|
1374
1588
|
LINEAR: (distance: number, radius: number) => number;
|
|
1375
1589
|
QUADRATIC: (distance: number, radius: number) => number;
|
|
@@ -1432,6 +1646,20 @@ export declare class FlorenceFlaskGeometry extends BufferGeometry {
|
|
|
1432
1646
|
export declare const gaussian: (t: number) => number;
|
|
1433
1647
|
|
|
1434
1648
|
export declare class Gear extends Mesh {
|
|
1649
|
+
constructor({ sides, innerRadius, outerRadius, holeSides, holeRadius, depth }?: {
|
|
1650
|
+
sides?: number | undefined;
|
|
1651
|
+
innerRadius?: number | undefined;
|
|
1652
|
+
outerRadius?: number | undefined;
|
|
1653
|
+
holeSides?: number | undefined;
|
|
1654
|
+
holeRadius?: number | undefined;
|
|
1655
|
+
depth?: number | undefined;
|
|
1656
|
+
});
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1659
|
+
/**
|
|
1660
|
+
* Extrude geometry of Gear Shape.
|
|
1661
|
+
*/
|
|
1662
|
+
export declare class GearGeometry extends ExtrudeGeometry {
|
|
1435
1663
|
constructor(sides?: number, innerRadius?: number, outerRadius?: number, holeSides?: number, holeRadius?: number, depth?: number);
|
|
1436
1664
|
}
|
|
1437
1665
|
|
|
@@ -1449,7 +1677,24 @@ export declare class GearShape extends Shape {
|
|
|
1449
1677
|
*/
|
|
1450
1678
|
export declare function getAnalogousColors(baseHue: number): [number, number, number];
|
|
1451
1679
|
|
|
1680
|
+
declare interface GlitchTransitionOptions extends SceneTransitionFXOptions {
|
|
1681
|
+
maxIntensity?: number;
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1452
1684
|
export declare class Heart extends Mesh {
|
|
1685
|
+
constructor({ size, width, height, tipDepth, depth }?: {
|
|
1686
|
+
size?: number | undefined;
|
|
1687
|
+
width?: number | undefined;
|
|
1688
|
+
height?: number | undefined;
|
|
1689
|
+
tipDepth?: number | undefined;
|
|
1690
|
+
depth?: number | undefined;
|
|
1691
|
+
});
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
/**
|
|
1695
|
+
* Extrude geometry of Heart Shape.
|
|
1696
|
+
*/
|
|
1697
|
+
export declare class HeartGeometry extends ExtrudeGeometry {
|
|
1453
1698
|
constructor(size?: number, width?: number, height?: number, tipDepth?: number, depth?: number);
|
|
1454
1699
|
}
|
|
1455
1700
|
|
|
@@ -1457,7 +1702,23 @@ export declare class HeartShape extends Shape {
|
|
|
1457
1702
|
constructor(size?: number, width?: number, height?: number, tipDepth?: number);
|
|
1458
1703
|
}
|
|
1459
1704
|
|
|
1460
|
-
export declare
|
|
1705
|
+
export declare class Hexagon extends Mesh {
|
|
1706
|
+
constructor({ radius, depth }?: {
|
|
1707
|
+
radius?: number | undefined;
|
|
1708
|
+
depth?: number | undefined;
|
|
1709
|
+
});
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
export declare interface HexagonalTileCountOptions {
|
|
1713
|
+
width: number;
|
|
1714
|
+
depth: number;
|
|
1715
|
+
height: number;
|
|
1716
|
+
count: number;
|
|
1717
|
+
gap: number;
|
|
1718
|
+
material?: Material;
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
export declare interface HexagonalTileRadiusOptions {
|
|
1461
1722
|
width: number;
|
|
1462
1723
|
depth: number;
|
|
1463
1724
|
height: number;
|
|
@@ -1466,6 +1727,17 @@ export declare interface HexagonalTileOptions {
|
|
|
1466
1727
|
material?: Material;
|
|
1467
1728
|
}
|
|
1468
1729
|
|
|
1730
|
+
/**
|
|
1731
|
+
* Extrude geometry of Hexagon Shape.
|
|
1732
|
+
*/
|
|
1733
|
+
export declare class HexagonGeometry extends ExtrudeGeometry {
|
|
1734
|
+
constructor(radius?: number, depth?: number);
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
export declare class HexagonShape extends Shape {
|
|
1738
|
+
constructor(radius?: number);
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1469
1741
|
export declare function hexToHsl(hex: number): [number, number, number];
|
|
1470
1742
|
|
|
1471
1743
|
/**
|
|
@@ -2064,25 +2336,25 @@ export declare class PotionBottleGeometry extends BufferGeometry {
|
|
|
2064
2336
|
constructor();
|
|
2065
2337
|
}
|
|
2066
2338
|
|
|
2067
|
-
export declare const
|
|
2339
|
+
export declare const quadIn: (t: number) => number;
|
|
2068
2340
|
|
|
2069
|
-
export declare const
|
|
2341
|
+
export declare const quadInOut: (t: number) => number;
|
|
2070
2342
|
|
|
2071
|
-
export declare const
|
|
2343
|
+
export declare const quadOut: (t: number) => number;
|
|
2072
2344
|
|
|
2073
|
-
export declare const
|
|
2345
|
+
export declare const quadraticCurve: (t: number, p0: number, p1: number, p2: number) => number;
|
|
2074
2346
|
|
|
2075
|
-
export declare const
|
|
2347
|
+
export declare const quartIn: (t: number) => number;
|
|
2076
2348
|
|
|
2077
|
-
export declare const
|
|
2349
|
+
export declare const quartInOut: (t: number) => number;
|
|
2078
2350
|
|
|
2079
|
-
export declare const
|
|
2351
|
+
export declare const quartOut: (t: number) => number;
|
|
2080
2352
|
|
|
2081
|
-
export declare const
|
|
2353
|
+
export declare const quintIn: (t: number) => number;
|
|
2082
2354
|
|
|
2083
|
-
export declare const
|
|
2355
|
+
export declare const quintInOut: (t: number) => number;
|
|
2084
2356
|
|
|
2085
|
-
export declare const
|
|
2357
|
+
export declare const quintOut: (t: number) => number;
|
|
2086
2358
|
|
|
2087
2359
|
/**
|
|
2088
2360
|
* Calculate the radius to achieve a spherical cap height.
|
|
@@ -2180,6 +2452,239 @@ declare interface RowOfBooksOptions<T extends Material = Material> {
|
|
|
2180
2452
|
scaleZMax?: number;
|
|
2181
2453
|
}
|
|
2182
2454
|
|
|
2455
|
+
/**
|
|
2456
|
+
* SceneTransition provides smooth animated transitions between Three.js scenes.
|
|
2457
|
+
*
|
|
2458
|
+
* Supports multiple transition types:
|
|
2459
|
+
* - Fade: Fade to a color (black, white, etc.) and back
|
|
2460
|
+
* - Crossfade: Directly blend from one scene to another
|
|
2461
|
+
* - Blur: Blur out the first scene and blur in the second
|
|
2462
|
+
*
|
|
2463
|
+
* @example
|
|
2464
|
+
* ```typescript
|
|
2465
|
+
* const sceneTransition = new SceneTransition(renderer);
|
|
2466
|
+
*
|
|
2467
|
+
* // Fade to black transition
|
|
2468
|
+
* sceneTransition.fade(sceneA, sceneB, camera, {
|
|
2469
|
+
* duration: 1000,
|
|
2470
|
+
* color: 0x000000,
|
|
2471
|
+
* easing: 'easeInOutCubic'
|
|
2472
|
+
* });
|
|
2473
|
+
*
|
|
2474
|
+
* // Direct crossfade
|
|
2475
|
+
* sceneTransition.crossfade(sceneA, sceneB, camera, {
|
|
2476
|
+
* duration: 1500
|
|
2477
|
+
* });
|
|
2478
|
+
* ```
|
|
2479
|
+
*/
|
|
2480
|
+
export declare class SceneTransition {
|
|
2481
|
+
private renderer;
|
|
2482
|
+
private currentScene;
|
|
2483
|
+
private targetScene;
|
|
2484
|
+
private camera;
|
|
2485
|
+
private transitionProgress;
|
|
2486
|
+
private transitionDuration;
|
|
2487
|
+
private transitionStartTime;
|
|
2488
|
+
private isTransitioning;
|
|
2489
|
+
private transitionType;
|
|
2490
|
+
private easingFunction;
|
|
2491
|
+
private renderTargetA;
|
|
2492
|
+
private renderTargetB;
|
|
2493
|
+
private blendScene;
|
|
2494
|
+
private blendCamera;
|
|
2495
|
+
private fadeMaterial;
|
|
2496
|
+
private crossfadeMaterial;
|
|
2497
|
+
private fadeColor;
|
|
2498
|
+
private onUpdateCallback?;
|
|
2499
|
+
private onCompleteCallback?;
|
|
2500
|
+
constructor(renderer: THREE.WebGLRenderer);
|
|
2501
|
+
/**
|
|
2502
|
+
* Fade transition: Fades to a color and then fades in the new scene
|
|
2503
|
+
*/
|
|
2504
|
+
fade(fromScene: THREE.Scene, toScene: THREE.Scene, camera: THREE.Camera, options?: FadeTransitionOptions): void;
|
|
2505
|
+
/**
|
|
2506
|
+
* Crossfade transition: Directly blends from one scene to another
|
|
2507
|
+
*/
|
|
2508
|
+
crossfade(fromScene: THREE.Scene, toScene: THREE.Scene, camera: THREE.Camera, options?: SceneTransitionOptions): void;
|
|
2509
|
+
/**
|
|
2510
|
+
* Blur transition: Blurs out first scene, then blurs in second scene
|
|
2511
|
+
* Note: This uses the fade material with a neutral gray for a blur-like effect
|
|
2512
|
+
* For true blur, you'd need post-processing passes
|
|
2513
|
+
*/
|
|
2514
|
+
blur(fromScene: THREE.Scene, toScene: THREE.Scene, camera: THREE.Camera, options?: SceneTransitionOptions): void;
|
|
2515
|
+
/**
|
|
2516
|
+
* Internal method to start a transition
|
|
2517
|
+
*/
|
|
2518
|
+
private startTransition;
|
|
2519
|
+
/**
|
|
2520
|
+
* Update the transition. Call this in your render loop.
|
|
2521
|
+
*/
|
|
2522
|
+
update(): void;
|
|
2523
|
+
/**
|
|
2524
|
+
* Render the scene with transition blending
|
|
2525
|
+
*/
|
|
2526
|
+
render(): void;
|
|
2527
|
+
/**
|
|
2528
|
+
* Get the current active scene
|
|
2529
|
+
*/
|
|
2530
|
+
getCurrentScene(): THREE.Scene | null;
|
|
2531
|
+
/**
|
|
2532
|
+
* Check if a transition is currently in progress
|
|
2533
|
+
*/
|
|
2534
|
+
getIsTransitioning(): boolean;
|
|
2535
|
+
/**
|
|
2536
|
+
* Get the current transition progress (0-1)
|
|
2537
|
+
*/
|
|
2538
|
+
getProgress(): number;
|
|
2539
|
+
/**
|
|
2540
|
+
* Set the current scene (useful for initialization)
|
|
2541
|
+
*/
|
|
2542
|
+
setCurrentScene(scene: THREE.Scene): void;
|
|
2543
|
+
/**
|
|
2544
|
+
* Resize the render targets when the renderer size changes
|
|
2545
|
+
*/
|
|
2546
|
+
setSize(width: number, height: number): void;
|
|
2547
|
+
/**
|
|
2548
|
+
* Dispose of resources
|
|
2549
|
+
*/
|
|
2550
|
+
dispose(): void;
|
|
2551
|
+
}
|
|
2552
|
+
|
|
2553
|
+
/**
|
|
2554
|
+
* SceneTransitionFX provides advanced post-processing transitions between Three.js scenes.
|
|
2555
|
+
*
|
|
2556
|
+
* Uses EffectComposer for sophisticated visual effects:
|
|
2557
|
+
* - Bloom: Bright bloom effect that peaks at transition midpoint, washing out to white
|
|
2558
|
+
* - Blur: Progressive blur effect that peaks at midpoint, blurring scenes to oblivion
|
|
2559
|
+
* - Fade: Classic fade through a color (black, white, or custom)
|
|
2560
|
+
* - Glitch: Digital distortion/glitch effect with heavy artifacts
|
|
2561
|
+
*
|
|
2562
|
+
* Note: Requires post-processing imports from three/addons
|
|
2563
|
+
*
|
|
2564
|
+
* @example
|
|
2565
|
+
* ```typescript
|
|
2566
|
+
* import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
|
|
2567
|
+
* import { RenderPass } from 'three/addons/postprocessing/RenderPass.js';
|
|
2568
|
+
* import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js';
|
|
2569
|
+
* import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js';
|
|
2570
|
+
*
|
|
2571
|
+
* const composer = new EffectComposer(renderer);
|
|
2572
|
+
* const sceneTransitionFX = new SceneTransitionFX(renderer, composer);
|
|
2573
|
+
*
|
|
2574
|
+
* sceneTransitionFX.bloom(sceneA, sceneB, camera, {
|
|
2575
|
+
* duration: 2000,
|
|
2576
|
+
* maxBloom: 15.0
|
|
2577
|
+
* });
|
|
2578
|
+
* ```
|
|
2579
|
+
*/
|
|
2580
|
+
export declare class SceneTransitionFX {
|
|
2581
|
+
private renderer;
|
|
2582
|
+
private composer;
|
|
2583
|
+
private currentScene;
|
|
2584
|
+
private targetScene;
|
|
2585
|
+
private camera;
|
|
2586
|
+
private transitionProgress;
|
|
2587
|
+
private transitionDuration;
|
|
2588
|
+
private transitionStartTime;
|
|
2589
|
+
private isTransitioning;
|
|
2590
|
+
private transitionType;
|
|
2591
|
+
private easingFunction;
|
|
2592
|
+
private renderPass;
|
|
2593
|
+
private bloomPass;
|
|
2594
|
+
private glitchPass;
|
|
2595
|
+
private blurPass;
|
|
2596
|
+
private fadePass;
|
|
2597
|
+
private maxBloomStrength;
|
|
2598
|
+
private maxBlurAmount;
|
|
2599
|
+
private maxGlitchIntensity;
|
|
2600
|
+
private fadeColor;
|
|
2601
|
+
private onUpdateCallback?;
|
|
2602
|
+
private onCompleteCallback?;
|
|
2603
|
+
constructor(renderer: THREE.WebGLRenderer, composer: any);
|
|
2604
|
+
/**
|
|
2605
|
+
* Set the bloom pass for bloom transitions
|
|
2606
|
+
*/
|
|
2607
|
+
setBloomPass(bloomPass: any): void;
|
|
2608
|
+
/**
|
|
2609
|
+
* Set the glitch pass for glitch transitions
|
|
2610
|
+
*/
|
|
2611
|
+
setGlitchPass(glitchPass: any): void;
|
|
2612
|
+
/**
|
|
2613
|
+
* Set the blur pass for blur transitions
|
|
2614
|
+
*/
|
|
2615
|
+
setBlurPass(blurPass: any): void;
|
|
2616
|
+
/**
|
|
2617
|
+
* Set the fade pass for fade transitions
|
|
2618
|
+
*/
|
|
2619
|
+
setFadePass(fadePass: any): void;
|
|
2620
|
+
/**
|
|
2621
|
+
* Bloom transition: Bright bloom effect that peaks at transition midpoint
|
|
2622
|
+
*/
|
|
2623
|
+
bloom(fromScene: THREE.Scene, toScene: THREE.Scene, camera: THREE.Camera, options?: BloomTransitionOptions): void;
|
|
2624
|
+
/**
|
|
2625
|
+
* Blur transition: Progressively blur scenes to oblivion and back
|
|
2626
|
+
*/
|
|
2627
|
+
blur(fromScene: THREE.Scene, toScene: THREE.Scene, camera: THREE.Camera, options?: BlurTransitionOptions): void;
|
|
2628
|
+
/**
|
|
2629
|
+
* Fade transition: Classic fade through a color (black, white, or custom)
|
|
2630
|
+
*/
|
|
2631
|
+
fade(fromScene: THREE.Scene, toScene: THREE.Scene, camera: THREE.Camera, options?: FadeTransitionOptions_2): void;
|
|
2632
|
+
/**
|
|
2633
|
+
* Glitch transition: Digital distortion effect
|
|
2634
|
+
*/
|
|
2635
|
+
glitch(fromScene: THREE.Scene, toScene: THREE.Scene, camera: THREE.Camera, options?: GlitchTransitionOptions): void;
|
|
2636
|
+
/**
|
|
2637
|
+
* Internal method to start a transition
|
|
2638
|
+
*/
|
|
2639
|
+
private startTransition;
|
|
2640
|
+
/**
|
|
2641
|
+
* Update the transition. Call this in your render loop.
|
|
2642
|
+
*/
|
|
2643
|
+
update(): void;
|
|
2644
|
+
/**
|
|
2645
|
+
* Render using the effect composer
|
|
2646
|
+
*/
|
|
2647
|
+
render(): void;
|
|
2648
|
+
/**
|
|
2649
|
+
* Get the current active scene
|
|
2650
|
+
*/
|
|
2651
|
+
getCurrentScene(): THREE.Scene | null;
|
|
2652
|
+
/**
|
|
2653
|
+
* Check if a transition is currently in progress
|
|
2654
|
+
*/
|
|
2655
|
+
getIsTransitioning(): boolean;
|
|
2656
|
+
/**
|
|
2657
|
+
* Get the current transition progress (0-1)
|
|
2658
|
+
*/
|
|
2659
|
+
getProgress(): number;
|
|
2660
|
+
/**
|
|
2661
|
+
* Set the current scene (useful for initialization)
|
|
2662
|
+
*/
|
|
2663
|
+
setCurrentScene(scene: THREE.Scene): void;
|
|
2664
|
+
/**
|
|
2665
|
+
* Resize the composer when the renderer size changes
|
|
2666
|
+
*/
|
|
2667
|
+
setSize(width: number, height: number): void;
|
|
2668
|
+
/**
|
|
2669
|
+
* Dispose of resources
|
|
2670
|
+
*/
|
|
2671
|
+
dispose(): void;
|
|
2672
|
+
}
|
|
2673
|
+
|
|
2674
|
+
export declare interface SceneTransitionFXOptions {
|
|
2675
|
+
duration?: number;
|
|
2676
|
+
easing?: EasingFunction | keyof typeof Easing;
|
|
2677
|
+
onUpdate?: (progress: number) => void;
|
|
2678
|
+
onComplete?: () => void;
|
|
2679
|
+
}
|
|
2680
|
+
|
|
2681
|
+
export declare interface SceneTransitionOptions {
|
|
2682
|
+
duration?: number;
|
|
2683
|
+
easing?: EasingFunction | keyof typeof Easing;
|
|
2684
|
+
onUpdate?: (progress: number) => void;
|
|
2685
|
+
onComplete?: () => void;
|
|
2686
|
+
}
|
|
2687
|
+
|
|
2183
2688
|
/**
|
|
2184
2689
|
* Set a random interval that will call the callback function with a random delay between minDelay and maxDelay.
|
|
2185
2690
|
*
|
|
@@ -2206,11 +2711,11 @@ export declare function setRandomTimeout(callback: () => void, minDelay: number,
|
|
|
2206
2711
|
|
|
2207
2712
|
export declare const sigmoidCurve: (t: number, a?: number) => number;
|
|
2208
2713
|
|
|
2209
|
-
export declare const
|
|
2714
|
+
export declare const sineIn: (t: number) => number;
|
|
2210
2715
|
|
|
2211
|
-
export declare const
|
|
2716
|
+
export declare const sineInOut: (t: number) => number;
|
|
2212
2717
|
|
|
2213
|
-
export declare const
|
|
2718
|
+
export declare const sineOut: (t: number) => number;
|
|
2214
2719
|
|
|
2215
2720
|
/**
|
|
2216
2721
|
* Smooths out the vertices by averaging their positions with neighboring vertices within a given radius.
|
|
@@ -2299,6 +2804,18 @@ export declare class StandGeometry extends BufferGeometry {
|
|
|
2299
2804
|
}
|
|
2300
2805
|
|
|
2301
2806
|
export declare class Star extends Mesh {
|
|
2807
|
+
constructor({ points, innerRadius, outerRadius, depth }?: {
|
|
2808
|
+
points?: number | undefined;
|
|
2809
|
+
innerRadius?: number | undefined;
|
|
2810
|
+
outerRadius?: number | undefined;
|
|
2811
|
+
depth?: number | undefined;
|
|
2812
|
+
});
|
|
2813
|
+
}
|
|
2814
|
+
|
|
2815
|
+
/**
|
|
2816
|
+
* Extrude geometry of Star Shape.
|
|
2817
|
+
*/
|
|
2818
|
+
export declare class StarGeometry extends ExtrudeGeometry {
|
|
2302
2819
|
constructor(points?: number, innerRadius?: number, outerRadius?: number, depth?: number);
|
|
2303
2820
|
}
|
|
2304
2821
|
|