
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
A wrapper to draw primitive shapes with canvas
Vandal's API allows the user to chain multiple calls -typically off the .draw()
function - to create the desired behavior.
For instance you can make repeated calls from .draw()
with each passing an argument stating what to do or which options to take:
var vandal = new Vandal();
var canvas = document.querySelector('canvas');
vandal.use(canvas).draw('pallete')({fillStyle : '#ff0033'})('shape')('rectangle')(10, 10, 100, 200);
canvasObj
being a canvas element.
This will be used throughout the use of the vandal instance.
The first call of this function should tell the vandal instance which object you want to start using,
pallete
or `shape'.
pallete
Calling .draw()
with this argment will return a function to set canvas style properties.
Simply pass an object with the name/values of the properties you wish to use.
Passing a style object will return .draw()
again, to either set/reset new styles or create a shape.
shape
Calling .draw()
with the "shape" argument will return a function that allows the user to choose a shape
to render on the canvas. Current options are "rectangle", "circle", "triangle", "line", and "text".
After passing a shape, a new function is returned that, depending on shape chosen, will require arguments for positioning and dimensions in order to finally draw upon the canvas.
rectangle(Xpos, Ypos, Width, Height)
circle(Xpos, Ypos, Radius)
triangle(Obj{x,y}, Obj{x,y}, Obj{x,y})
line(Obj{x,y} Obj{x,y})
minimum 2 Objects with x & y properties, no hard maximum.
text(String, Xpos, Ypos)
After passing the plot argument(s), the vandal instance is returned, and the cycle can continue. The examples folder shows each shape being created.
Clears the canvas, typically to prepare for redraw.
Repeats callback function using requestAnimationKeyframe()
.
This function will take care of clearing the canvas and repeated calls of requestAnimationFrame
.
The callback function is passed three arguments:
1
that is a reference the number of times an animation frame is calledrequestAnimationKeyframe()
The animation will repeat until/unless the callback returns a boolean value of false
.
For instance, if you wanted to end the animation after a line is 100 pixels long, you would return true
until the line is the desired length, which would then have your callback function return false
, thus
stoping your animation sequence.
var vandal = new Vandal();
vandal.use(canvas).animate(function(scope, increment, timestamp){
scope.draw('shape')('line')({x: 0, y: 150}, {x: inc, y: 150});
return inc < 100 ? true : false;
});
FAQs
A small wrapper built around canvas api
We found that vandal 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
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.