@newkrok/three-particles 1.0.1 → 1.0.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newkrok/three-particles",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Particle system for ThreeJS",
5
5
  "main": "src/js/effects/three-particles.js",
6
6
  "bin": {
@@ -27,7 +27,7 @@
27
27
  "homepage": "https://github.com/NewKrok/three-particles#readme",
28
28
  "dependencies": {
29
29
  "easing-functions": "1.0.1",
30
- "three": "^0.144.0",
30
+ "three": "^0.155.0",
31
31
  "three-noise": "1.1.2",
32
32
  "@newkrok/three-utils": "^1.0.0"
33
33
  },
@@ -11,50 +11,110 @@ export type Transform = {
11
11
  };
12
12
 
13
13
  export type MinMaxNumber = {
14
- min: number;
15
- max: number;
14
+ min?: number;
15
+ max?: number;
16
16
  };
17
17
 
18
18
  export type Rgb = {
19
- r: number;
20
- g: number;
21
- b: number;
19
+ r?: number;
20
+ g?: number;
21
+ b?: number;
22
22
  };
23
23
 
24
24
  export type MinMaxColor = {
25
- min: Rgb;
26
- max: Rgb;
25
+ min?: Rgb;
26
+ max?: Rgb;
27
27
  };
28
28
 
29
29
  export type Emission = {
30
- rateOverTime: number;
31
- rateOverDistance: number;
30
+ rateOverTime?: number;
31
+ rateOverDistance?: number;
32
+ };
33
+
34
+ export const enum SimulationSpace {
35
+ LOCAL = "LOCAL",
36
+ WORLD = "WORLD",
37
+ }
38
+
39
+ export const enum Shape {
40
+ SPHERE = "SPHERE",
41
+ CONE = "CONE",
42
+ BOX = "BOX",
43
+ CIRCLE = "CIRCLE",
44
+ RECTANGLE = "RECTANGLE",
45
+ }
46
+
47
+ export const enum EmitFrom {
48
+ VOLUME = "VOLUME",
49
+ SHELL = "SHELL",
50
+ EDGE = "EDGE",
51
+ }
52
+
53
+ export const enum TimeMode {
54
+ LIFETIME = "LIFETIME",
55
+ FPS = "FPS",
56
+ }
57
+
58
+ export type ShapeConfig = {
59
+ shape?: Shape;
60
+ sphere?: {
61
+ radius?: number;
62
+ radiusThickness?: number;
63
+ arc?: number;
64
+ };
65
+ cone?: {
66
+ angle?: number;
67
+ radius?: number;
68
+ radiusThickness?: number;
69
+ arc?: number;
70
+ };
71
+ circle?: {
72
+ radius?: number;
73
+ radiusThickness?: number;
74
+ arc?: number;
75
+ };
76
+ rectangle?: {
77
+ rotation?: Point3D;
78
+ scale?: Point3D;
79
+ };
80
+ box?: {
81
+ scale?: Point3D;
82
+ emitFrom?: EmitFrom;
83
+ };
84
+ };
85
+
86
+ export type TextureSheetAnimation = {
87
+ tiles?: THREE.Vector2;
88
+ timeMode?: TimeMode;
89
+ fps?: number;
90
+ startFrame?: MinMaxNumber;
32
91
  };
33
92
 
34
93
  export type ParticleSystemConfig = {
35
- transform: Transform;
36
- duration: number;
37
- looping: boolean;
38
- startDelay: MinMaxNumber;
39
- startLifetime: MinMaxNumber;
40
- startSpeed: MinMaxNumber;
41
- startSize: MinMaxNumber;
42
- startRotation: MinMaxNumber;
43
- startColor: MinMaxColor;
44
- startOpacity: MinMaxNumber;
45
- gravity: number;
46
- simulationSpace: "LOCAL" | "WORLD";
47
- maxParticles: number;
48
- emission: Emission;
49
- shape: any;
50
- map: any;
51
- renderer: any;
52
- velocityOverLifetime: any;
53
- sizeOverLifetime: any;
54
- opacityOverLifetime: any;
55
- rotationOverLifetime: any;
56
- noise: any;
57
- textureSheetAnimation: any;
94
+ transform?: Transform;
95
+ duration?: number;
96
+ looping?: boolean;
97
+ startDelay?: MinMaxNumber;
98
+ startLifetime?: MinMaxNumber;
99
+ startSpeed?: MinMaxNumber;
100
+ startSize?: MinMaxNumber;
101
+ startRotation?: MinMaxNumber;
102
+ startColor?: MinMaxColor;
103
+ startOpacity?: MinMaxNumber;
104
+ gravity?: number;
105
+ simulationSpace?: SimulationSpace;
106
+ maxParticles?: number;
107
+ emission?: Emission;
108
+ shape?: ShapeConfig;
109
+ map?: THREE.Texture;
110
+ renderer?: any;
111
+ velocityOverLifetime?: any;
112
+ sizeOverLifetime?: any;
113
+ opacityOverLifetime?: any;
114
+ rotationOverLifetime?: any;
115
+ noise?: any;
116
+ textureSheetAnimation?: TextureSheetAnimation;
117
+ _editorData: any;
58
118
  };
59
119
 
60
120
  export type ParticleSystem = {
@@ -64,7 +124,15 @@ export type ParticleSystem = {
64
124
  dispose: () => void;
65
125
  };
66
126
 
127
+ export type CycleData = {
128
+ now: number,
129
+ delta: number,
130
+ elapsed: number,
131
+ };
132
+
67
133
  export function createParticleSystem(
68
134
  config: ParticleSystemConfig,
69
135
  externalNow?: number
70
136
  ): ParticleSystem;
137
+
138
+ export function updateParticleSystems(cycleData:CycleData): void;