simulationjsv2 0.2.2 → 0.2.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/dist/graphics.js CHANGED
@@ -838,7 +838,7 @@ export class SplinePoint2d {
838
838
  if (this.end.getColor()) {
839
839
  colors[1] = this.end.getColor();
840
840
  }
841
- if (colors.at(-1) === null) {
841
+ if (colors.length > 2 && colors.at(-1) === null) {
842
842
  colors.pop();
843
843
  }
844
844
  return colors;
@@ -917,7 +917,6 @@ export class Spline2d extends SimulationElement {
917
917
  if (index === this.curves.length)
918
918
  index--;
919
919
  const diff = (t - curveInterval * index) * 2;
920
- console.log(index);
921
920
  return this.curves[index].interpolateSlope(diff);
922
921
  }
923
922
  interpolate(t) {
@@ -962,9 +961,7 @@ export class Spline2d extends SimulationElement {
962
961
  const normal = vector2(-slope[1], slope[0]);
963
962
  vec2.normalize(normal, normal);
964
963
  vec2.scale(normal, this.thickness / 2, normal);
965
- const colorsBefore = this.curves[i].getColors();
966
- console.log(colorsBefore);
967
- const colors = colorsBefore.map((c) => (c ? c : this.getColor()));
964
+ const colors = this.curves[i].getColors().map((c) => (c ? c : this.getColor()));
968
965
  const vertexColor = interpolateColors(colors, currentInterpolation);
969
966
  const vertTop = vertex(point[0] + normal[0], point[1] + normal[1], 0, vertexColor);
970
967
  verticesTop.push(vertTop);
package/dist/utils.js CHANGED
@@ -331,8 +331,6 @@ export function interpolateColors(colors, t) {
331
331
  return colors[0];
332
332
  const colorInterval = 1 / colors.length;
333
333
  let index = Math.floor(t / colorInterval);
334
- if (index === -1)
335
- console.log(t);
336
334
  if (index >= colors.length)
337
335
  index = colors.length - 1;
338
336
  const from = index === colors.length - 1 ? colors[index - 1] : colors[index];
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "types": "./dist/index.d.ts",
6
6
  "author": "Jackson Otto",
7
7
  "description": "A simple graphics library using WebGPU",
8
- "version": "0.2.2",
8
+ "version": "0.2.3",
9
9
  "exports": {
10
10
  ".": {
11
11
  "import": "./dist/index.js",