@canvasengine/presets 2.0.0-beta.51 → 2.0.0-beta.52
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/dist/NightAmbiant.d.ts +142 -2
- package/dist/NightAmbiant.d.ts.map +1 -1
- package/dist/Weathers/fog.d.ts.map +1 -1
- package/dist/Weathers/index.d.ts.map +1 -1
- package/dist/Weathers/rain.d.ts.map +1 -1
- package/dist/Weathers/snow.d.ts.map +1 -1
- package/dist/index.global.js +125 -25
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +2014 -1802
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/NightAmbiant.d.ts
CHANGED
|
@@ -1,3 +1,143 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { Filter } from 'pixi.js';
|
|
2
|
+
type PointLike = {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
};
|
|
6
|
+
type BoundsLike = {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
};
|
|
12
|
+
type ScreenPointLike = {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
};
|
|
16
|
+
type ReactiveValue<T> = T | (() => T);
|
|
17
|
+
type ViewportLike = {
|
|
18
|
+
getVisibleBounds?: () => BoundsLike | null | undefined;
|
|
19
|
+
toScreen?: (x: number, y: number) => ScreenPointLike;
|
|
20
|
+
screenWidth?: number;
|
|
21
|
+
screenHeight?: number;
|
|
22
|
+
};
|
|
23
|
+
export type NightSpot = PointLike & {
|
|
24
|
+
radius?: number;
|
|
25
|
+
intensity?: number;
|
|
26
|
+
flicker?: boolean;
|
|
27
|
+
flickerSpeed?: number;
|
|
28
|
+
pulse?: boolean;
|
|
29
|
+
pulseSpeed?: number;
|
|
30
|
+
phase?: number;
|
|
31
|
+
};
|
|
32
|
+
export type NightSpotInput = {
|
|
33
|
+
x: ReactiveValue<number>;
|
|
34
|
+
y: ReactiveValue<number>;
|
|
35
|
+
radius?: ReactiveValue<number>;
|
|
36
|
+
intensity?: ReactiveValue<number>;
|
|
37
|
+
flicker?: ReactiveValue<boolean>;
|
|
38
|
+
flickerSpeed?: ReactiveValue<number>;
|
|
39
|
+
pulse?: ReactiveValue<boolean>;
|
|
40
|
+
pulseSpeed?: ReactiveValue<number>;
|
|
41
|
+
phase?: ReactiveValue<number>;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Color input type supporting hex string, number, or RGB array.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* // Hex string
|
|
49
|
+
* const color1: ColorInput = "#0a1020";
|
|
50
|
+
* // Number
|
|
51
|
+
* const color2: ColorInput = 0x0a1020;
|
|
52
|
+
* // RGB tuple (0-255)
|
|
53
|
+
* const color3: ColorInput = [10, 16, 32];
|
|
54
|
+
* // Normalized RGB (0-1)
|
|
55
|
+
* const color4: ColorInput = [0.04, 0.06, 0.12];
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export type ColorInput = string | number | [number, number, number];
|
|
59
|
+
export type NightAmbiantProps = {
|
|
60
|
+
/** Main reactive list of light spots. */
|
|
61
|
+
lightSpots?: ReactiveValue<Array<NightSpotInput | NightSpot>>;
|
|
62
|
+
/** Alias for `lightSpots` for compatibility. */
|
|
63
|
+
spots?: ReactiveValue<Array<NightSpotInput | NightSpot>>;
|
|
64
|
+
/** Darkness intensity outside light spots (0 = no darkening, 1 = full black). Default: 0.75 */
|
|
65
|
+
darkness?: ReactiveValue<number>;
|
|
66
|
+
/** Tint color applied in dark zones. Default: "#000000" */
|
|
67
|
+
darkColor?: ReactiveValue<ColorInput>;
|
|
68
|
+
/** Fog color around light spots. Default: "#141424" */
|
|
69
|
+
fogColor?: ReactiveValue<ColorInput>;
|
|
70
|
+
/** Distance from light center where fog starts (0-1). Default: 0.5 */
|
|
71
|
+
fogRadius?: ReactiveValue<number>;
|
|
72
|
+
/** Width of the fog transition. Default: 0.35 */
|
|
73
|
+
fogSoftness?: ReactiveValue<number>;
|
|
74
|
+
};
|
|
75
|
+
export type NightFilter = Filter & {
|
|
76
|
+
setLightWorldPosition: (position: PointLike | null) => void;
|
|
77
|
+
getLightWorldPosition: () => PointLike | null;
|
|
78
|
+
setSpots: (spots: NightSpot[]) => void;
|
|
79
|
+
getSpots: () => NightSpot[];
|
|
80
|
+
syncLightToViewport: () => void;
|
|
81
|
+
setDarkness: (value: number) => void;
|
|
82
|
+
setDarkColor: (color: ColorInput) => void;
|
|
83
|
+
setFogColor: (color: ColorInput) => void;
|
|
84
|
+
setFogRadius: (value: number) => void;
|
|
85
|
+
setFogSoftness: (value: number) => void;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Creates a night filter with configurable light spots, darkness, and fog effects.
|
|
89
|
+
*
|
|
90
|
+
* The filter renders a dark overlay with circular light spots that illuminate areas.
|
|
91
|
+
* It supports multiple spots with individual intensity, radius, flicker, and pulse effects.
|
|
92
|
+
*
|
|
93
|
+
* @param viewport - Optional viewport for world-to-screen coordinate conversion
|
|
94
|
+
* @param options - Configuration options for the filter
|
|
95
|
+
* @returns A NightFilter instance with methods to control the effect
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* const filter = createNightFilter(viewport, {
|
|
100
|
+
* spots: [{ x: 100, y: 100, radius: 200, intensity: 1.0 }],
|
|
101
|
+
* darkness: 0.8,
|
|
102
|
+
* darkColor: "#0a1020",
|
|
103
|
+
* fogColor: "#141a2a",
|
|
104
|
+
* });
|
|
105
|
+
* container.filters = [filter];
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
export declare function createNightFilter(viewport?: ViewportLike, options?: {
|
|
109
|
+
lightWorldPosition?: PointLike | null;
|
|
110
|
+
spots?: NightSpot[];
|
|
111
|
+
getBounds?: () => BoundsLike | null | undefined;
|
|
112
|
+
darkness?: number;
|
|
113
|
+
darkColor?: ColorInput;
|
|
114
|
+
fogColor?: ColorInput;
|
|
115
|
+
fogRadius?: number;
|
|
116
|
+
fogSoftness?: number;
|
|
117
|
+
}): NightFilter;
|
|
118
|
+
/**
|
|
119
|
+
* Night ambiance component that adds a dark overlay with dynamic light spots.
|
|
120
|
+
*
|
|
121
|
+
* This component creates a night-time atmosphere with configurable darkness,
|
|
122
|
+
* fog effects, and multiple light sources. It automatically attaches to a
|
|
123
|
+
* Viewport if present in context, otherwise to the parent container.
|
|
124
|
+
*
|
|
125
|
+
* All props are reactive and support signal/function values.
|
|
126
|
+
*
|
|
127
|
+
* @param options - Configuration options for the night ambiance effect
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```html
|
|
131
|
+
* <Viewport worldWidth={2048} worldHeight={2048} screen>
|
|
132
|
+
* <NightAmbiant
|
|
133
|
+
* lightSpots={lightSpots}
|
|
134
|
+
* darkness={0.8}
|
|
135
|
+
* darkColor="#0a1020"
|
|
136
|
+
* fogColor="#141a2a"
|
|
137
|
+
* />
|
|
138
|
+
* </Viewport>
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
export declare function NightAmbiant(options?: NightAmbiantProps): import('../packages/core/src/index.ts').Element<import('../packages/core/src/index.ts').ComponentInstance> | Promise<import('../packages/core/src/index.ts').Element<import('../packages/core/src/index.ts').ComponentInstance>>;
|
|
142
|
+
export {};
|
|
3
143
|
//# sourceMappingURL=NightAmbiant.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NightAmbiant.d.ts","sourceRoot":"","sources":["../src/NightAmbiant.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NightAmbiant.d.ts","sourceRoot":"","sources":["../src/NightAmbiant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAgBjC,KAAK,SAAS,GAAG;IAAE,CAAC,EAAE,MAAM,C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AS,EAAE,CAAC;IAC5B,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAChC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,YAAY,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IAC1C,WAAW,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IACzC,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC,CAAC;AA+CF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,CAAC,EAAE,YAAY,EACvB,OAAO,CAAC,EAAE;IACR,kBAAkB,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IACtC,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,UAAU,GAAG,IAAI,GAAG,SAAS,CAAC;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GACA,WAAW,CA+Hb;AA6DD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,iBAAsB,gKAuF3D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fog.d.ts","sourceRoot":"","sources":["../../src/Weathers/fog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,wBAAgB,eAAe,IAAI,SAAS,
|
|
1
|
+
{"version":3,"file":"fog.d.ts","sourceRoot":"","sources":["../../src/Weathers/fog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,wBAAgB,eAAe,IAAI,SAAS,CAwF3C;AAED,wBAAgB,iBAAiB,IAAI,SAAS,CA2F7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Weathers/index.ts"],"names":[],"mappings":"AAeA;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,YAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Weathers/index.ts"],"names":[],"mappings":"AAeA;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,YAAO,iKA4QpC,CAAC;AAEF,eAAO,MAAM,OAAO,gLAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rain.d.ts","sourceRoot":"","sources":["../../src/Weathers/rain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,wBAAgB,gBAAgB,IAAI,SAAS,
|
|
1
|
+
{"version":3,"file":"rain.d.ts","sourceRoot":"","sources":["../../src/Weathers/rain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,wBAAgB,gBAAgB,IAAI,SAAS,CAgG5C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snow.d.ts","sourceRoot":"","sources":["../../src/Weathers/snow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,SAAS,
|
|
1
|
+
{"version":3,"file":"snow.d.ts","sourceRoot":"","sources":["../../src/Weathers/snow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,SAAS,CAwG5C"}
|