@newkrok/three-particles 0.8.1 → 0.8.4

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": "0.8.1",
3
+ "version": "0.8.4",
4
4
  "description": "Particle system for ThreeJS",
5
5
  "main": "src/js/three-particles.js",
6
6
  "bin": {
@@ -27,9 +27,9 @@
27
27
  "homepage": "https://github.com/NewKrok/three-particles#readme",
28
28
  "dependencies": {
29
29
  "easing-functions": "1.0.1",
30
- "three": "0.140.0",
30
+ "three": "^0.141.0",
31
31
  "three-noise": "1.1.2",
32
- "@newkrok/three-utils": "0.1.0"
32
+ "@newkrok/three-utils": "^0.3.0"
33
33
  },
34
34
  "scripts": {
35
35
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -72,7 +72,7 @@ export const calculateRandomPositionAndVelocityOnCone = (
72
72
 
73
73
  const positionLength = position.length();
74
74
  const normalizedAngle = Math.abs(
75
- (positionLength / radius) * THREE.Math.degToRad(angle)
75
+ (positionLength / radius) * THREE.MathUtils.degToRad(angle)
76
76
  );
77
77
  const sinNormalizedAngle = Math.sin(normalizedAngle);
78
78
 
@@ -195,8 +195,8 @@ export const calculateRandomPositionAndVelocityOnRectangle = (
195
195
  ) => {
196
196
  const xOffset = Math.random() * scale.x - scale.x / 2;
197
197
  const yOffset = Math.random() * scale.y - scale.y / 2;
198
- const rotationX = THREE.Math.degToRad(rotation.x);
199
- const rotationY = THREE.Math.degToRad(rotation.y);
198
+ const rotationX = THREE.MathUtils.degToRad(rotation.x);
199
+ const rotationY = THREE.MathUtils.degToRad(rotation.y);
200
200
  position.x = xOffset * Math.cos(rotationY);
201
201
  position.y = yOffset * Math.cos(rotationX);
202
202
  position.z = xOffset * Math.sin(rotationY) - yOffset * Math.sin(rotationX);
@@ -284,9 +284,10 @@ const calculatePositionAndVelocity = (
284
284
  };
285
285
 
286
286
  export const createParticleSystem = (
287
- config = DEFAULT_PARTICLE_SYSTEM_CONFIG
287
+ config = DEFAULT_PARTICLE_SYSTEM_CONFIG,
288
+ externalNow
288
289
  ) => {
289
- const now = Date.now();
290
+ const now = externalNow || Date.now();
290
291
  const generalData = {
291
292
  distanceFromLastEmitByDistance: 0,
292
293
  lastWorldPosition: new THREE.Vector3(-99999),
@@ -497,7 +498,7 @@ export const createParticleSystem = (
497
498
  createFloat32AttributesRequest("opacity", 0);
498
499
 
499
500
  createFloat32AttributesRequest("rotation", () =>
500
- THREE.Math.degToRad(
501
+ THREE.MathUtils.degToRad(
501
502
  THREE.MathUtils.randFloat(startRotation.min, startRotation.max)
502
503
  )
503
504
  );
@@ -576,7 +577,7 @@ export const createParticleSystem = (
576
577
  generalData.startValues.startOpacity[particleIndex] =
577
578
  THREE.MathUtils.randFloat(startOpacity.min, startOpacity.max);
578
579
 
579
- geometry.attributes.rotation.array[particleIndex] = THREE.Math.degToRad(
580
+ geometry.attributes.rotation.array[particleIndex] = THREE.MathUtils.degToRad(
580
581
  THREE.MathUtils.randFloat(startRotation.min, startRotation.max)
581
582
  );
582
583
 
@@ -656,9 +657,9 @@ export const createParticleSystem = (
656
657
  particleSystem.sortParticles = true;
657
658
 
658
659
  particleSystem.position.copy(transform.position);
659
- particleSystem.rotation.x = THREE.Math.degToRad(transform.rotation.x);
660
- particleSystem.rotation.y = THREE.Math.degToRad(transform.rotation.y);
661
- particleSystem.rotation.z = THREE.Math.degToRad(transform.rotation.z);
660
+ particleSystem.rotation.x = THREE.MathUtils.degToRad(transform.rotation.x);
661
+ particleSystem.rotation.y = THREE.MathUtils.degToRad(transform.rotation.y);
662
+ particleSystem.rotation.z = THREE.MathUtils.degToRad(transform.rotation.z);
662
663
  particleSystem.scale.copy(transform.scale);
663
664
 
664
665
  const calculatedCreationTime =
@@ -741,7 +742,6 @@ export const updateParticleSystems = ({ now, delta, elapsed }) => {
741
742
  worldQuaternion,
742
743
  worldEuler,
743
744
  gravityVelocity,
744
- hasOrbitalVelocity,
745
745
  } = generalData;
746
746
 
747
747
  if (wrapper) generalData.wrapperQuaternion.copy(wrapper.parent.quaternion);