250x250
Rainbow🌈Coder
My dev Note📒
Rainbow🌈Coder
전체 방문자
오늘
어제
  • 분류 전체보기 (411)
    • 공지사항 (0)
    • Debugger (10)
      • Visual Studio Debugger (1)
      • Chrome DevTools (3)
      • Visual Studio Code Debugger (4)
      • eclipse (1)
      • intelliJ (1)
    • OOP (2)
      • OOP (2)
    • TypeScript (54)
      • 타입스크립트 TypeScript (54)
    • Javascript (87)
      • Javascript (45)
      • Node.js (19)
      • React (5)
      • FE 개발환경설정 (3)
      • React와 Node 같이 때려잡기 (6)
      • next.js (2)
      • pixi.js (7)
    • 마크업 (23)
      • Html & Css (23)
    • C# (80)
      • C# (12)
      • 이것이 C#이다 (68)
    • C++ (30)
      • c++ (27)
      • win api (3)
    • Unity (18)
      • Unity(기초) (8)
      • Unity(C#중급) (5)
      • 유니티 포톤(네트워크) (4)
      • unity c# MyCode (1)
    • Java & Spring (29)
      • Java (11)
      • 스프링 (8)
      • Java Algorithm (9)
      • Javs Data Structures (1)
    • 자료구조와 알고리즘 (15)
      • 자료구조 (5)
      • 알고리즘 (10)
    • 형상관리 (15)
      • Git (11)
      • 소스트리 (3)
    • 그래픽스 (7)
      • WebGl (7)
    • AWS (3)
      • aws (3)
    • 리눅스 (5)
      • 리눅스 (5)
    • 책 리뷰 (13)
      • 클린코드(책리뷰) (3)
      • 유지보수가능한코딩의기술C#편(책리뷰) (1)
      • 리팩토링(자바스크립트판) (9)
    • Server (2)
      • 게임 서버(네트워크, 멀티쓰레드,OS) (2)
    • 설계, 아키텍쳐 (4)
    • 파이썬 (5)
    • 디자인패턴 (2)
    • mocha (2)
    • Jest (1)
    • Spine (1)
    • 인공지능 (1)
      • 혼자공부하는머신러닝+딥러닝 (1)

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

인기 글

태그

  • MySQL
  • 위임
  • ㅣㄷ
  • 컴포지션

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
Rainbow🌈Coder

My dev Note📒

[2D WebGL][pixiJS] Getting Started!
그래픽스/WebGl

[2D WebGL][pixiJS] Getting Started!

2022. 5. 9. 22:42
728x90

https://youtu.be/GuY_PROTr0I: 참고영상

결과

코드

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <title>Document</title>
    <style>
      body {
        margin: 0;
      }
      canvas {
        display: block;
        background-color: blue;
      }
    </style>
  </head>
  <body>
    <canvas id="mycanvas"></canvas>
    <script src="pixi.js"></script>
    <script type="text/javascript">
      const canvas = document.getElementById("mycanvas");
      // Create the application helper and add its render target to the page
      const app = new PIXI.Application({
        view: canvas,
        width: window.innerWidth,
        height: window.innerHeight,
      });

      // Create the sprite and add it to the stage
      const texture = PIXI.Texture.from("bike.png");
      const img = new PIXI.Sprite(texture);
      img.x = app.renderer.width / 2;
      img.y = app.renderer.height / 2;
      app.stage.addChild(img);
    </script>
  </body>
</html>

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <title>Document</title>
    <style>
      body {
        margin: 0;
      }
      canvas {
        display: block;
        background-color: blue;
      }
    </style>
  </head>
  <body>
    <canvas id="mycanvas"></canvas>
    <script src="pixi.js"></script>
    <script type="text/javascript">
      const canvas = document.getElementById("mycanvas");
      // Create the application helper and add its render target to the page
      const app = new PIXI.Application({
        view: canvas,
        width: window.innerWidth,
        height: window.innerHeight,
      });

      // Create the sprite and add it to the stage
      const texture = PIXI.Texture.from("bike.png");
      const img = new PIXI.Sprite(texture);
      img.x = app.renderer.width / 2;
      img.y = app.renderer.height / 2;
      img.anchor.x = 0.5;
      img.anchor.y = 0.5;
      app.stage.addChild(img);
    </script>
  </body>
</html>

 

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <title>Document</title>
    <style>
      body {
        margin: 0;
      }
      canvas {
        display: block;
        background-color: blue;
      }
    </style>
  </head>
  <body>
    <canvas id="mycanvas"></canvas>
    <script src="pixi.js"></script>
    <script type="text/javascript">
      const canvas = document.getElementById("mycanvas");
      // Create the application helper and add its render target to the page
      const app = new PIXI.Application({
        view: canvas,
        width: window.innerWidth,
        height: window.innerHeight,
      });

      // Create the sprite and add it to the stage
      const texture = PIXI.Texture.from("bike.png");
      const img = new PIXI.Sprite(texture);
      img.x = app.renderer.width / 2;
      img.y = app.renderer.height / 2;
      img.anchor.x = 0.5;
      img.anchor.y = 0.5;
      app.stage.addChild(img);

      app.ticker.add(animate);
      function animate() {
        img.rotation += 0.1;
      }
    </script>
  </body>
</html>
728x90

'그래픽스 > WebGl' 카테고리의 다른 글

[Spine][pixiJs] Api 사이트  (0) 2022.05.11
[2D WebGL][pixi.Js] 세부사항  (0) 2022.05.10
[2D WebGL][pixiJS] Architecture Overview  (0) 2022.05.09
[3D WebGL][three.js] three.js 프로젝트 시작해보기  (0) 2022.05.09
WebGL이란, three.js란, pixi.js란  (0) 2022.05.01
    '그래픽스/WebGl' 카테고리의 다른 글
    • [Spine][pixiJs] Api 사이트
    • [2D WebGL][pixi.Js] 세부사항
    • [2D WebGL][pixiJS] Architecture Overview
    • [3D WebGL][three.js] three.js 프로젝트 시작해보기
    Rainbow🌈Coder
    Rainbow🌈Coder
    몰라도 결국은 아는 개발자, 그런 사람이 되기 위한 매일의 한걸음

    티스토리툴바