Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
aeroheim committed Sep 6, 2021
1 parent 35267ac commit 67bdbc3
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 81,395 deletions.
172 changes: 101 additions & 71 deletions dist/midori.d.ts
@@ -1,61 +1,61 @@
// Generated by dts-bundle-generator v5.7.0
// Generated by dts-bundle-generator v5.9.0

import { DepthTexture, Mesh, MeshBasicMaterial, PerspectiveCamera, PlaneGeometry, Points, Texture, WebGLRenderTarget, WebGLRenderer } from 'three';
import { Pass } from 'three/examples/jsm/postprocessing/Pass';

export declare const Easings: {
Linear: {
None: any;
None: (amount: number) => number;
};
Quadratic: {
In: any;
Out: any;
InOut: any;
In: (amount: number) => number;
Out: (amount: number) => number;
InOut: (amount: number) => number;
};
Cubic: {
In: any;
Out: any;
InOut: any;
In: (amount: number) => number;
Out: (amount: number) => number;
InOut: (amount: number) => number;
};
Quartic: {
In: any;
Out: any;
InOut: any;
In: (amount: number) => number;
Out: (amount: number) => number;
InOut: (amount: number) => number;
};
Quintic: {
In: any;
Out: any;
InOut: any;
In: (amount: number) => number;
Out: (amount: number) => number;
InOut: (amount: number) => number;
};
Sinusoidal: {
In: any;
Out: any;
InOut: any;
In: (amount: number) => number;
Out: (amount: number) => number;
InOut: (amount: number) => number;
};
Exponential: {
In: any;
Out: any;
InOut: any;
In: (amount: number) => number;
Out: (amount: number) => number;
InOut: (amount: number) => number;
};
Circular: {
In: any;
Out: any;
InOut: any;
In: (amount: number) => number;
Out: (amount: number) => number;
InOut: (amount: number) => number;
};
Elastic: {
In: any;
Out: any;
InOut: any;
In: (amount: number) => number;
Out: (amount: number) => number;
InOut: (amount: number) => number;
};
Back: {
In: any;
Out: any;
InOut: any;
In: (amount: number) => number;
Out: (amount: number) => number;
InOut: (amount: number) => number;
};
Bounce: {
In: any;
Out: any;
InOut: any;
In: (amount: number) => number;
Out: (amount: number) => number;
InOut: (amount: number) => number;
};
};
export interface TransitionConfig {
Expand All @@ -72,11 +72,11 @@ export interface LoopableTransitionConfig extends TransitionConfig {
loop?: boolean;
}
export interface BackgroundTransitionConfig extends TransitionConfig {
onInit?: (prevBackground?: Background, nextBackground?: Background) => void;
onStart?: (prevBackground?: Background, nextBackground?: Background) => void;
onUpdate?: (prevBackground?: Background, nextBackground?: Background) => void;
onComplete?: (prevBackground?: Background, nextBackground?: Background) => void;
onStop?: (prevBackground?: Background, nextBackground?: Background) => void;
onInit?: (prevBackground: Background, nextBackground: Background) => void;
onStart?: (prevBackground: Background, nextBackground: Background) => void;
onUpdate?: (prevBackground: Background, nextBackground: Background) => void;
onComplete?: (prevBackground: Background, nextBackground: Background) => void;
onStop?: (prevBackground: Background, nextBackground: Background) => void;
}
export interface CameraPosition {
x?: number;
Expand All @@ -91,6 +91,7 @@ export declare class BackgroundCamera {
private _plane;
readonly camera: PerspectiveCamera;
private readonly _position;
private readonly _positionOffset;
private readonly _positionWithOffset;
private _positionTransition;
private _rotationTransition;
Expand All @@ -108,6 +109,11 @@ export declare class BackgroundCamera {
* @returns CameraPositionWithRotation
*/
get position(): CameraPositionWithRotation;
/**
* Returns the current position offset of the camera.
* @returns CameraPositionWithRotation
*/
get positionOffset(): CameraPositionWithRotation;
/**
* Returns whether the camera is currently moving.
* @returns boolean
Expand All @@ -129,6 +135,11 @@ export declare class BackgroundCamera {
* @param {number} height
*/
setSize(width: number, height: number): void;
/**
* Offsets the camera position.
* @param {CameraPositionWithRotation} offset - the offset to apply.
*/
offset(offset: CameraPositionWithRotation): void;
/**
* Sways the camera around its position. Cancels any in-progress sways.
* @param {CameraOffset | boolean} offset - the offset to sway on each axis in relative units from 0 to 1.
Expand Down Expand Up @@ -181,6 +192,18 @@ export interface IEffect {
clearUniforms(): any;
dispose(): any;
}
export declare type EffectTypeConfig<T extends Exclude<EffectType, EffectType.MotionBlur>> = {
[EffectType.Blur]: BlurEffectConfig;
[EffectType.Bloom]: BloomEffectConfig;
[EffectType.RgbShift]: RgbShiftEffectConfig;
[EffectType.Vignette]: VignetteEffectConfig;
[EffectType.VignetteBlur]: VignetteBlurEffectConfig;
[EffectType.Glitch]: GlitchEffectConfig;
}[T];
export declare type EffectConfigs = {
[T in Exclude<EffectType, EffectType.MotionBlur>]?: EffectTypeConfig<T>;
};
export declare type EffectMap = Partial<Record<EffectType, IEffect>>;
export interface BlurEffectConfig {
radius?: number;
passes?: number;
Expand All @@ -207,17 +230,6 @@ export interface GlitchEffectConfig {
amount?: number;
seed?: number;
}
export interface EffectConfigs {
[EffectType.Blur]?: BlurEffectConfig;
[EffectType.Bloom]?: BloomEffectConfig;
[EffectType.RgbShift]?: RgbShiftEffectConfig;
[EffectType.Vignette]?: VignetteEffectConfig;
[EffectType.VignetteBlur]?: VignetteBlurEffectConfig;
[EffectType.Glitch]?: GlitchEffectConfig;
}
export declare type EffectMap = {
[effect in EffectType]?: IEffect;
};
export declare class EffectPass extends Pass {
private _width;
private _height;
Expand Down Expand Up @@ -266,12 +278,7 @@ export declare class EffectPass extends Pass {
* @param {EffectType} type - the effect to set.
* @param {Object} config - configuration specific to the effect specified.
*/
set(type: EffectType.Blur, config: BlurEffectConfig): any;
set(type: EffectType.Bloom, config: BloomEffectConfig): any;
set(type: EffectType.RgbShift, config: RgbShiftEffectConfig): any;
set(type: EffectType.Vignette, config: VignetteEffectConfig): any;
set(type: EffectType.VignetteBlur, config: VignetteBlurEffectConfig): any;
set(type: EffectType.Glitch, config: GlitchEffectConfig): any;
set<T extends Exclude<EffectType, EffectType.MotionBlur>>(type: T, config?: EffectTypeConfig<T>): void;
/**
* Removes a set effect. Returns true if the effect was removed, otherwise false.
* @param {EffectType} type - the type of the effect.
Expand All @@ -289,22 +296,31 @@ export declare class EffectPass extends Pass {
/**
* Renders the effects.
* @param {WebGLRenderer} renderer - the renderer to use.
* @param {WebGLRenderTarget} writeBuffer - the buffer to render to, or null to render directly to screen.
* @param {WebGLRenderTarget | null} writeBuffer - the buffer to render to, or null to render directly to screen.
* @param {WebGLRenderTarget} readBuffer - the buffer to read from.
*/
render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void;
render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget | null, readBuffer: WebGLRenderTarget): void;
/**
* Disposes this object. Call when this object is no longer needed, otherwise leaks may occur.
*/
dispose(): void;
}
export declare type BackgroundEffectTypeConfig<T extends EffectType> = {
[EffectType.Blur]: BlurEffectConfig;
[EffectType.Bloom]: BloomEffectConfig;
[EffectType.RgbShift]: RgbShiftEffectConfig;
[EffectType.Vignette]: VignetteEffectConfig;
[EffectType.VignetteBlur]: VignetteBlurEffectConfig;
[EffectType.MotionBlur]: MotionBlurEffectConfig;
[EffectType.Glitch]: GlitchEffectConfig;
}[T];
export interface BackgroundEffectConfigs extends EffectConfigs {
[EffectType.MotionBlur]?: MotionBlurEffectConfig;
}
export interface MotionBlurEffectConfig {
intensity?: number;
samples?: number;
}
export interface BackgroundEffectConfigs extends EffectConfigs {
[EffectType.MotionBlur]?: MotionBlurEffectConfig;
}
export declare class BackgroundEffects extends EffectPass {
private _camera;
private _depthTexture;
Expand Down Expand Up @@ -334,13 +350,7 @@ export declare class BackgroundEffects extends EffectPass {
* @param {EffectType} type - the effect to set.
* @param {Object} config - configuration specific to the effect specified.
*/
set(type: EffectType.Blur, config: BlurEffectConfig): any;
set(type: EffectType.Bloom, config: BloomEffectConfig): any;
set(type: EffectType.RgbShift, config: RgbShiftEffectConfig): any;
set(type: EffectType.Vignette, config: VignetteEffectConfig): any;
set(type: EffectType.VignetteBlur, config: VignetteBlurEffectConfig): any;
set(type: EffectType.MotionBlur, config: MotionBlurEffectConfig): any;
set(type: EffectType.Glitch, config: GlitchEffectConfig): any;
set<T extends EffectType>(type: T, config?: BackgroundEffectTypeConfig<T>): void;
}
export interface ParticleMoveOffset {
distance: number;
Expand Down Expand Up @@ -401,6 +411,10 @@ export declare class Particles {
* @param {ParticleGroupConfig | ParticleGroupConfig[]} config - a single or array of particle group configurations.
*/
generate(configs: ParticleGroupConfig | ParticleGroupConfig[]): void;
/**
* Removes all particle groups.
*/
removeAll(): void;
/**
* Calculates a new position based off an existing position and optional offset. Will wrap around boundaries.
* @param {Vector2} position - the current position.
Expand Down Expand Up @@ -469,11 +483,16 @@ export declare class Background {
readonly effects: BackgroundEffects;
/**
* Constructs a background.
* @param {Texture} texture
* @param {Texture | null} texture
* @param {number} width
* @param {number} height
*/
constructor(texture: Texture, width: number, height: number);
constructor(texture: Texture | null, width: number, height: number);
/**
* Returns the texture of the background.
* @returns {Texture | null}
*/
get texture(): Texture | null;
/**
* Sets the size of the background.
* @param {number} width
Expand All @@ -483,9 +502,9 @@ export declare class Background {
/**
* Renders the background.
* @param {WebGLRenderer} renderer - the renderer to use.
* @param {WebGLRenderTarget} writeBuffer - the buffer to render to, or null to render directly to screen.
* @param {WebGLRenderTarget | null} writeBuffer - the buffer to render to, or null to render directly to screen.
*/
render(renderer: WebGLRenderer, writeBuffer?: WebGLRenderTarget): void;
render(renderer: WebGLRenderer, writeBuffer?: WebGLRenderTarget | null): void;
/**
* Disposes this object. Call when this object is no longer needed, otherwise leaks may occur.
*/
Expand Down Expand Up @@ -569,19 +588,25 @@ export declare function isWebGLSupported(): boolean;
* @return Promise<Texture> - texture on success, error on failure.
*/
export declare function loadImage(path: string): Promise<Texture>;
export interface BackgroundRendererOptions {
autoRender?: boolean;
}
export declare class BackgroundRenderer {
private _renderer;
private _composer;
private _background;
private _backgroundPass;
private _transitionPass;
private _effectPass;
private _clock;
private _paused;
private _disposed;
/**
* Constructs a renderer.
* @param {HTMLCanvasElement} canvas - the canvas element to use.
* @param {BackgroundRendererOptions} options - options for the renderer.
*/
constructor(canvas: HTMLCanvasElement);
constructor(canvas: HTMLCanvasElement, options?: BackgroundRendererOptions);
/**
* Returns the global effects.
* Effects set on this will apply to all backgrounds.
Expand All @@ -608,6 +633,11 @@ export declare class BackgroundRenderer {
* Resizes the canvas if necessary. Should be called on every render frame.
*/
private _resizeCanvas;
/**
* Begins rendering the background.
*/
render(): void;
pause(): void;
/**
* Renders the background, transitions, and effects. Should be called on every frame.
*/
Expand Down

0 comments on commit 67bdbc3

Please sign in to comment.