Get started with mo-js CDN

MIT licensed

Mo-js: Lightweight, feature-rich library for 2D/3D animations, effects.

Tags:
  • motion
  • effects
  • animation
  • motion graphics

Stable version

Copied!

How to start using mo-js CDN


<!DOCTYPE html>
<html>
<head>
    <title>Get started with mo-js CDN - cdnhub.io</title>
    <style>
        #mocontainer { width: 300px; height: 300px; border: 1px solid #ccc; }
    </style>
    <script src="https://cdn.cdnhub.io/mo-js/1.7.1/mo.umd.js"></script>
</head>
<body>
    <div id="mocontainer"></div>
    <script>
        // Initialize Mo-js
        const mocontainer = document.getElementById('mocontainer');
        const renderer = new MO.Renderer(mocontainer, 300, 300);

        // Create a simple scene
        const scene = new MO.Scene();
        scene.addChild(new MO.Box(new MO.Vector3(150, 0, 0), new MO.Vector3(50, 50, 50), new MO.Color(1, 0, 0)));
        scene.addChild(new MO.Box(new MO.Vector3(-150, 0, 0), new MO.Vector3(50, 50, 50), new MO.Color(0, 1, 0)));

        // Set the scene to the renderer
        renderer.setScene(scene);

        // Start rendering
        renderer.run();
    </script>
</body>
</html>
Copied!
Copied!

All versions