dir.by  
Поиск >>

Компьютер, программы
→
Разработка игр | для телефонов на Unity, MonoGame | для браузера Google Chrome на JavaScript, HTML | рисуем графику
→
My game development in HTML, Javascript, Typescript
 Анимация человечка на месте. Используем HTML элемент <div>. Используем CSS стили: "animation", "background-image", "background-position", "keyframes" 
посмотрели 5250 раз
обновлено: 13 May 2020
Example we look, we test
Файл example.html
  Html  
<html>

<head>
     <!-- заголовок -->
     <meta charset="utf-8">
     <title>Animation hero</title>

     <!-- CSS стили -->
     <style>
          .hero {
               display: block;
               width: 40px;
               height: 40px;
               background-image: url(./images/hero.png);
               background-position: left 0;
               animation: animation-hero 1s steps(12) infinite;
          }

          @keyframes animation-hero{
               0%{background-position:0 top}
               to{background-position:-480px top}
          }
     </style>
</head>

<!-- body -->
<body>
     <div class="hero"></div>
</body>

</html>
Картинка hero.png
Как запустить локально (у себя на компьютере)?
Создайте у себя файл example.html
Скачайте картинку hero.png и сохраните внутри папки images
Запустите example.html у себя на компьютере в Goggle Chrome
 
← Previous topic
Writing a game using HTML, JavaScript, TypeScript in Visual Studio Code. I"ve created some ts files. That"s why I use Webpack (collects all files into one js)
 
Next topic →
Animation of a man in motion (sprite). For <div><img>animation we use CSS styles: "animation", "background-image", "background-position", "keyframes"
 
Your feedback ... Comments ...
   
Your Name
Your comment (www links can only be added by a logged-in user)

Новость "Черная пятница" Dreame в Беларуси – две недели скидок до 3400 рублей
 
My game development in HTML, Javascript, Typescript
• Writing a game using HTML, JavaScript, TypeScript in Visual Studio Code. I"ve created some ts files. That"s why I use Webpack (collects all files into one js)
• Animation of the little man on the spot. For <div>animation, we use CSS styles: "animation", "background-image", "background-position", "keyframes"
• Animation of a man in motion (sprite). For <div><img>animation we use CSS styles: "animation", "background-image", "background-position", "keyframes"
• My Game "Wizard World" | HTML, JavaScript
• Habr story [kavichka]Network game in HTML, CSS and JavaScript[kavichka] (nodejs, socket.io for the web, HTML canvas for graphics, game maps in js are set)
• Habr story [kavichka]Network game Tanks in HTML, JavaScript[kavichka] (nodejs, socket.io for the web, PixiJs library for graphics)
My game "Animal Go". Technologies: C#, MonoGame, Windows, Android, iOS
• My game is "Animal Go". How to play. Description | The game is written in C# using MonoGame (runs on platforms: Windows, Android, iOS)
• How do I write a game "Animal Go" on a computer Windows. I compile, get the exe file and run it | C#, MonoGame
• How to compile and run the game "Animal Go" on your phone or in emulator mode Android on your computer (Windows) | C#, MonoGame
• How to compile and run the game "Animal Go" for the system iOS | C#, MonoGame
Creating graphics, animation for a 2D game
• Which picture to draw for a 2D game: a raster png image by dots or a vector svg image by lines?
• 2D animation for the game

  Ваши вопросы присылайте по почте: info@dir.by