Created
March 24, 2020 06:15
-
-
Save abrom/b8167ff95ee83bcbf2a026a405a4f633 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/duhisoj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width"> | |
| <title>JS Bin</title> | |
| <script src="https://github.com/CreateJS/EaselJS/releases/download/0.8.1/easeljs-0.8.1.min.js"></script> | |
| </head> | |
| <body style="display: flex"> | |
| <canvas id="canvas" width='800' height='800' style="border: 1px solid black; display: inline-block"></canvas> | |
| <div id="log" style="border: 1px solid green; width: 800px; height: 800px; display: inline-block; overflow: hidden"></div> | |
| <script type="text/javascript"> | |
| var stage = new createjs.Stage('canvas'); | |
| var events = ["stagemousedown", "stagemousemove", "stagemouseup"]; | |
| var log = document.getElementById("log"); | |
| var handler = function(event) { | |
| var node = document.createElement("div"); | |
| node.innerText = "Received: " + event.type; | |
| if (log.childNodes.length > 50) { | |
| log.removeChild(log.childNodes[50]); | |
| } | |
| log.insertBefore(node, log.childNodes[0]); | |
| } | |
| for (var i = 0; i < events.length; i++) { | |
| stage.on(events[i], handler); | |
| } | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment