Ink.js is a tool that thinks outside the box, figuratively and literaly. Insted of using the canvas, ink.js uses HTML elements to render content. It is object-oriented, simple, and does not require any installation.
To use ink, add this script to the top of your HTML:
<script src="https://ink.js.org/ink.min.js" ></script>
To add a character, create an object with its properties.
Banana = {
type: "image",
source: "https://ink.js.org/demo/banana.jpg",
width: 25,
x: 0,
y:0,
};
Ink.js only notices an object if it has a
type
orcontents
property. To change how the characters overlap, uselayerList
.
To add functionality, use the forever function to repeat the code indefinitely.
loop = ()=>{
Banana.x = mouse.x;
Banana.y = mouse.y;
}
output: