home.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>中科在线(长春)技术交易平台</title>
  6. <!-- layui -->
  7. <link rel="stylesheet" href="static/home/lib/layui/css/layui.css">
  8. <link rel="stylesheet" href="static/home/css/lib.css">
  9. <link rel="stylesheet" href="static/home/css/road.css">
  10. <link rel="stylesheet" href="static/home/css/index.css">
  11. <style>
  12. .canvas-stats {
  13. display: none;
  14. }
  15. </style>
  16. </head>
  17. <body>
  18. <div class="header">
  19. <a href="" style="display: none;">
  20. <div class="home-btn"></div>
  21. </a>
  22. <img class='image' src="static/images/logo.png" alt="">
  23. <p class='title'>中科在线(长春)技术交易平台</p>
  24. <p class='login'>
  25. <a href=""><img src="./static/home/images/登录.png" alt=""></a>
  26. <a href="http://free.liaoningdoupo.com/platlive/newlogin">个人登录</a>
  27. <a href="http://free.liaoningdoupo.com/platlogin/">管理登录</a>
  28. </p>
  29. </div>
  30. <img class="sci-wheel" src="static/home/images/sci.gif" alt="">
  31. <div class="center">
  32. <a class="list fn_1 moveUpDownFla1" target="_blank" href="market/index">
  33. <p>科技超市</p>
  34. </a>
  35. <a class="list fn_2 moveUpDownFla2" target="_blank" href="hallList/index">
  36. <p>直播大厅</p>
  37. </a>
  38. <a class="list fn_3 moveUpDownFla1" target="_blank" href="dynamic/index">
  39. <p>动态监测</p>
  40. </a>
  41. <a class="list fn_4 moveUpDownFla2" target="_blank" href="live/service">
  42. <p>创新服务</p>
  43. </a>
  44. <a class="list fn_5 moveUpDownFla2" target="_blank" href="technical/index">
  45. <p>技术交流</p>
  46. </a>
  47. </div>
  48. <!--流星-->
  49. <div class="liuxing liuxing1 liuxingFla"></div>
  50. <div class="liuxing liuxing2 liuxingFla2"></div>
  51. <div class="liuxing liuxing3 liuxingFla3"></div>
  52. <div class="liuxing liuxing4 liuxingFla4"></div>
  53. <div id="canvas-container-1" class="canvas-container">
  54. <canvas id="canvas-1"></canvas>
  55. </div>
  56. <script src="static/home/js/stats.min.js"></script>
  57. <script src="static/home/js/three.min.js"></script>
  58. <script>
  59. function ThreeJSCanvas(CANVAS_ID) {
  60. var SCREEN_HEIGHT = Math.min(window.innerWidth, window.innerHeight);
  61. var SCREEN_WIDTH = SCREEN_HEIGHT;
  62. var SCREEN_ASPECT_RATIO = SCREEN_WIDTH / SCREEN_HEIGHT;
  63. var canvas, container;
  64. var container, loader, stats;
  65. var renderer, camera, scene;
  66. var raycaster, controls;
  67. var ANIMATION_FRAME_LENGTH = 30,
  68. INTERACT_DISTANCE = 2.5;
  69. var objetArray = [],
  70. animationQueue = [];
  71. var color1 = [0 / 255, 110 / 255, 255 / 255],
  72. color2 = [0 / 255, 255 / 255, 140 / 255];
  73. var bitmap = [];
  74. var BITMAP_SKIP = 1;
  75. var fov = 90;
  76. var cameraPos = [0, 0, 30];
  77. var cameraLookAt = [0, 0, 0];
  78. var viewHeight = 2 * Math.tan(THREE.Math.degToRad(fov / 2)) * cameraPos[2],
  79. viewWidth = viewHeight * SCREEN_ASPECT_RATIO;
  80. var mouse = new THREE.Vector3(10000, 10000, -1),
  81. mouseScaled = new THREE.Vector3(10000, 10000, -1);
  82. var frame = 0;
  83. function init() {
  84. // Global Variables
  85. container = document.getElementById("canvas-container-" + CANVAS_ID);
  86. canvas = document.getElementById("canvas-" + CANVAS_ID);
  87. canvas.addEventListener('mousemove', onDocumentMouseMove, false);
  88. loader = new THREE.JSONLoader();
  89. stats = new Stats();
  90. stats.domElement.classList.add("canvas-stats");
  91. stats.domElement.id = "canvas-stats-" + CANVAS_ID;
  92. /* If you are familiar with python and opencv
  93. you can use this python script to generate custom bitmaps
  94. --------------------
  95. https://git.io/vdBAu
  96. --------------------
  97. */
  98. var data = '#000000000000000000011110000000000000000000' +
  99. '#000000000000000011111111110000000000000000' +
  100. '#000000000000001111111111111100000000000000' +
  101. '#000000000000011111111111111110000000000000' +
  102. '#000000000000111111111111111111000000000000' +
  103. '#000000000001111111111111111111100000000000' +
  104. '#000000000011111111111111111111110000000000' +
  105. '#000000000011111111111111111111110000000000' +
  106. '#000000000111111111111111111111111000000000' +
  107. '#000000000111111111111111111111111000000000' +
  108. '#000000001111111111111111111111111100000000' +
  109. '#000000001111111111111111111111111100000000' +
  110. '#000000001111111111111111111111111100000000' +
  111. '#000000001111111111111111111111111100000000' +
  112. '#000000001111111111111111111111111100000000' +
  113. '#000000000111111111111111111111111000000000' +
  114. '#000000000111111111111111111111111000000000' +
  115. '#000000000111111111111111111111111000000000' +
  116. '#000000000011111111111111111111110000000000' +
  117. '#000000000011111111111111111111110000000000' +
  118. '#000000000001111111111111111111100000000000' +
  119. '#000000000001111111111111111111100000000000' +
  120. '#000000000000111111111111111111000000000000' +
  121. '#000000000000111111111111111110000000000000' +
  122. '#000000000000011111111111111110000000000000' +
  123. '#000000000000001111111111111100000000000000' +
  124. '#000000000000001111111111111100000000000000' +
  125. '#000000000000001111111111111000000000000000' +
  126. '#000000000000000111111111111000000000000000' +
  127. '#000000000000000111111111111000000000000000' +
  128. '#000000000000000111111111111000000000000000' +
  129. '#000000000000000111111111111000000000000000' +
  130. '#000000000000000011111111110000000000000000' +
  131. '#000000000000000010000000010000000000000000' +
  132. '#000000000000000011111111110000000000000000' +
  133. '#000000000000000010000000010000000000000000' +
  134. '#000000000000000011111111110000000000000000' +
  135. '#000000000000000010000000010000000000000000' +
  136. '#000000000000000011111111110000000000000000' +
  137. '#000000000000000000100001000000000000000000' +
  138. '#000000000000000000110011000000000000000000' +
  139. '#000000000000000000011110000000000000000000';
  140. for (var i = 0; i < data.length; i++) {
  141. if (data[i] == '#') {
  142. bitmap.push([]);
  143. } else {
  144. bitmap[bitmap.length - 1].push(data[i] - '0');
  145. }
  146. }
  147. container.appendChild(stats.domElement);
  148. // Renderer
  149. renderer = new THREE.WebGLRenderer({
  150. alpha: true,
  151. antialias: true,
  152. canvas: canvas,
  153. });
  154. renderer.setClearColor(0x212121, 0);
  155. renderer.setPixelRatio(window.devicePixelRatio);
  156. renderer.shadowMap.enabled = true;
  157. renderer.shadowMap.type = THREE.PCFSoftShadowMap;
  158. renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT);
  159. // Camera and Controls
  160. camera = new THREE.PerspectiveCamera(fov, SCREEN_ASPECT_RATIO, 0.1, 1000);
  161. // camera = new THREE.OrthographicCamera(-viewWidth, viewWidth, viewHeight, -viewHeight, 1, 300);
  162. camera.position.set(cameraPos[0], cameraPos[1], cameraPos[2]);
  163. camera.lookAt(new THREE.Vector3(cameraLookAt[0], cameraLookAt[1], cameraLookAt[2]));
  164. raycaster = new THREE.Raycaster();
  165. // controls = new THREE.OrbitControls(camera);
  166. // controls.rotateSpeed = 2.0;
  167. // controls.zoomSpeed = 2.0;
  168. // controls.enableZoom = true;
  169. // controls.enablePan = true;
  170. // controls.dampingFactor = 0.2;
  171. // controls.addEventListener('change', render);
  172. //Scene
  173. scene = new THREE.Scene();
  174. //Lights
  175. // Making Object Array
  176. var xOffset = -bitmap[0].length / (BITMAP_SKIP * 2);
  177. var yOffset = bitmap.length / (BITMAP_SKIP * 2);
  178. for (var i = 0; i < bitmap.length; i += BITMAP_SKIP) {
  179. for (var j = 0; j < bitmap[i].length; j += BITMAP_SKIP) {
  180. if (bitmap[i][j] == 1) {
  181. planeGeometry = new THREE.PlaneGeometry(1, 1);
  182. var circleGeometry = new THREE.CircleGeometry(1, 5);
  183. var frac = i / bitmap.length;
  184. // Materials
  185. planeMaterial = new THREE.MeshBasicMaterial({
  186. color: new THREE.Color(
  187. color1[0] * frac + color2[0] * (1 - frac),
  188. color1[1] * frac + color2[1] * (1 - frac),
  189. color1[2] * frac + color2[2] * (1 - frac)
  190. ),
  191. transparent: true,
  192. opacity: THREE.Math.randFloat(0.4, 0.6),
  193. side: THREE.DoubleSide
  194. });
  195. var circleMaterial = new THREE.MeshBasicMaterial({
  196. color: new THREE.Color(1, 1, 1),
  197. transparent: true,
  198. opacity: THREE.Math.randFloat(0.8, 1),
  199. side: THREE.DoubleSide
  200. });
  201. // Mesh
  202. planeMesh = new THREE.Mesh(planeGeometry, planeMaterial);
  203. planeMesh.position.set(xOffset + j / BITMAP_SKIP, yOffset - i / BITMAP_SKIP, 0);
  204. var randWidth = THREE.Math.randFloat(0.6, 1.2);
  205. var randHeight = randWidth
  206. planeMesh.scale.set(randWidth, randHeight, 1);
  207. scene.add(planeMesh);
  208. objetArray.push([planeMesh, false]);
  209. circleMesh = new THREE.Mesh(circleGeometry, circleMaterial);
  210. circleMesh.position.set(xOffset + j / BITMAP_SKIP + THREE.Math.randFloat(-0.5, 0.5), yOffset - i / BITMAP_SKIP + THREE.Math.randFloat(-0.5, 0.5), 0.1);
  211. var randRadius = THREE.Math.randFloat(0.05, 0.1);
  212. circleMesh.scale.set(randRadius, randRadius, 1);
  213. scene.add(circleMesh);
  214. objetArray.push([circleMesh, false]);
  215. }
  216. }
  217. }
  218. //Geometry
  219. // Materials
  220. // Mesh
  221. // Helpers
  222. //Add Stuff to Scene
  223. }
  224. function animate() {
  225. requestAnimationFrame(animate);
  226. render();
  227. stats.update();
  228. // controls.update();
  229. frame++;
  230. }
  231. function render() {
  232. while (animationQueue.length > 0) {
  233. var obj_index = animationQueue[0][0];
  234. var ani_frame = animationQueue[0][1];
  235. if (ani_frame > ANIMATION_FRAME_LENGTH) {
  236. objetArray[obj_index][1] = false;
  237. animationQueue.shift();
  238. } else {
  239. break;
  240. }
  241. }
  242. for (var i = 0; i < objetArray.length; i++) {
  243. var obj = objetArray[i][0];
  244. var isAnimating = objetArray[i][1];
  245. if (isAnimating == false) {
  246. var px = obj.position.x;
  247. var py = obj.position.y;
  248. var dist = Math.sqrt(Math.pow(px - mouseScaled.x, 2) + Math.pow(py - mouseScaled.y, 2));
  249. if (dist < INTERACT_DISTANCE) {
  250. var startPosVector = obj.position.clone();
  251. var mouseRepelVector = new THREE.Vector3().subVectors(startPosVector, mouseScaled).multiplyScalar(THREE.Math.randFloat(INTERACT_DISTANCE + 0.5, INTERACT_DISTANCE + 2) - dist);
  252. var endPosVector = new THREE.Vector3().addVectors(startPosVector, mouseRepelVector);
  253. animationQueue.push([i, 0, startPosVector, endPosVector]);
  254. objetArray[i][1] = true;
  255. }
  256. }
  257. }
  258. for (var i = 0; i < animationQueue.length; i++) {
  259. var obj = objetArray[animationQueue[i][0]][0];
  260. var ani_frame = animationQueue[i][1];
  261. var startPosVector = animationQueue[i][2];
  262. var endPosVector = animationQueue[i][3];
  263. var curPosVector = new THREE.Vector3();
  264. var frac = 1 - Math.abs(ani_frame - (ANIMATION_FRAME_LENGTH / 2)) / (ANIMATION_FRAME_LENGTH / 2);
  265. frac = easeOutQuad(frac);
  266. curPosVector.lerpVectors(startPosVector, endPosVector, frac);
  267. obj.position.x = curPosVector.x;
  268. obj.position.y = curPosVector.y;
  269. obj.position.z = curPosVector.z;
  270. animationQueue[i][1] += 1;
  271. }
  272. mouse = new THREE.Vector3(10000, 10000, -2);
  273. mouseScaled = new THREE.Vector3(10000, 10000, -2);
  274. renderer.render(scene, camera);
  275. }
  276. function onWindowResize() {
  277. SCREEN_HEIGHT = Math.min(window.innerWidth, window.innerHeight);
  278. SCREEN_WIDTH = SCREEN_HEIGHT;
  279. SCREEN_ASPECT_RATIO = SCREEN_WIDTH / SCREEN_HEIGHT;
  280. camera.aspect = SCREEN_ASPECT_RATIO;
  281. camera.updateProjectionMatrix();
  282. renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT);
  283. console.log(SCREEN_WIDTH + "x" + SCREEN_HEIGHT)
  284. }
  285. function onDocumentMouseMove(event) {
  286. var rect = canvas.getBoundingClientRect();
  287. mouse.x = event.clientX - rect.left;
  288. mouse.y = event.clientY - rect.top;
  289. mouseScaled.x = mouse.x * viewWidth / SCREEN_WIDTH - viewWidth / 2;
  290. mouseScaled.y = -mouse.y * viewHeight / SCREEN_HEIGHT + viewHeight / 2;
  291. }
  292. function sigmoid(t) {
  293. return 1 / (1 + Math.pow(Math.E, -t));
  294. }
  295. // no easing, no acceleration
  296. function linear(t) {
  297. return t;
  298. }
  299. // accelerating from zero velocity
  300. function easeInQuad(t) {
  301. return t * t;
  302. }
  303. // decelerating to zero velocity
  304. function easeOutQuad(t) {
  305. return t * (2 - t);
  306. }
  307. // acceleration until halfway, then deceleration
  308. function easeInOutQuad(t) {
  309. return t < .5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
  310. }
  311. // accelerating from zero velocity
  312. function easeInCubic(t) {
  313. return t * t * t;
  314. }
  315. // decelerating to zero velocity
  316. function easeOutCubic(t) {
  317. return (--t) * t * t + 1;
  318. }
  319. // acceleration until halfway, then deceleration
  320. function easeInOutCubic(t) {
  321. return t < .5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
  322. }
  323. // accelerating from zero velocity
  324. function easeInQuart(t) {
  325. return t * t * t * t;
  326. }
  327. // decelerating to zero velocity
  328. function easeOutQuart(t) {
  329. return 1 - (--t) * t * t * t;
  330. }
  331. // acceleration until halfway, then deceleration
  332. function easeInOutQuart(t) {
  333. return t < .5 ? 8 * t * t * t * t : 1 - 8 * (--t) * t * t * t;
  334. }
  335. // accelerating from zero velocity
  336. function easeInQuint(t) {
  337. return t * t * t * t * t;
  338. }
  339. // decelerating to zero velocity
  340. function easeOutQuint(t) {
  341. return 1 + (--t) * t * t * t * t;
  342. }
  343. // acceleration until halfway, then deceleration
  344. function easeInOutQuint(t) {
  345. return t < .5 ? 16 * t * t * t * t * t : 1 + 16 * (--t) * t * t * t * t;
  346. }
  347. //Event Handlers
  348. window.addEventListener("resize", onWindowResize);
  349. init();
  350. animate();
  351. }
  352. ThreeJSCanvas(1);
  353. </script>
  354. </body>
  355. <!-- layui -->
  356. <script type="text/javascript" src="static/home/lib/layui/layui.all.js"></script>
  357. </html>