three-low-poly 0.9.22 → 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 +432 -52
- package/dist/index.iife.js +74 -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 -292
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.es.js +0 -5240
- package/dist/index.es.js.map +0 -1
- package/dist/index.umd.js +0 -292
- package/dist/index.umd.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ import { PerspectiveCamera } from 'three';
|
|
|
19
19
|
import { ShaderMaterial } from 'three';
|
|
20
20
|
import { Shape } from 'three';
|
|
21
21
|
import { SphereGeometry } from 'three';
|
|
22
|
+
import * as THREE from 'three';
|
|
22
23
|
import { Uniform } from 'three';
|
|
23
24
|
import { Vector2 } from 'three';
|
|
24
25
|
import { Vector3 } from 'three';
|
|
@@ -390,6 +391,15 @@ export declare class BifurcatedStaircaseGeometry extends BufferGeometry {
|
|
|
390
391
|
constructor(stepWidth?: number, stepHeight?: number, stepDepth?: number, numStepsCentral?: number, numStepsBranch?: number, branchAngle?: number);
|
|
391
392
|
}
|
|
392
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
|
+
|
|
393
403
|
export declare class Bone extends Mesh<BoneGeometry, MeshStandardMaterial> {
|
|
394
404
|
constructor();
|
|
395
405
|
}
|
|
@@ -644,6 +654,87 @@ export declare function cameraPendulumAnimation(camera: Camera, center: Vector3,
|
|
|
644
654
|
*/
|
|
645
655
|
export declare function cameraSpiralAscensionAnimation(camera: Camera, center: Vector3, radius: number, height: number, revolutions: number, duration: number, onComplete?: () => void): void;
|
|
646
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
|
+
|
|
647
738
|
/**
|
|
648
739
|
* Add a slight random wobble for intensity or realism (e.g., during an explosion).
|
|
649
740
|
*
|
|
@@ -775,11 +866,11 @@ export declare function centerObjectGeometry<T extends Object3D>(object: T, targ
|
|
|
775
866
|
*/
|
|
776
867
|
export declare const checkerboardTexture: (size: number) => DataTexture;
|
|
777
868
|
|
|
778
|
-
export declare const
|
|
869
|
+
export declare const circIn: (t: number) => number;
|
|
779
870
|
|
|
780
|
-
export declare const
|
|
871
|
+
export declare const circInOut: (t: number) => number;
|
|
781
872
|
|
|
782
|
-
export declare const
|
|
873
|
+
export declare const circOut: (t: number) => number;
|
|
783
874
|
|
|
784
875
|
export declare const ColorPalette: {
|
|
785
876
|
CADMIUM_RED: number;
|
|
@@ -1087,11 +1178,11 @@ declare interface CrossHeadstoneOptions {
|
|
|
1087
1178
|
|
|
1088
1179
|
export declare const cubicCurve: (t: number, p0: number, p1: number, p2: number, p3: number) => number;
|
|
1089
1180
|
|
|
1090
|
-
export declare const
|
|
1181
|
+
export declare const cubicIn: (t: number) => number;
|
|
1091
1182
|
|
|
1092
|
-
export declare const
|
|
1183
|
+
export declare const cubicInOut: (t: number) => number;
|
|
1093
1184
|
|
|
1094
|
-
export declare const
|
|
1185
|
+
export declare const cubicOut: (t: number) => number;
|
|
1095
1186
|
|
|
1096
1187
|
/**
|
|
1097
1188
|
* Cubic UV Mapping
|
|
@@ -1310,39 +1401,83 @@ export declare const displacementBrush: <T extends BufferGeometry>(geometry: T,
|
|
|
1310
1401
|
|
|
1311
1402
|
/**
|
|
1312
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
|
+
* ```
|
|
1313
1441
|
*/
|
|
1314
1442
|
export declare const Easing: {
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
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;
|
|
1344
1472
|
};
|
|
1345
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
|
+
|
|
1346
1481
|
export declare class ElectricPanel extends Group {
|
|
1347
1482
|
constructor();
|
|
1348
1483
|
}
|
|
@@ -1420,13 +1555,13 @@ export declare class ErlenmeyerFlaskGeometry extends BufferGeometry {
|
|
|
1420
1555
|
});
|
|
1421
1556
|
}
|
|
1422
1557
|
|
|
1423
|
-
export declare const
|
|
1558
|
+
export declare const expoIn: (t: number) => number;
|
|
1424
1559
|
|
|
1425
|
-
export declare const
|
|
1560
|
+
export declare const expoInOut: (t: number) => number;
|
|
1426
1561
|
|
|
1427
|
-
export declare const
|
|
1562
|
+
export declare const exponentialCurve: (t: number, base?: number, factor?: number) => number;
|
|
1428
1563
|
|
|
1429
|
-
export declare const
|
|
1564
|
+
export declare const expoOut: (t: number) => number;
|
|
1430
1565
|
|
|
1431
1566
|
export declare const fadeShader: {
|
|
1432
1567
|
uniforms: {
|
|
@@ -1441,6 +1576,14 @@ export declare const fadeShader: {
|
|
|
1441
1576
|
fragmentShader: string;
|
|
1442
1577
|
};
|
|
1443
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
|
+
|
|
1444
1587
|
export declare const Falloff: {
|
|
1445
1588
|
LINEAR: (distance: number, radius: number) => number;
|
|
1446
1589
|
QUADRATIC: (distance: number, radius: number) => number;
|
|
@@ -1534,6 +1677,10 @@ export declare class GearShape extends Shape {
|
|
|
1534
1677
|
*/
|
|
1535
1678
|
export declare function getAnalogousColors(baseHue: number): [number, number, number];
|
|
1536
1679
|
|
|
1680
|
+
declare interface GlitchTransitionOptions extends SceneTransitionFXOptions {
|
|
1681
|
+
maxIntensity?: number;
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1537
1684
|
export declare class Heart extends Mesh {
|
|
1538
1685
|
constructor({ size, width, height, tipDepth, depth }?: {
|
|
1539
1686
|
size?: number | undefined;
|
|
@@ -2189,25 +2336,25 @@ export declare class PotionBottleGeometry extends BufferGeometry {
|
|
|
2189
2336
|
constructor();
|
|
2190
2337
|
}
|
|
2191
2338
|
|
|
2192
|
-
export declare const
|
|
2339
|
+
export declare const quadIn: (t: number) => number;
|
|
2193
2340
|
|
|
2194
|
-
export declare const
|
|
2341
|
+
export declare const quadInOut: (t: number) => number;
|
|
2195
2342
|
|
|
2196
|
-
export declare const
|
|
2343
|
+
export declare const quadOut: (t: number) => number;
|
|
2197
2344
|
|
|
2198
|
-
export declare const
|
|
2345
|
+
export declare const quadraticCurve: (t: number, p0: number, p1: number, p2: number) => number;
|
|
2199
2346
|
|
|
2200
|
-
export declare const
|
|
2347
|
+
export declare const quartIn: (t: number) => number;
|
|
2201
2348
|
|
|
2202
|
-
export declare const
|
|
2349
|
+
export declare const quartInOut: (t: number) => number;
|
|
2203
2350
|
|
|
2204
|
-
export declare const
|
|
2351
|
+
export declare const quartOut: (t: number) => number;
|
|
2205
2352
|
|
|
2206
|
-
export declare const
|
|
2353
|
+
export declare const quintIn: (t: number) => number;
|
|
2207
2354
|
|
|
2208
|
-
export declare const
|
|
2355
|
+
export declare const quintInOut: (t: number) => number;
|
|
2209
2356
|
|
|
2210
|
-
export declare const
|
|
2357
|
+
export declare const quintOut: (t: number) => number;
|
|
2211
2358
|
|
|
2212
2359
|
/**
|
|
2213
2360
|
* Calculate the radius to achieve a spherical cap height.
|
|
@@ -2305,6 +2452,239 @@ declare interface RowOfBooksOptions<T extends Material = Material> {
|
|
|
2305
2452
|
scaleZMax?: number;
|
|
2306
2453
|
}
|
|
2307
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
|
+
|
|
2308
2688
|
/**
|
|
2309
2689
|
* Set a random interval that will call the callback function with a random delay between minDelay and maxDelay.
|
|
2310
2690
|
*
|
|
@@ -2331,11 +2711,11 @@ export declare function setRandomTimeout(callback: () => void, minDelay: number,
|
|
|
2331
2711
|
|
|
2332
2712
|
export declare const sigmoidCurve: (t: number, a?: number) => number;
|
|
2333
2713
|
|
|
2334
|
-
export declare const
|
|
2714
|
+
export declare const sineIn: (t: number) => number;
|
|
2335
2715
|
|
|
2336
|
-
export declare const
|
|
2716
|
+
export declare const sineInOut: (t: number) => number;
|
|
2337
2717
|
|
|
2338
|
-
export declare const
|
|
2718
|
+
export declare const sineOut: (t: number) => number;
|
|
2339
2719
|
|
|
2340
2720
|
/**
|
|
2341
2721
|
* Smooths out the vertices by averaging their positions with neighboring vertices within a given radius.
|