shaders 2.3.54 → 2.3.56

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.
@@ -0,0 +1,148 @@
1
+ import { i as transformColorSpace, r as transformColor, s as transformPosition, t as colorSpaceOptions } from "./transformations-CC_c-QAT.js";
2
+ import { t as mixColors } from "./colorMixing-Ehw-Hfs_.js";
3
+ import { float, length, screenUV, smoothstep, vec2, vec4, viewportSize } from "three/tsl";
4
+ var transformStrokePosition = (value) => {
5
+ const mode = {
6
+ "outside": 0,
7
+ "center": 1,
8
+ "inside": 2
9
+ }[value.toLowerCase()];
10
+ if (mode === void 0) {
11
+ console.warn(`Invalid stroke position: ${value}. Defaulting to 'outside'.`);
12
+ return 0;
13
+ }
14
+ return mode;
15
+ };
16
+ const componentDefinition = {
17
+ name: "Circle",
18
+ category: "Textures",
19
+ description: "Generate a circle with adjustable size and softness",
20
+ props: {
21
+ color: {
22
+ default: "#ffffff",
23
+ transform: transformColor,
24
+ description: "The color of the circle",
25
+ ui: {
26
+ type: "color",
27
+ label: "Color",
28
+ group: "Colors"
29
+ }
30
+ },
31
+ radius: {
32
+ default: 1,
33
+ description: "The radius of the circle. A value of one (1) is sets the circle to fit the canvas.",
34
+ ui: {
35
+ type: "range",
36
+ min: 0,
37
+ max: 2,
38
+ step: .05,
39
+ label: "Radius",
40
+ group: "Effect"
41
+ }
42
+ },
43
+ softness: {
44
+ default: 0,
45
+ description: "Edge softness. Lower values like zero (0) are sharp, higher values like one (1) are softer.",
46
+ ui: {
47
+ type: "range",
48
+ min: 0,
49
+ max: 1,
50
+ step: .01,
51
+ label: "Softness",
52
+ group: "Effect"
53
+ }
54
+ },
55
+ center: {
56
+ default: {
57
+ x: .5,
58
+ y: .5
59
+ },
60
+ transform: transformPosition,
61
+ description: "The center point of the circle",
62
+ ui: {
63
+ type: "position",
64
+ label: "Center Position",
65
+ group: "Position"
66
+ }
67
+ },
68
+ strokeThickness: {
69
+ default: 0,
70
+ description: "The thickness of the stroke outline. Zero (0) means no stroke.",
71
+ ui: {
72
+ type: "range",
73
+ min: 0,
74
+ max: .5,
75
+ step: .01,
76
+ label: "Stroke Thickness",
77
+ group: "Stroke"
78
+ }
79
+ },
80
+ strokeColor: {
81
+ default: "#000000",
82
+ transform: transformColor,
83
+ description: "The color of the stroke outline",
84
+ ui: {
85
+ type: "color",
86
+ label: "Stroke Color",
87
+ group: "Colors"
88
+ }
89
+ },
90
+ strokePosition: {
91
+ default: "center",
92
+ transform: transformStrokePosition,
93
+ description: "Position of the stroke relative to the circle edge",
94
+ ui: {
95
+ type: "select",
96
+ options: [
97
+ {
98
+ label: "Outside",
99
+ value: "outside"
100
+ },
101
+ {
102
+ label: "Center",
103
+ value: "center"
104
+ },
105
+ {
106
+ label: "Inside",
107
+ value: "inside"
108
+ }
109
+ ],
110
+ label: "Stroke Position",
111
+ group: "Stroke"
112
+ }
113
+ },
114
+ colorSpace: {
115
+ default: "linear",
116
+ transform: transformColorSpace,
117
+ description: "Color space for blending fill and stroke colors in soft edges",
118
+ ui: {
119
+ type: "select",
120
+ options: colorSpaceOptions,
121
+ label: "Color Blending",
122
+ group: "Colors"
123
+ }
124
+ }
125
+ },
126
+ fragmentNode: ({ uniforms }) => {
127
+ const uv$1 = screenUV;
128
+ const aspect = viewportSize.x.div(viewportSize.y);
129
+ const aspectCorrectedUV = vec2(uv$1.x.mul(aspect), uv$1.y);
130
+ const centerPos = vec2(uniforms.center.uniform.x.mul(aspect), uniforms.center.uniform.y.oneMinus());
131
+ const distanceFromCenter = length(aspectCorrectedUV.sub(centerPos));
132
+ const edgeSoftness = uniforms.softness.uniform;
133
+ const circleEdge = uniforms.radius.uniform.mul(.5);
134
+ const strokeThickness = uniforms.strokeThickness.uniform;
135
+ const strokePositionMode = uniforms.strokePosition.uniform;
136
+ const isCenter = strokePositionMode.greaterThanEqual(float(.5)).and(strokePositionMode.lessThan(float(1.5)));
137
+ const isInside = strokePositionMode.greaterThanEqual(float(1.5));
138
+ const halfThickness = strokeThickness.mul(.5);
139
+ const strokeInner = isInside.select(circleEdge.sub(strokeThickness), isCenter.select(circleEdge.sub(halfThickness), circleEdge));
140
+ const strokeOuter = isInside.select(circleEdge, isCenter.select(circleEdge.add(halfThickness), circleEdge.add(strokeThickness)));
141
+ const overallMask = smoothstep(strokeOuter.sub(edgeSoftness), strokeOuter, distanceFromCenter).oneMinus();
142
+ const strokeBlend = strokeThickness.greaterThan(float(0)).select(smoothstep(strokeInner.sub(edgeSoftness), strokeInner, distanceFromCenter), float(0));
143
+ const blendedColor = mixColors(vec4(uniforms.color.uniform.rgb, uniforms.color.uniform.a), vec4(uniforms.strokeColor.uniform.rgb, uniforms.strokeColor.uniform.a), strokeBlend, uniforms.colorSpace.uniform);
144
+ return vec4(blendedColor.xyz, blendedColor.w.mul(overallMask));
145
+ }
146
+ };
147
+ var Circle_default = componentDefinition;
148
+ export { componentDefinition as n, Circle_default as t };
@@ -258,6 +258,8 @@ function applyMask(target, mask, maskType = "alpha") {
258
258
  }
