
Security News
Open Source CAI Framework Handles Pen Testing Tasks up to 3,600× Faster Than Humans
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
mesh-gradient.js
Advanced tools
mesh-gradient.js
is tiny utility library to generate mesh gradient based on 4 RGB colors, built with vanilla js.
npm install mesh-gradient.js
or yarn add mesh-gradient.js
Vanilla JS
React
import MeshGradient from 'mesh-gradient.js';
import { useEffect } from 'react';
const COLORS = ["#eb75b6",
"#ddf3ff",
"#6e3deb",
"#c92f3c"]
function App() {
// create instance of Gradient Class
const gradient = new MeshGradient();
const canvasId = "my-canvas"
useEffect(() => {
// initialize new gradient
// @Params
// 1. id of canvas elememt
// 2. array of colors in hexcode
gradient.initGradient("#" + canvasId, COLORS)
// Mesh Id
// Any positive numeric value which acts as a seed for mesh pattern
gradient?.changePosition(780);
}, [])
const regenerate = () => {
const value = Math.floor(Math.random() * 1000)
// change pattern by changing mesh Id
gradient?.changePosition(value);
}
return (
<div className="App">
<canvas id={canvasId} width="800" height="600"/>
<button onClick={() => regenerate()}> Regenerate </button>
</div>
);
}
export default App;
Other Useful APIs
// get current gradient colors
gradient.getGradientColors(),
// change gradient colors
gradient.changeGradientColors(newColors);
// force refresh mesh
// Usage - set any property of the Mesh Gradient Object and run this to see the effect
gradient.reGenerateCanvas();
Mesh Gradient Model
{
isLoadedClass: boolean;
el: any;
inputColors: any;
connect(): Promise<void>;
shaderFiles: {
vertex: string;
noise: string;
blend: string;
fragment: string;
} | undefined;
conf: {
presetName: string;
wireframe: boolean;
density: number[];
zoom: number;
rotation: number;
playing: boolean;
} | undefined;
minigl: MiniGl | undefined;
disconnect(): void;
setCanvasSize(width: any, height: any, initial?: boolean): void;
width: any;
height: any;
xSegCount: number | undefined;
ySegCount: number | undefined;
initMaterial(): any;
uniforms: {
u_time: any;
u_shadow_power: any;
u_darken_top: any;
u_active_colors: any;
u_global: any;
u_vertDeform: any;
u_baseColor: any;
u_waveLayers: any;
} | undefined;
vertexShader: string | undefined;
initMesh(): void;
material: any;
geometry: any;
mesh: any;
shouldSkipFrame(e: any): true | undefined;
updateFrequency(e: any): void;
toggleColor(index: any): void;
showGradientLegend(): void;
isGradientLegendVisible: boolean | undefined;
hideGradientLegend(): void;
changePosition(val: any): void;
t: number | undefined;
init(): void;
initGradientColors(): void;
sectionColors: any;
changeGradientColors(colors: any): void;
reGenerateCanvas(): void;
getGradientColors(): any;
}
https://stripe.com
https://kevinhufnagl.com/
FAQs
A tiny utility to generate mesh gradients in a HTML canvas.
The npm package mesh-gradient.js receives a total of 128 weekly downloads. As such, mesh-gradient.js popularity was classified as not popular.
We found that mesh-gradient.js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.