text: (window.webpackJsonp=window.webpackJsonp||[]).push([[79],{595:function(n,t,e){"use strict";e.r(t),t.default="const {Scene} = spritejs;\nconst {Mesh3d, shaders} = spritejs.ext3d;\nconst container = document.getElementById('container');\nconst scene = new Scene({\n  container,\n  width: 600,\n  height: 600,\n});\nconst layer = scene.layer3d('fglayer', {\n  camera: {\n    fov: 35,\n    z: 5,\n  },\n});\n\nconst vertex = `\nprecision highp float;\nprecision highp int;\n\nattribute vec3 position;\nattribute vec4 color;\n\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\n\nvarying vec4 vColor;\n\nvoid main() {\n  vec4 mv = modelViewMatrix * vec4(position, 1.0);\n  gl_Position = projectionMatrix * mv;\n  vColor = color;\n}\n`;\n\nconst program = layer.createProgram({\n  fragment: shaders.NORMAL_GEOMETRY.fragment,\n  vertex,\n  cullFace: null,\n});\n\nconst p = 1 / Math.sqrt(2);\nconst data = new Float32Array([\n  -1, 0, -p, // position\n  1, 0, 0, // color\n  1, 0, -p,\n  0, 1, 0,\n  0, 1, p,\n  0, 0, 1,\n  0, -1, p,\n  1, 1, 0,\n]);\n\nconst model = {\n  position: {\n    data,\n    stride: 24,\n  },\n  color: {\n    data,\n    stride: 24,\n    offset: 12,\n  },\n  index: [\n    0, 1, 2, 0, 1, 3, 1, 3, 2, 0, 2, 3,\n  ],\n};\n\nconst sprite = new Mesh3d(program, {\n  model,\n});\nlayer.append(sprite);\n\nsprite.animate([\n  {rotateY: 0},\n  {rotateY: 360},\n], {\n  duration: 7000,\n  iterations: Infinity,\n});\n\nsprite.animate([\n  {rotateZ: 0},\n  {rotateZ: 360},\n], {\n  duration: 17000,\n  iterations: Infinity,\n});\n\nsprite.animate([\n  {rotateX: 0},\n  {rotateX: -360},\n], {\n  duration: 11000,\n  iterations: Infinity,\n});\n\nlayer.setOrbit();"}}]);