mirror of
https://github.com/litruv/picoGraph.git
synced 2026-07-24 18:56:04 +10:00
updated graph rendering to be more efficient. added smooth scrolling, added color type, mmb drag for cutting
This commit is contained in:
26
scripts/nodes/library/converters/colorToNumber.js
Normal file
26
scripts/nodes/library/converters/colorToNumber.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import { createNodeModule } from "../../nodeTypes.js";
|
||||
|
||||
/**
|
||||
* Converts a color value to a numeric value.
|
||||
*/
|
||||
export const colorToNumberNode = createNodeModule(
|
||||
{
|
||||
id: "convert_color_to_number",
|
||||
title: "Color to Number",
|
||||
category: "Converters",
|
||||
description: "Convert a color value to a numeric value.",
|
||||
searchTags: ["color", "number", "convert", "cast"],
|
||||
inputs: [
|
||||
{ id: "color", name: "Color", direction: "input", kind: "color" }
|
||||
],
|
||||
outputs: [
|
||||
{ id: "number", name: "Number", direction: "output", kind: "number" }
|
||||
],
|
||||
properties: [],
|
||||
},
|
||||
{
|
||||
evaluateValue: ({ resolveValueInput }) => {
|
||||
return resolveValueInput("color", "0");
|
||||
},
|
||||
}
|
||||
);
|
||||
7
scripts/nodes/library/converters/index.js
Normal file
7
scripts/nodes/library/converters/index.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import { colorToNumberNode } from "./colorToNumber.js";
|
||||
import { numberToColorNode } from "./numberToColor.js";
|
||||
|
||||
/**
|
||||
* All type conversion nodes.
|
||||
*/
|
||||
export const converterNodes = [colorToNumberNode, numberToColorNode];
|
||||
26
scripts/nodes/library/converters/numberToColor.js
Normal file
26
scripts/nodes/library/converters/numberToColor.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import { createNodeModule } from "../../nodeTypes.js";
|
||||
|
||||
/**
|
||||
* Converts a numeric value to a color value.
|
||||
*/
|
||||
export const numberToColorNode = createNodeModule(
|
||||
{
|
||||
id: "convert_number_to_color",
|
||||
title: "Number to Color",
|
||||
category: "Converters",
|
||||
description: "Convert a numeric value to a color value.",
|
||||
searchTags: ["number", "color", "convert", "cast"],
|
||||
inputs: [
|
||||
{ id: "number", name: "Number", direction: "input", kind: "number" }
|
||||
],
|
||||
outputs: [
|
||||
{ id: "color", name: "Color", direction: "output", kind: "color" }
|
||||
],
|
||||
properties: [],
|
||||
},
|
||||
{
|
||||
evaluateValue: ({ resolveValueInput }) => {
|
||||
return resolveValueInput("number", "0");
|
||||
},
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user