UNPKG

basic-ui-js

Version:

A lightweight JavaScript library for building web-based applications with simple code. No need to write HTML or CSS — just use basic JavaScript.

52 lines (37 loc) 1.32 kB
<!DOCTYPE html> <html> <head> <title>Motion example</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> <!-- LIBRARY FILES --> <link rel="stylesheet" type="text/css" href="basic/basic.min.css"> <script src="basic/basic.min.js" type="text/javascript" charset="utf-8"></script> <script> let box; window.onload = function() { // BOX: My box. box = Box({ width: 120, height: 120, color: "orangered", round: 4, }); that.center(); // When there is a change, soften it with movement. that.setMotion("left 0.3s, top 0.3s, width 0.3s, height 0.3s"); that.on("click", function(event) { extendBox(box); }); }; const extendBox = function(clickedBox) { clickedBox.width += 50; clickedBox.height += 50; clickedBox.center(); }; </script> </head> <body> <!-- HTML content --> </body> </html>