Get started with milojs CDN
BSD-2-Clause licensed
Milojs is a Serbian given name meaning gracious or beloved.
Tags:- framework
- reactive
- reactive programming
- binding
- data binding
- mvc
- model
- view
- controller
- component
- messenger
- one-page app
Stable version
Copied!
How to start using milojs CDN
<!DOCTYPE html>
<html>
<head>
<title>Get started with milojs CDN - cdnhub.io</title>
<script src="https://cdn.cdnhub.io/milojs/1.6.1/milo.min.js"></script>
<style>
#milo-canvas {
width: 300px;
height: 300px;
border: 1px solid black;
}
</style>
</head>
<body>
<canvas id="milo-canvas"></canvas>
<script>
const canvas = document.getElementById('milo-canvas');
const milo = new milo.Milo({ canvas });
milo.load('https://cdn.cdnhub.io/milojs/examples/shapes/shapes.json')
.then(() => {
const shape = milo.shapes.rectangle;
const rectangle = milo.draw(shape, { x: 50, y: 50, width: 100, height: 50, fill: 'red' });
milo.animate(function (frame) {
rectangle.x += 2;
if (rectangle.x > canvas.width) rectangle.x = 0;
});
})
.catch((error) => {
console.error('Error loading shapes:', error);
});
</script>
</body>
</html>
Copied!
Copied!
Copied!