Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@ko-yelie/kgl
Advanced tools
Minimal WebGL library
npm i @ko-yelie/kgl
// Kgl
import Kgl from '@ko-yelie/kgl'
// KglAuto
import { KglAuto } from '@ko-yelie/kgl'
// Import only KGL (ignore KglAuto and effects)
import Kgl from '@ko-yelie/kgl/dist/kgl.es.js'
<script src="https://unpkg.com/@ko-yelie/kgl"></script>
// Kgl
Kgl.default
// KglAuto
const { KglAuto } = Kgl
Kgl
<script type="x-shader/x-fragment" id="fs">
precision highp float;
uniform vec2 uResolution; // window size (auto added)
uniform float uTime;
void main() {
float alpha = 1. - length(gl_FragCoord.xy / uResolution) * (sin(uTime) * 0.5 + 0.5);
gl_FragColor = vec4(vec3(0.), alpha);
}
</script>
import Kgl from '@ko-yelie/kgl'
const kgl = new Kgl()
/**
* program
*/
const program = kgl.createProgram({
fragmentShaderId: 'fs',
uniforms: {
uTime: 0,
},
isAutoAdd: true,
})
/**
* resize
*/
function resize() {
kgl.resize()
}
resize()
window.addEventListener('resize', resize)
/**
* tick
*/
function tick(time) {
program.uniforms.uTime = time * 0.001
kgl.draw()
requestAnimationFrame(tick)
}
requestAnimationFrame(tick)
KglAuto
import { KglAuto } from '@ko-yelie/kgl'
new KglAuto({
programs: {
main: {
fragmentShaderId: 'fs',
uniforms: {
uTime: 0,
},
},
},
tick: (kgl, time) => {
kgl.programs.main.uniforms.uTime = time
kgl.draw()
},
})
FAQs
Minimal WebGL library
We found that @ko-yelie/kgl demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.