Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
aframe-draw-shader
Advanced tools
A shader to draw canvas A-Frame VR. Inspired by @maxkrieger's draw
component.
material
's properties are supported.flat
shader besides repeat
.Property | Description | Default Value |
---|---|---|
width | canvas width | 256 |
height | canvas height | 256 |
fps | fps to render | 60 |
For refference, please check the following links:
draw-render
is called every framerate (fps).event.detail
includes canvas's ctx
(context) and texture
.
texture.needsUpdate = true
won't be called in the shader.
Please do texture.needsUpdate = true
by yourself.
this.el.addEventListener('draw-render', function(event) {
// draw!
var ctx = event.detail.ctx
var texture = event.detail.texture
// drawing...
ctx.rect(20,20,150,100)
ctx.stroke()
// texture upate
texture.needsUpdate = true
})
Install and use by directly including the browser files:
<head>
<title>My A-Frame Scene</title>
<script src="https://aframe.io/releases/0.2.0/aframe.min.js"></script>
<script src="https://rawgit.com/mayognaise/aframe-draw-shader/master/dist/aframe-draw-shader.min.js"></script>
<script>
/**
* noise component example
*/
AFRAME.registerComponent('noise', {
dependencies: [ ],
schema: { },
init () {
this.el.addEventListener('draw-render', this.render.bind(this))
},
update () { },
remove () { },
pause () { },
play () { },
render (e) {
var ctx = e.detail.ctx,
texture = e.detail.texture,
w = ctx.canvas.width,
h = ctx.canvas.height,
idata = ctx.createImageData(w, h),
buffer32 = new Uint32Array(idata.data.buffer),
len = buffer32.length,
i = 0
for(; i < len;)
buffer32[i++] = ((255 * Math.random())|0) << 24
ctx.putImageData(idata, 0, 0)
// texture upate
texture.needsUpdate = true
}
})
</script>
</head>
<body>
<a-scene>
<a-entity geometry="primitive:box;" material="shader:draw;" noise=""></a-entity>
</a-scene>
</body>
Install via NPM:
npm i -D aframe-draw-shader
Then register and use.
import 'aframe'
import 'aframe-draw-shader'
FAQs
A shader to draw canvas for A-Frame VR.
The npm package aframe-draw-shader receives a total of 2 weekly downloads. As such, aframe-draw-shader popularity was classified as not popular.
We found that aframe-draw-shader 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.