123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="user-scalable=no, width=device-width, minimum-scale=1, maximum-scale=1" />
- <title>用画布实现动画</title>
- <link rel="stylesheet" type="text/css" href="./static/css/sytle.css">
- <script type="text/javascript" src="./static/js/hilo-standalone.min.js"></script>
- <img src="./static/images/fish.png" alt="" id="fish" style="display:none">
- </head>
- <body>
- <div id="game-container"></div>
- <div style="padding: 20px; text-align: center;">
- <button onclick="reset()">重播</button>
- </div>
- <script type="text/javascript" src="./static/js/demo.js"></script>
- <script type="text/javascript">
-
- var canvasType = location.search.indexOf("dom") != -1 ? "div" : "canvas";
- var canvas = Hilo.createElement(canvasType);
- console.log("#debug#🚀 ~ file: index.vue:17 ~ init ~ init:开始啊", Hilo);
- var stage = new Hilo.Stage({
- renderType: renderType,
- container: gameContainer,
- width: stageWidth,
- height: stageHeight
- });
- console.log("#debug#🚀 ~ file: index.vue:24 ~ init ~ stage:", stage);
- var ticker = new Hilo.Ticker(60);
- ticker.addTick(stage);
- ticker.start();
- var font = "14px arial";
- var content = "Hello World! Hilo是一款HTML5 2D游戏引擎,欢迎使用。";
- var text = new Hilo.Text({
- font: font,
- text: content,
- lineSpacing: 0,
- width: 250,
- height: 100,
- x: 40,
- y: 50
- }).addTo(stage);
-
- </script>
- </body>
- </html>
|