259
259
  var PerformanceTracker = class {
260
260
  frameTimesMs = [];
261
+ frameTimesIndex = 0;
262
+ frameTimesCount = 0;
261
263
  maxSamples = 60;
262
264
  targetFrameTime = 16.67;
263
265
  jankFrameCount = 0;
@@ -272,16 +274,37 @@ var PerformanceTracker = class {
272
274
  isRendering = false;
273
275
  lastFrameTimestamp = 0;
274
276
  frameIntervals = [];
277
+ frameIntervalsIndex = 0;
278
+ frameIntervalsCount = 0;
279
+ pushToCircularBuffer(buffer, value, index, _count, maxSize) {
280
+ if (buffer.length < maxSize) {
281
+ buffer.push(value);
282
+ return {
283
+ index: buffer.length,
284
+ count: buffer.length
285
+ };
286
+ }
287
+ buffer[index % maxSize] = value;
288
+ return {
289
+ index: index + 1,
290
+ count: maxSize
291
+ };
292
+ }
293
+ getBufferValues(buffer, count) {
294
+ return count <= buffer.length ? buffer.slice(0, count) : buffer;
295
+ }
275
296
  recordFrame(frameTimeMs) {
276
- this.frameTimesMs.push(frameTimeMs);
277
- if (this.frameTimesMs.length > this.maxSamples) this.frameTimesMs.shift();
297
+ const result = this.pushToCircularBuffer(this.frameTimesMs, frameTimeMs, this.frameTimesIndex, this.frameTimesCount, this.maxSamples);
298
+ this.frameTimesIndex = result.index;
299
+ this.frameTimesCount = result.count;
278
300
  this.totalFrameCount++;
279
301
  if (frameTimeMs > this.targetFrameTime) this.jankFrameCount++;
280
302
  const now = performance.now();
281
303
  if (this.lastFrameTimestamp > 0) {
282
304
  const interval = now - this.lastFrameTimestamp;
283
- this.frameIntervals.push(interval);
284
- if (this.frameIntervals.length > this.maxSamples) this.frameIntervals.shift();
305
+ const intervalResult = this.pushToCircularBuffer(this.frameIntervals, interval, this.frameIntervalsIndex, this.frameIntervalsCount, this.maxSamples);
306
+ this.frameIntervalsIndex = intervalResult.index;
307
+ this.frameIntervalsCount = intervalResult.count;
285
308
  }
286
309
  this.lastFrameTimestamp = now;
287
310
  this.recordMemorySnapshot();
@@ -357,12 +380,13 @@ var PerformanceTracker = class {
357
380
  return this.nodeCount + this.rttNodeCount * 10;
358
381
  }
359
382
  calculateIntensityScore() {
360
- const frameCount = this.frameTimesMs.length;
383
+ const frameTimes = this.getBufferValues(this.frameTimesMs, this.frameTimesCount);
384
+ const frameCount = frameTimes.length;
361
385
  if (frameCount === 0) return {
362
386
  score: 0,
363
387
  label: "N/A"
364
388
  };
365
- const avgFrameTime = this.frameTimesMs.reduce((a, b) => a + b, 0) / frameCount;
389
+ const avgFrameTime = frameTimes.reduce((a, b) => a + b, 0) / frameCount;
366
390
  const frameTimeScore = Math.min(avgFrameTime / 16.67 * 100, 100);
367
391
  const complexity = this.calculateComplexityScore();
368
392
  const complexityScore = Math.min(complexity / 100 * 100, 100);
@@ -390,13 +414,15 @@ var PerformanceTracker = class {
390
414
  };
391
415
  }
392
416
  getStats(rendererInfo) {
393
- const frameCount = this.frameTimesMs.length;
394
- const fps = this.frameIntervals.length > 0 ? 1e3 / (this.frameIntervals.reduce((a, b) => a + b, 0) / this.frameIntervals.length) : 0;
395
- const avgFrameTime = frameCount > 0 ? this.frameTimesMs.reduce((a, b) => a + b, 0) / frameCount : 0;
396
- const minFrameTime = frameCount > 0 ? Math.min(...this.frameTimesMs) : 0;
397
- const maxFrameTime = frameCount > 0 ? Math.max(...this.frameTimesMs) : 0;
398
- const p99FrameTime = this.calculateP99(this.frameTimesMs);
399
- const stdDevFrameTime = this.calculateStdDev(this.frameTimesMs);
417
+ const frameTimes = this.getBufferValues(this.frameTimesMs, this.frameTimesCount);
418
+ const intervals = this.getBufferValues(this.frameIntervals, this.frameIntervalsCount);
419
+ const frameCount = frameTimes.length;
420
+ const fps = intervals.length > 0 ? 1e3 / (intervals.reduce((a, b) => a + b, 0) / intervals.length) : 0;
421
+ const avgFrameTime = frameCount > 0 ? frameTimes.reduce((a, b) => a + b, 0) / frameCount : 0;
422
+ const minFrameTime = frameCount > 0 ? Math.min(...frameTimes) : 0;
423
+ const maxFrameTime = frameCount > 0 ? Math.max(...frameTimes) : 0;
424
+ const p99FrameTime = this.calculateP99(frameTimes);
425
+ const stdDevFrameTime = this.calculateStdDev(frameTimes);
400
426
  const jankPercent = this.totalFrameCount > 0 ? this.jankFrameCount / this.totalFrameCount * 100 : 0;
401
427
  const memory = performance.memory;
402
428
  const memoryUsedMB = memory ? memory.usedJSHeapSize / (1024 * 1024) : null;
@@ -433,7 +459,11 @@ var PerformanceTracker = class {
433
459
  }
434
460
  reset() {
435
461
  this.frameTimesMs.length = 0;
462
+ this.frameTimesIndex = 0;
463
+ this.frameTimesCount = 0;
436
464
  this.frameIntervals.length = 0;
465
+ this.frameIntervalsIndex = 0;
466
+ this.frameIntervalsCount = 0;
437
467
  this.lastFrameTimestamp = 0;
438
468
  this.jankFrameCount = 0;
439
469
  this.totalFrameCount = 0;
@@ -654,7 +684,7 @@ function shaderRenderer() {
654
684
  });
655
685
  });
656
686
  lastRenderTime = 0;
657
- renderFrame().catch(console.warn);
687
+ renderFrame();
658
688
  });
659
689
  }
660
690
  };
@@ -755,7 +785,7 @@ function shaderRenderer() {
755
785
  isUpdatingMaterial = false;
756
786
  pendingNodeRemoval = false;
757
787
  }
758
- if (!animationFrameId) renderFrame().catch(console.warn);
788
+ if (!animationFrameId) renderFrame();
759
789
  };
760
790
  const findChildNodes = (parentId) => {
761
791
  const childIds = parentToChildren.get(parentId);
@@ -1120,7 +1150,7 @@ function shaderRenderer() {
1120
1150
  if (!uniformDefinition || !uniformDefinition.uniform) return;
1121
1151
  if (uniformDefinition.transform) updateUniformValue(uniformDefinition, value);
1122
1152
  else uniformDefinition.uniform.value = value;
1123
- if (!animationFrameId) renderFrame().catch(console.warn);
1153
+ if (!animationFrameId) renderFrame();
1124
1154
  };
1125
1155
  const updateNodeMetadata = (nodeId, metadata) => {
1126
1156
  const existingNode = nodeRegistry.nodes.get(nodeId);
@@ -1185,7 +1215,7 @@ function shaderRenderer() {
1185
1215
  materialUpdateBatchRAF = null;
1186
1216
  updateMaterial();
1187
1217
  });
1188
- } else if (!animationFrameId) renderFrame().catch(console.warn);
1218
+ } else if (!animationFrameId) renderFrame();
1189
1219
  };
1190
1220
  const removeNode = (id) => {
1191
1221
  if (!nodeRegistry.nodes.has(id)) return;
@@ -1254,7 +1284,7 @@ function shaderRenderer() {
1254
1284
  };
1255
1285
  const renderAndWait = async () => {
1256
1286
  if (!canRender()) throw new Error("Renderer is not ready");
1257
- await renderFrame();
1287
+ renderFrame();
1258
1288
  if (renderer instanceof WebGPURenderer) try {
1259
1289
  const backend = renderer.backend;
1260
1290
  if (backend?.device) await backend.device.queue.onSubmittedWorkDone();
@@ -1262,7 +1292,7 @@ function shaderRenderer() {
1262
1292
  await new Promise((resolve) => setTimeout(resolve, 16));
1263
1293
  }
1264
1294
  };
1265
- const renderFrame = async () => {
1295
+ const renderFrame = () => {
1266
1296
  if (pendingNodeRemoval) return;
1267
1297
  if (!canRender()) return;
1268
1298
  const frameStartTime = enablePerformanceTracking ? performance.now() : 0;
@@ -1335,15 +1365,23 @@ function shaderRenderer() {
1335
1365
  const startAnimation = () => {
1336
1366
  if (animationFrameId || !shouldAnimate) return;
1337
1367
  performanceTracker.setRendering(true);
1338
- const animate = () => {
1339
- animationFrameId = requestAnimationFrame(animate);
1340
- renderFrame().catch(console.warn);
1341
- };
1342
- animate();
1368
+ if (renderer && "setAnimationLoop" in renderer && typeof renderer.setAnimationLoop === "function") {
1369
+ renderer.setAnimationLoop(() => {
1370
+ renderFrame();
1371
+ });
1372
+ animationFrameId = 1;
1373
+ } else {
1374
+ const animate = () => {
1375
+ renderFrame();
1376
+ animationFrameId = requestAnimationFrame(animate);
1377
+ };
1378
+ animate();
1379
+ }
1343
1380
  };
1344
1381
  const stopAnimation = () => {
1345
1382
  if (animationFrameId) {
1346
- cancelAnimationFrame(animationFrameId);
1383
+ if (renderer && "setAnimationLoop" in renderer && typeof renderer.setAnimationLoop === "function") renderer.setAnimationLoop(null);
1384
+ else cancelAnimationFrame(animationFrameId);
1347
1385
  animationFrameId = null;
1348
1386
  }
1349
1387
  performanceTracker.setRendering(false);
@@ -1377,20 +1415,20 @@ function shaderRenderer() {
1377
1415
  const globalMouseUpHandler = () => {
1378
1416
  if (!isInitialized) return;
1379
1417
  pointerActive = false;
1380
- if (!animationFrameId) renderFrame().catch(console.warn);
1418
+ if (!animationFrameId) renderFrame();
1381
1419
  };
1382
1420
  const globalTouchEndHandler = () => {
1383
1421
  if (!isInitialized) return;
1384
1422
  pointerActive = false;
1385
- if (!animationFrameId) renderFrame().catch(console.warn);
1423
+ if (!animationFrameId) renderFrame();
1386
1424
  };
1387
1425
  const canvasMouseDownHandler = () => {
1388
1426
  pointerActive = true;
1389
- if (!animationFrameId) renderFrame().catch(console.warn);
1427
+ if (!animationFrameId) renderFrame();
1390
1428
  };
1391
1429
  const canvasTouchStartHandler = () => {
1392
1430
  pointerActive = true;
1393
- if (!animationFrameId) renderFrame().catch(console.warn);
1431
+ if (!animationFrameId) renderFrame();
1394
1432
  };
1395
1433
  const processQueuedRegistrations = () => {
1396
1434
  if (pendingRegistrationQueue.length === 0) return;
@@ -1398,7 +1436,7 @@ function shaderRenderer() {
1398
1436
  pendingRegistrationQueue = [];
1399
1437
  for (const { id, fragmentNodeFunc, parentId, metadata, uniforms, componentDefinition } of queue) if (fragmentNodeFunc) registerNode(id, fragmentNodeFunc, parentId, metadata, uniforms, componentDefinition);
1400
1438
  };
1401
- const initialize = async ({ canvas, enablePerformanceTracking: enableTracking = true }) => {
1439
+ const initialize = async ({ canvas, enablePerformanceTracking: enableTracking = false }) => {
1402
1440
  if (isInitialized || isInitializing) return;
1403
1441
  enablePerformanceTracking = enableTracking;
1404
1442
  isInitializing = true;
@@ -1425,18 +1463,13 @@ function shaderRenderer() {
1425
1463
  window.addEventListener("beforeunload", unloadHandler);
1426
1464
  if (localAbortController.signal.aborted) return;
1427
1465
  try {
1428
- const rendererOptions = {
1466
+ renderer = new WebGPURenderer({
1429
1467
  canvas,
1430
1468
  antialias: true,
1431
1469
  alpha: true,
1432
1470
  depth: false,
1433
1471
  powerPreference: "high-performance"
1434
- };
1435
- if (enablePerformanceTracking) {
1436
- rendererOptions.forceWebGL = false;
1437
- rendererOptions.requiredFeatures = ["timestamp-query"];
1438
- }
1439
- renderer = new WebGPURenderer(rendererOptions);
1472
+ });
1440
1473
  await renderer.init();
1441
1474
  if (localAbortController.signal.aborted) return;
1442
1475
  } catch (e) {
@@ -1493,7 +1526,7 @@ function shaderRenderer() {
1493
1526
  camera.bottom = -frustumHeight / 2;
1494
1527
  camera.updateProjectionMatrix();
1495
1528
  mesh.scale.set(frustumWidth, frustumHeight, 1);
1496
- await renderFrame();
1529
+ renderFrame();
1497
1530
  } else hasInitialDimensions = false;
1498
1531
  if (shouldAnimate) startAnimation();
1499
1532
  if (!localAbortController.signal.aborted) {
@@ -28,6 +28,8 @@ export interface PerformanceStats {
28
28
  }
29
29
  export declare class PerformanceTracker {
30
30
  private frameTimesMs;
31
+ private frameTimesIndex;
32
+ private frameTimesCount;
31
33
  private readonly maxSamples;
32
34
  private readonly targetFrameTime;
33
35
  private jankFrameCount;
@@ -42,6 +44,16 @@ export declare class PerformanceTracker {
42
44
  private isRendering;
43
45
  private lastFrameTimestamp;
44
46
  private frameIntervals;
47
+ private frameIntervalsIndex;
48
+ private frameIntervalsCount;
49
+ /**
50
+ * Adds a value to a circular buffer, returning the active slice for calculations
51
+ */
52
+ private pushToCircularBuffer;
53
+ /**
54
+ * Gets the active values from a circular buffer
55
+ */
56
+ private getBufferValues;
45
57
  /**
46
58
  * Records a frame's render time
47
59
  */
@@ -1 +1 @@
1
- {"version":3,"file":"performanceTracker.d.ts","sourceRoot":"","sources":["../src/performanceTracker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,gBAAgB;IAE7B,GAAG,EAAE,MAAM,CAAA;IACX,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;IAGvB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IAGnB,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;IAGvB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IAG/B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,UAAU,EAAE,MAAM,CAAA;IAGlB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAG3B,cAAc,EAAE,MAAM,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IAGtB,WAAW,EAAE,OAAO,CAAA;CACvB;AA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
  import { n as componentDefinition$9 } from "./Checkerboard-XJh_tV6B.js";
15
15
  import { n as componentDefinition$10 } from "./ChromaFlow-Cc647Knw.js";
16
16
  import { n as componentDefinition$11 } from "./ChromaticAberration-CYvju_kr.js";
17
- import { n as componentDefinition$12 } from "./Circle-C9DYXDnD.js";
17
+ import { n as componentDefinition$12 } from "./Circle-ChQqil0S.js";
18
18
  import { n as componentDefinition$13 } from "./ConcentricSpin-CnuAW_6I.js";
19
19
  import { n as componentDefinition$14 } from "./ContourLines-DJ0R9q6Y.js";
20
20
  import { n as componentDefinition$15 } from "./CRTScreen-BHKDJ9_0.js";
@@ -1 +1 @@
1
- {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../src/renderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,KAAK,IAAI,EAMZ,MAAM,cAAc,CAAA;AAKrB,OAAO,EAAC,eAAe,EAAE,mBAAmB,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAC,MAAM,SAAS,CAAA;AACvH,OAAO,EAAqB,gBAAgB,EAAC,MAAM,sBAAsB,CAAA;AAKzE;;GAEG;AACH,UAAU,QAAQ;IAEd;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAA;IAEV;;OAEG;IACH,aAAa,EAAE,MAAM,CAAA;IAErB;;OAEG;IACH,gBAAgB,EAAE,mBAAmB,CAAC,cAAc,CAAC,CAAA;IAErD;;OAEG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IAEvB;;OAEG;IACH,WAAW,EAAE,OAAO,CAAA;IAEpB;;;;OAIG;IACH,aAAa,EAAE,OAAO,CAAA;IAEtB;;OAEG;IACH,cAAc,EAAE,GAAG,CAAA;IAEnB;;OAEG;IACH,QAAQ,EAAE,YAAY,CAAA;IAEtB;;OAEG;IACH,QAAQ,EAAE,WAAW,CAAA;IAErB;;;OAGG;IACH,gBAAgB,EAAE,eAAe,EAAE,CAAA;IAEnC;;;OAGG;IACH,qBAAqB,EA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AM,CAAC,gBACb,IAAI,KACnB,IAAI;0CAuCK,IAAI,YACF,QAAQ,KACnB,IAAI;;;;EA2/CV"}
@@ -30,6 +30,34 @@ export interface ComponentProps {
30
30
  * @default {"x":0.5,"y":0.5}
31
31
  */
32
32
  center: Parameters<typeof transformPosition>[0];
33
+ /**
34
+ * The thickness of the stroke outline. Zero (0) means no stroke.
35
+ *
36
+ * Accepts a number between 0 and 0.5.
37
+ * @default 0
38
+ */
39
+ strokeThickness: number;
40
+ /**
41
+ * The color of the stroke outline
42
+ *
43
+ * Accepts hex strings (`#ff0000`), RGB objects (`{ r, g, b }`), or CSS color names (`limegreen`).
44
+ * @default "#000000"
45
+ */
46
+ strokeColor: Parameters<typeof transformColor>[0];
47
+ /**
48
+ * Position of the stroke relative to the circle edge
49
+ *
50
+ * Accepts one of: `"outside"`, `"center"`, `"inside"`.
51
+ * @default "center"
52
+ */
53
+ strokePosition: string;
54
+ /**
55
+ * Color space for blending fill and stroke colors in soft edges
56
+ *
57
+ * Accepts one of the predefined option values.
58
+ * @default "linear"
59
+ */
60
+ colorSpace: string;
33
61
  }
34
62
  export declare const componentDefinition: ComponentDefinition<ComponentProps>;
35
63
  export default componentDefinition;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shaders/Circle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAqB,MAAM,iBAAiB,CAAA;AAIvE,OAAO,EAAC,cAAc,EAAE,iBAAiB,EAAC,MAAM,qCAAqC,CAAA;AAErF,MAAM,WAAW,cAAc;IAC3B,KAAK,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAA;CAClD;AAED,eAAO,MAAM,mBAAmB,EAAE,mBAAmB,CAAC,cAAc,CA2EnE,CAAA;AAED,eAAe,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shaders/Circle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAqB,MAAM,iBAAiB,CAAA;AAGvE,OAAO,EAAC,cAAc,EAAE,iBAAiB,EAAyC,MAAM,qCAAqC,CAAA;AAwB7H,MAAM,WAAW,cAAc;IAC3B,KAAK,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;IAChD,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;IAClD,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAA;CACrB;AAED,eAAO,MAAM,mBAAmB,EAAE,mBAAmB,CAAC,cAAc,CA6JnE,CAAA;AAED,eAAe,mBAAmB,CAAA"}
@@ -1,3 +1,4 @@
1
1
  import "../../transformations-CC_c-QAT.js";
2
- import { n as componentDefinition, t as Circle_default } from "../../Circle-C9DYXDnD.js";
2
+ import "../../colorMixing-Ehw-Hfs_.js";
3
+ import { n as componentDefinition, t as Circle_default } from "../../Circle-ChQqil0S.js";
3
4
  export { componentDefinition, Circle_default as default };
@@ -2,7 +2,7 @@ const TELEMETRY_CONFIG = {
2
2
  samplingRate: .01,
3
3
  collectionDuration: 5e3,
4
4
  warmupDuration: 500,
5
- sampleInterval: 100,
5
+ sampleInterval: 500,
6
6
  apiEndpoint: "https://shaders.com/api/telemetry"
7
7
  };
8
8
  function detectBrowserFamily(userAgent) {
@@ -68,7 +68,7 @@ var TelemetryCollector = class {
68
68
  clearInterval(this.sampleInterval);
69
69
  this.sampleInterval = null;
70
70
  }
71
- if (!this.stopped && this.frameSamples.length >= 50) {
71
+ if (!this.stopped && this.frameSamples.length >= 5) {
72
72
  const payload = this.aggregateData();
73
73
  await this.sendTelemetry(payload);
74
74
  }
@@ -1 +1 @@
1
- {"version":3,"file":"generatePresetCode.d.ts","sourceRoot":"","sources":["../../src/utils/generatePresetCode.ts"],"names":[],"mappings":"AAAA,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC3B,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAA;CAC7B;AAED,UAAU,YAAY;IACpB,UAAU,EAAE,eAAe,EAAE,CAAA;CAC9B;AAq4BD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAyC/D;AAGD,eAAO,MAAM,mBAAmB,UA4E/B,CAAA"}
1
+ {"version":3,"file":"generatePresetCode.d.ts","sourceRoot":"","sources":["../../src/utils/generatePresetCode.ts"],"names":[],"mappings":"AAAA,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC3B,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAA;CAC7B;AAED,UAAU,YAAY;IACpB,UAAU,EAAE,eAAe,EAAE,CAAA;CAC9B;AAy4BD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAyC/D;AAGD,eAAO,MAAM,mBAAmB,UA4E/B,CAAA"}
@@ -162,7 +162,11 @@ var shaderMetadata = {
162
162
  "center": {
163
163
  "x": .5,
164
164
  "y": .5
165
- }
165
+ },
166
+ "strokeThickness": 0,
167
+ "strokeColor": "#000000",
168
+ "strokePosition": "center",
169
+ "colorSpace": "linear"
166
170
  },
167
171
  "ConcentricSpin": {
168
172
  "opacity": 1,
package/dist/registry.js CHANGED
@@ -2182,7 +2182,7 @@ export const shaderRegistry = [
2182
2182
  "type": "range",
2183
2183
  "min": 0,
2184
2184
  "max": 1,
2185
- "step": 0.05,
2185
+ "step": 0.01,
2186
2186
  "label": "Softness",
2187
2187
  "group": "Effect"
2188
2188
  }
@@ -2198,6 +2198,73 @@ export const shaderRegistry = [
2198
2198
  "label": "Center Position",
2199
2199
  "group": "Position"
2200
2200
  }
2201
+ },
2202
+ "strokeThickness": {
2203
+ "default": 0,
2204
+ "description": "The thickness of the stroke outline. Zero (0) means no stroke.",
2205
+ "ui": {
2206
+ "type": "range",
2207
+ "min": 0,
2208
+ "max": 0.5,
2209
+ "step": 0.01,
2210
+ "label": "Stroke Thickness",
2211
+ "group": "Stroke"
2212
+ }
2213
+ },
2214
+ "strokeColor": {
2215
+ "default": "#000000",
2216
+ "description": "The color of the stroke outline",
2217
+ "ui": {
2218
+ "type": "color",
2219
+ "label": "Stroke Color",
2220
+ "group": "Colors"
2221
+ }
2222
+ },
2223
+ "strokePosition": {
2224
+ "default": "center",
2225
+ "description": "Position of the stroke relative to the circle edge",
2226
+ "ui": {
2227
+ "type": "select",
2228
+ "options": [
2229
+ {
2230
+ "label": "Outside",
2231
+ "value": "outside"
2232
+ },
2233
+ {
2234
+ "label": "Center",
2235
+ "value": "center"
2236
+ },
2237
+ {
2238
+ "label": "Inside",
2239
+ "value": "inside"
2240
+ }
2241
+ ],
2242
+ "label": "Stroke Position",
2243
+ "group": "Stroke"
2244
+ }
2245
+ },
2246
+ "colorSpace": {
2247
+ "default": "linear",
2248
+ "description": "Color space for blending fill and stroke colors in soft edges",
2249
+ "ui": {
2250
+ "type": "select",
2251
+ "options": [
2252
+ {
2253
+ "label": "Linear RGB",
2254
+ "value": "linear"
2255
+ },
2256
+ {
2257
+ "label": "OKLCh",
2258
+ "value": "oklch"
2259
+ },
2260
+ {
2261
+ "label": "OKLAB",
2262
+ "value": "oklab"
2263
+ }
2264
+ ],
2265
+ "label": "Color Blending",
2266
+ "group": "Colors"
2267
+ }
2201
2268
  }
2202
2269
  }
2203
2270
  },
@@ -2228,7 +2295,7 @@ export const shaderRegistry = [
2228
2295
  "type": "range",
2229
2296
  "min": 0,
2230
2297
  "max": 1,
2231
- "step": 0.05,
2298
+ "step": 0.01,
2232
2299
  "label": "Softness",
2233
2300
  "group": "Effect"
2234
2301
  },
@@ -2246,6 +2313,73 @@ export const shaderRegistry = [
2246
2313
  "y": 0.5
2247
2314
  },
2248
2315
  "description": "The center point of the circle"
2316
+ },
2317
+ "strokeThickness": {
2318
+ "ui": {
2319
+ "type": "range",
2320
+ "min": 0,
2321
+ "max": 0.5,
2322
+ "step": 0.01,
2323
+ "label": "Stroke Thickness",
2324
+ "group": "Stroke"
2325
+ },
2326
+ "default": 0,
2327
+ "description": "The thickness of the stroke outline. Zero (0) means no stroke."
2328
+ },
2329
+ "strokeColor": {
2330
+ "ui": {
2331
+ "type": "color",
2332
+ "label": "Stroke Color",
2333
+ "group": "Colors"
2334
+ },
2335
+ "default": "#000000",
2336
+ "description": "The color of the stroke outline"
2337
+ },
2338
+ "strokePosition": {
2339
+ "ui": {
2340
+ "type": "select",
2341
+ "options": [
2342
+ {
2343
+ "label": "Outside",
2344
+ "value": "outside"
2345
+ },
2346
+ {
2347
+ "label": "Center",
2348
+ "value": "center"
2349
+ },
2350
+ {
2351
+ "label": "Inside",
2352
+ "value": "inside"
2353
+ }
2354
+ ],
2355
+ "label": "Stroke Position",
2356
+ "group": "Stroke"
2357
+ },
2358
+ "default": "center",
2359
+ "description": "Position of the stroke relative to the circle edge"
2360
+ },
2361
+ "colorSpace": {
2362
+ "ui": {
2363
+ "type": "select",
2364
+ "options": [
2365
+ {
2366
+ "label": "Linear RGB",
2367
+ "value": "linear"
2368
+ },
2369
+ {
2370
+ "label": "OKLCh",
2371
+ "value": "oklch"
2372
+ },
2373
+ {
2374
+ "label": "OKLAB",
2375
+ "value": "oklab"
2376
+ }
2377
+ ],
2378
+ "label": "Color Blending",
2379
+ "group": "Colors"
2380
+ },
2381
+ "default": "linear",
2382
+ "description": "Color space for blending fill and stroke colors in soft edges"
2249
2383
  }
2250
2384
  }
2251
2385
  },
@@ -1 +1 @@
1
- {"version":3,"file":"generatePresetCode.d.ts","sourceRoot":"","sources":["../../src/utils/generatePresetCode.ts"],"names":[],"mappings":"AAAA,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC3B,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAA;CAC7B;AAED,UAAU,YAAY;IACpB,UAAU,EAAE,eAAe,EAAE,CAAA;CAC9B;AAu4BD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAyC/D;AAGD,eAAO,MAAM,mBAAmB,UA4E/B,CAAA"}
1
+ {"version":3,"file":"generatePresetCode.d.ts","sourceRoot":"","sources":["../../src/utils/generatePresetCode.ts"],"names":[],"mappings":"AAAA,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC3B,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAA;CAC7B;AAED,UAAU,YAAY;IACpB,UAAU,EAAE,eAAe,EAAE,CAAA;CAC9B;AA24BD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAyC/D;AAGD,eAAO,MAAM,mBAAmB,UA4E/B,CAAA"}
@@ -164,7 +164,11 @@ const shaderMetadata = {
164
164
  "center": {
165
165
  "x": 0.5,
166
166
  "y": 0.5
167
- }
167
+ },
168
+ "strokeThickness": 0,
169
+ "strokeColor": "#000000",
170
+ "strokePosition": "center",
171
+ "colorSpace": "linear"
168
172
  },
169
173
  "ConcentricSpin": {
170
174
  "opacity": 1,
@@ -162,7 +162,11 @@ var shaderMetadata = {
162
162
  "center": {
163
163
  "x": .5,
164
164
  "y": .5
165
- }
165
+ },
166
+ "strokeThickness": 0,
167
+ "strokeColor": "#000000",
168
+ "strokePosition": "center",
169
+ "colorSpace": "linear"
166
170
  },
167
171
  "ConcentricSpin": {
168
172
  "opacity": 1,
@@ -1,4 +1,4 @@
1
- import { n as generatePresetCode } from "./generatePresetCode-DN-iUvZN.js";
1
+ import { n as generatePresetCode } from "./generatePresetCode-CO9fAymD.js";
2
2
  import "svelte/internal/disclose-version";
3
3
  import * as $ from "svelte/internal/client";
4
4
  import { getContext, onDestroy, onMount, setContext } from "svelte";
@@ -1,2 +1,2 @@
1
- import { n as generatePresetCode, t as availableComponents } from "../generatePresetCode-DN-iUvZN.js";
1
+ import { n as generatePresetCode, t as availableComponents } from "../generatePresetCode-CO9fAymD.js";
2
2
  export { availableComponents, generatePresetCode };
@@ -16,7 +16,11 @@ var Circle_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
16
16
  color: {},
17
17
  radius: {},
18
18
  softness: {},
19
- center: {}
19
+ center: {},
20
+ strokeThickness: {},
21
+ strokeColor: {},
22
+ strokePosition: {},
23
+ colorSpace: {}
20
24
  }, {
21
25
  blendMode: "normal",
22
26
  visible: true,
@@ -1,19 +1,25 @@
1
- import { createElementBlock, createElementVNode, defineComponent, mergeProps, onBeforeUnmount, onMounted, openBlock, provide, ref, renderSlot } from "vue";
1
+ import { createElementBlock, createElementVNode, defineComponent, mergeProps, onBeforeUnmount, onMounted, openBlock, provide, ref, renderSlot, shallowRef } from "vue";
2
2
  import { shaderRenderer } from "../core/index.js";
3
3
  import { vec4 } from "three/tsl";
4
4
  import { TelemetryCollector, isExternalUser, shouldCollectTelemetry } from "../core/telemetry/index.js";
5
5
  var Shader_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
6
6
  __name: "Shader",
7
- props: { disableTelemetry: {
8
- type: Boolean,
9
- default: false
10
- } },
7
+ props: {
8
+ disableTelemetry: {
9
+ type: Boolean,
10
+ default: false
11
+ },
12
+ enablePerformanceTracking: {
13
+ type: Boolean,
14
+ default: false
15
+ }
16
+ },
11
17
  setup(__props, { expose: __expose }) {
12
18
  const props = __props;
13
19
  const containerRef = ref(null);
14
20
  const canvasRef = ref(null);
15
21
  const rootId = ref("shader-root-" + Math.random().toString(36).substring(7));
16
- const rendererInstance = ref(shaderRenderer());
22
+ const rendererInstance = shallowRef(shaderRenderer());
17
23
  const rendererResetSignal = ref(0);
18
24
  let telemetryCollector = null;
19
25
  let telemetryStartTimeout = null;
@@ -33,7 +39,7 @@ var Shader_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
33
39
  if (!canvasRef.value) return;
34
40
  if (!rendererInstance.value.isInitialized()) await rendererInstance.value.initialize({
35
41
  canvas: canvasRef.value,
36
- enablePerformanceTracking: true
42
+ enablePerformanceTracking: props.enablePerformanceTracking
37
43
  });
38
44
  rendererInstance.value.registerNode(rootId.value, ({ childNode }) => childNode || vec4(0, 0, 0, 0), null, null, {}, void 0);
39
45
  if (isExternalUser() && shouldCollectTelemetry(props.disableTelemetry) && !telemetryCollector) startTelemetryWhenReady();
@@ -55,8 +61,7 @@ var Shader_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
55
61
  visibilityObserver = new IntersectionObserver((entries) => {
56
62
  const entry = entries[0];
57
63
  if (!entry) return;
58
- const rect = containerRef.value?.getBoundingClientRect();
59
- const isCurrentlyVisible = entry.isIntersecting && rect && rect.width > 0 && rect.height > 0;
64
+ const isCurrentlyVisible = entry.isIntersecting;
60
65
  if (isCurrentlyVisible && !wasVisible) {
61
66
  if (rendererInstance.value.isInitialized()) {
62
67
  rendererInstance.value.startAnimation();
@@ -1,18 +1,22 @@
1
1
  interface Props {
2
2
  disableTelemetry?: boolean;
3
+ enablePerformanceTracking?: boolean;
3
4
  }
4
5
  declare function __VLS_template(): {
5
6
  default?(_: {}): any;
6
7
  };
7
8
  declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
8
9
  disableTelemetry: boolean;
10
+ enablePerformanceTracking: boolean;
9
11
  }>>, {
10
12
  captureScreenshot: (maxWidth?: number) => Promise<Blob>;
11
13
  getPerformanceStats: () => import('../../core').PerformanceStats;
12
14
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
13
15
  disableTelemetry: boolean;
16
+ enablePerformanceTracking: boolean;
14
17
  }>>> & Readonly<{}>, {
15
18
  disableTelemetry: boolean;
19
+ enablePerformanceTracking: boolean;
16
20
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
17
21
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
18
22
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"Shader.vue.d.ts","sourceRoot":"","sources":["../../src/engine/Shader.vue"],"names":[],"mappings":"AASA,UAAU,KAAK;IACb,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B;AAgRD,iBAAS,cAAc;qBAkDO,GAAG;EAKhC;AAUD,QAAA,MAAM,eAAe;;;8CA9K8B,OAAO,CAAC,IAAI,CAAC;;;;;sBApK3C,OAAO;4EAyV1B,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAAvG,wBAAwG;AACxG,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,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IACZ,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC3B,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAA;CAC7B;AAED,UAAU,YAAY;IACpB,UAAU,EAAE,eAAe,EAAE,CAAA;CAC9B;AAk4BD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAyC/D;AAGD,eAAO,MAAM,mBAAmB,UA4E/B,CAAA"}
1
+ {"version":3,"file":"generatePresetCode.d.ts","sourceRoot":"","sources":["../../src/utils/generatePresetCode.ts"],"names":[],"mappings":"AAAA,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC3B,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAA;CAC7B;AAED,UAAU,YAAY;IACpB,UAAU,EAAE,eAAe,EAAE,CAAA;CAC9B;AAs4BD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAyC/D;AAGD,eAAO,MAAM,mBAAmB,UA4E/B,CAAA"}
@@ -160,7 +160,11 @@ var shaderMetadata = {
160
160
  "center": {
161
161
  "x": .5,
162
162
  "y": .5
163
- }
163
+ },
164
+ "strokeThickness": 0,
165
+ "strokeColor": "#000000",
166
+ "strokePosition": "center",
167
+ "colorSpace": "linear"
164
168
  },
165
169
  "ConcentricSpin": {
166
170
  "opacity": 1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shaders",
3
- "version": "2.3.54",
3
+ "version": "2.3.56",
4
4
  "description": "Shader magic for modern frontends",
5
5
  "author": "Shader Effects Inc.",
6
6
  "homepage": "https://shaders.com/",
@@ -1,69 +0,0 @@
1
- import { r as transformColor, s as transformPosition } from "./transformations-CC_c-QAT.js";
2
- import { length, screenUV, smoothstep, vec2, vec4, viewportSize } from "three/tsl";
3
- const componentDefinition = {
4
- name: "Circle",
5
- category: "Textures",
6
- description: "Generate a circle with adjustable size and softness",
7
- props: {
8
- color: {
9
- default: "#ffffff",
10
- transform: transformColor,
11
- description: "The color of the circle",
12
- ui: {
13
- type: "color",
14
- label: "Color",
15
- group: "Colors"
16
- }
17
- },
18
- radius: {
19
- default: 1,
20
- description: "The radius of the circle. A value of one (1) is sets the circle to fit the canvas.",
21
- ui: {
22
- type: "range",
23
- min: 0,
24
- max: 2,
25
- step: .05,
26
- label: "Radius",
27
- group: "Effect"
28
- }
29
- },
30
- softness: {
31
- default: 0,
32
- description: "Edge softness. Lower values like zero (0) are sharp, higher values like one (1) are softer.",
33
- ui: {
34
- type: "range",
35
- min: 0,
36
- max: 1,
37
- step: .05,
38
- label: "Softness",
39
- group: "Effect"
40
- }
41
- },
42
- center: {
43
- default: {
44
- x: .5,
45
- y: .5
46
- },
47
- transform: transformPosition,
48
- description: "The center point of the circle",
49
- ui: {
50
- type: "position",
51
- label: "Center Position",
52
- group: "Position"
53
- }
54
- }
55
- },
56
- fragmentNode: ({ uniforms }) => {
57
- const uv$1 = screenUV;
58
- const aspect = viewportSize.x.div(viewportSize.y);
59
- const aspectCorrectedUV = vec2(uv$1.x.mul(aspect), uv$1.y);
60
- const centerPos = vec2(uniforms.center.uniform.x.mul(aspect), uniforms.center.uniform.y.oneMinus());
61
- const distanceFromCenter = length(aspectCorrectedUV.sub(centerPos));
62
- const edgeSoftness = uniforms.softness.uniform;
63
- const circleEdge = uniforms.radius.uniform.mul(.5);
64
- const circleMask = smoothstep(circleEdge.sub(edgeSoftness), circleEdge, distanceFromCenter).oneMinus();
65
- return vec4(uniforms.color.uniform.rgb, uniforms.color.uniform.a.mul(circleMask));
66
- }
67
- };
68
- var Circle_default = componentDefinition;
69
- export { componentDefinition as n, Circle_default as t };