{"id":418184,"date":"2024-06-30T02:01:20","date_gmt":"2024-06-30T02:01:20","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=418184"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-06-30T02:01:20","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=418184","title":{"rendered":"<span>\u041a\u0430\u043a \u043d\u0430 Three.Js \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0430\u043d\u0438\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0442\u0443\u043d\u043d\u0435\u043b\u044c \u0438\u0437 \u0447\u0430\u0441\u0442\u0438\u0446<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/706\/0e1\/760\/7060e1760821b94b5b63d489d878cc8e.jpg\" width=\"780\" height=\"439\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/706\/0e1\/760\/7060e1760821b94b5b63d489d878cc8e.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041e\u0434\u0438\u043d \u0438\u0437 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u0432 \u043c\u0438\u0442\u0430\u043f\u043e\u0432 \u0434\u043b\u044f \u043a\u0440\u0435\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0432 \u0411\u0435\u043b\u044c\u0433\u0438\u0438 Creative Front-end Belgium \u0432 \u0434\u0432\u0443\u0445 \u043f\u043e\u0441\u0442\u0430\u0445 \u043d\u0430 CodePen \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0438 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u043a\u0430\u043a \u0448\u0430\u0433 \u0437\u0430 \u0448\u0430\u0433\u043e\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0443\u043d\u043d\u0435\u043b\u044c \u0438\u0437 \u0447\u0430\u0441\u0442\u0438\u0446 \u0441 \u044d\u0444\u0444\u0435\u043a\u0442\u043e\u043c \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0432 \u043d\u0451\u043c. \u041a \u0441\u0442\u0430\u0440\u0442\u0443 <a href=\"https:\/\/skillfactory.ru\/frontend?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_fr_200821&amp;utm_term=lead\">\u043a\u0443\u0440\u0441\u0430 \u043f\u043e Frontend-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435<\/a> \u0434\u0435\u043b\u0438\u043c\u0441\u044f \u0441\u043e\u043a\u0440\u0430\u0449\u0451\u043d\u043d\u044b\u043c \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c \u044d\u0442\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 \u043e\u0431 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f, \u043f\u043e \u0441\u043b\u043e\u0432\u0430\u043c \u0430\u0432\u0442\u043e\u0440\u0430, \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0435\u043c\u0443 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e; \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043b\u0435\u0433\u043a\u043e \u043f\u043e\u0439\u043c\u0451\u0442\u0435, \u043a\u0430\u043a \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0434\u043b\u044f \u0441\u0432\u043e\u0438\u0445 \u043d\u0443\u0436\u0434, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0430 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 \u0438\u043b\u0438 \u0432 \u0432\u0430\u0448\u0435\u0439 \u0438\u0433\u0440\u0435.<\/p>\n<hr\/>\n<p>\u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0447\u0442\u043e-\u0442\u043e, \u0447\u0442\u043e \u043c\u043d\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f, \u0442\u043e \u044d\u0442\u043e \u0442\u0443\u043d\u043d\u0435\u043b\u044c\u043d\u0430\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f. \u041d\u0438\u0436\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u0443 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e.<\/p>\n<h2>1. \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0441\u0446\u0435\u043d\u0443<\/h2>\n<p>\u042f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0432 \u0434\u0435\u043c\u043e \u043d\u0438\u0436\u0435 \u043e\u0441\u043d\u043e\u0432\u0443 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0446\u0435\u043d\u044b Three.Js.<\/p>\n<ul>\n<li>\n<p>\u0425\u043e\u043b\u0441\u0442 HTML (canvas).<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u043c\u043d\u043e\u0433\u043e CSS \u0434\u043b\u044f \u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0433\u043e \u0433\u043b\u0430\u0437\u0443 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u043d\u0434\u0435\u0440\u0435\u0440 WebGL, \u0441\u0446\u0435\u043d\u0430, \u043a\u0430\u043c\u0435\u0440\u0430 \u0438 \u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u043a\u0443\u0431, \u0447\u0442\u043e\u0431\u044b \u0443\u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Three.Js.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/611f9354abf7c98fe8a33432\" data-style=\"\" id=\"611f9354abf7c98fe8a33432\" width=\"\"><\/div>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435 \u043a\u0443\u0431, \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c:<\/p>\n<h3>2. \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u044e \u0442\u0440\u0443\u0431\u044b<\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0440\u0443\u0431\u0443 \u0432 Three.Js, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0435\u0433\u043e \u043c\u0430\u0440\u0448\u0440\u0443\u0442, \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u043c THREE.CatmullRomCurve3(), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043b\u0430\u0432\u043d\u044b\u0439 \u0441\u043f\u043b\u0430\u0439\u043d \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0432\u0435\u0440\u0448\u0438\u043d. \u0412 \u044d\u0442\u043e\u0439 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u044f \u0436\u0451\u0441\u0442\u043a\u043e \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043b \u043c\u0430\u0441\u0441\u0438\u0432 \u0442\u043e\u0447\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u044e \u0432 Vector3(). \u0421\u043e \u0441\u0432\u043e\u0438\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c \u0432\u0435\u0440\u0448\u0438\u043d \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u043e\u0433\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442:<\/p>\n<pre><code class=\"javascript\">\/\/Hard coded array of points var points = [   [0, 2],   [2, 10],   [-1, 15],   [-3, 20],   [0, 25] ];  \/\/Convert the array of points into vertices for (var i = 0; i &lt; points.length; i++) {   var x = points[i][0];   var y = 0;   var z = points[i][1];   points[i] = new THREE.Vector3(x, y, z); } \/\/Create a path from the points var path = new THREE.CatmullRomCurve3(points);<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u0432 \u043c\u0430\u0440\u0448\u0440\u0443\u0442, \u043d\u0430 \u0435\u0433\u043e \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0440\u0443\u0431\u043a\u0443 \u0442\u0443\u043d\u043d\u0435\u043b\u044f:<\/p>\n<pre><code class=\"javascript\">\/\/Create the tube geometry from the path \/\/1st param is the path \/\/2nd param is the amount of segments we want to make the tube \/\/3rd param is the radius of the tube \/\/4th param is the amount of segment along the radius \/\/5th param specify if we want the tube to be closed or not var geometry = new THREE.TubeGeometry( path, 64, 2, 8, false ); \/\/Basic red material var material = new THREE.MeshBasicMaterial( { color: 0xff0000 } ); \/\/Create a mesh var tube = new THREE.Mesh( geometry, material ); \/\/Add tube into the scene scene.add( tube );<\/code><\/pre>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/611f93aa9b18798fbe34cc26\" data-style=\"\" id=\"611f93aa9b18798fbe34cc26\" width=\"\"><\/div>\n<p>\u0421\u0435\u0439\u0447\u0430\u0441 \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0430 \u0441\u0446\u0435\u043d\u0435 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0442\u0440\u0443\u0431\u044b.<\/p>\n<h3>3. \u0422\u0440\u0443\u0431\u0430 \u0442\u0443\u043d\u043d\u0435\u043b\u044f \u0438\u0437 \u043f\u043e\u043b\u0438\u0433\u043e\u043d\u0430 SVG<\/h3>\n<p>\u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0436\u0451\u0441\u0442\u043a\u043e \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u043d\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f. \u041c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0442\u043e\u0447\u0435\u043a \u043f\u043e \u043a\u0430\u043a\u043e\u043c\u0443-\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u043c\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0443. \u041d\u043e \u0432 \u044d\u0442\u043e\u0439 \u0434\u0435\u043c\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437 \u043d\u0435\u043a\u043e\u0435\u0433\u043e SVG, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0432 Adobe Illustrator. \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0445\u043e\u0442\u0438\u0442\u0435 \u043a\u0440\u0438\u0432\u0443\u044e \u0411\u0435\u0437\u044c\u0435, Illustrator \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u043a\u0430\u043a \u043f\u043e\u043b\u0438\u0433\u043e\u043d, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"xml\">&lt;svg viewBox=\"0 0 346.4 282.4\">     &lt;polygon points=\"68.5,185.5 1,262.5 270.9,281.9 345.5,212.8 178,155.7 240.3,72.3 153.4,0.6 52.6,53.3 \"\/> &lt;\/svg><\/code><\/pre>\n<p>\u0418\u0437 \u043f\u043e\u043b\u0438\u0433\u043e\u043d\u0430 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c SVG \u0432 \u043c\u0430\u0441\u0441\u0438\u0432:<\/p>\n<pre><code class=\"javascript\">var points = [     [68.5,185.5],     [1,262.5],     [270.9,281.9],     [345.5,212.8],     [178,155.7],     [240.3,72.3],     [153.4,0.6],     [52.6,53.3],     [68.5,185.5] ]; \/\/Do not forget to set the last parameter to True, since we want our tube to be closed var geometry = new THREE.TubeGeometry( path, 300, 2, 20, true );<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u0430, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/611f949d920526a288c7e1d5\" data-style=\"\" id=\"611f949d920526a288c7e1d5\" width=\"\"><\/div>\n<p>\u0421\u043b\u0435\u0432\u0430 \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435 \u043f\u043e\u043b\u0438\u0433\u043e\u043d. \u0422\u0440\u0443\u0431\u0430 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0437\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u043d\u0430\u043c\u0438 \u0442\u043e\u0447\u043a\u0430\u043c\u0438.<\/p>\n<h3>4. \u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c \u043a\u0430\u043c\u0435\u0440\u0443 \u0432 \u0442\u0440\u0443\u0431\u0435<\/h3>\n<p>\u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0442\u0440\u0443\u0431\u0430, \u043e\u0441\u0442\u0430\u043b\u0430\u0441\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u2014 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f. \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430 \u2014 path.getPointAt(t). \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u043e\u0447\u043a\u0443 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0430 \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430. \u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u043d\u0442 \u2014 \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0442 \u043d\u0443\u043b\u044f \u0434\u043e \u0435\u0434\u0438\u043d\u0438\u0446\u044b. 0 \u2014 \u043f\u0435\u0440\u0432\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430, 1 \u2014 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0442\u043e\u0447\u043a\u0430. \u0427\u0442\u043e\u0431\u044b \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u043a\u0430\u043c\u0435\u0440\u0443 \u0432\u0434\u043e\u043b\u044c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430, \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u043a\u0430\u0434\u0440\u0435:<\/p>\n<pre><code class=\"javascript\">\/\/Start the percentage at 0 var percentage = 0; function render(){   \/\/Increase the percentage   percentage += 0.001;   \/\/Get the point at the specific percentage   var p1 = path.getPointAt(percentage%1);   \/\/Place the camera at the point   camera.position.set(p1.x,p1.y,p1.z);    renderer.render(scene, camera);   requestAnimationFrame(render); } requestAnimationFrame(render);<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f getPointAt \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f 0 \u0438 1, \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u044b \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443, \u0447\u0442\u043e\u0431\u044b \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 \u0432\u044b\u0439\u0434\u0435\u0442 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b 1.<\/p>\n<p>\u042d\u0442\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043f\u043e\u0437\u0438\u0446\u0438\u0435\u0439, \u043d\u043e \u043a\u0430\u043c\u0435\u0440\u0430 \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u0432 \u043e\u0434\u043d\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438. \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u043c\u0435\u0440\u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0430 \u043d\u0430 \u0442\u043e\u0447\u043a\u0443 \u0432\u0434\u043e\u043b\u044c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430, \u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0434\u0430\u043b\u044c\u0448\u0435. \u041d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u043a\u0430\u0434\u0440\u0435 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0442\u043e\u0447\u043a\u0443, \u0433\u0434\u0435 \u0441\u0442\u043e\u0438\u0442 \u043a\u0430\u043c\u0435\u0440\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0442\u043e\u0447\u043a\u0443, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043a\u0430\u043c\u0435\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c:<\/p>\n<pre><code class=\"javascript\">var percentage = 0; function render(){   percentage += 0.001;   var p1 = path.getPointAt(percentage%1);   \/\/Get another point along the path but further   var p2 = path.getPointAt((percentage + 0.01)%1);   camera.position.set(p1.x,p1.y,p1.z);   \/\/Rotate the camera into the orientation of the second point   camera.lookAt(p2);    renderer.render(scene, camera);   requestAnimationFrame(render); }<\/code><\/pre>\n<p>\u0415\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430. \u0421\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0430\u043c\u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u043d\u0430\u0440\u0443\u0436\u0443. \u0418 \u0434\u0430\u0436\u0435 \u0442\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043a\u0430\u043c\u0435\u0440\u0430 \u0432\u043d\u0443\u0442\u0440\u0438 \u0442\u0440\u0443\u0431\u044b \u0442\u0443\u043d\u043d\u0435\u043b\u044f, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0442\u043e\u0440\u043e\u043d\u044b. \u0418, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0430 \u0441\u0446\u0435\u043d\u0435 \u043d\u0435\u0442 \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u043b\u0435\u0433\u043a\u043e \u0432\u0438\u0434\u0435\u0442\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0435, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043d\u0430 \u043a\u0430\u0440\u043a\u0430\u0441\u043d\u044b\u0439:<\/p>\n<pre><code class=\"javascript\">var material = new THREE.MeshBasicMaterial({   color: 0xff0000, \/\/Red color   side : THREE.BackSide, \/\/Reverse the sides   wireframe:true \/\/Display the tube as a wireframe });<\/code><\/pre>\n<p>\u0412\u0443\u0430\u043b\u044f! \u041a\u0430\u043c\u0435\u0440\u0430 \u0432 \u0442\u0440\u0443\u0431\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f.<\/p>\n<h3>5. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u0435<\/h3>\n<p>\u041d\u0435 \u0441\u0442\u0430\u043d\u0443 \u0432\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0434\u0435\u0442\u0430\u043b\u0438, \u043d\u043e \u043f\u043e\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u0435 \u0432 \u0442\u0440\u0443\u0431\u0435. \u041f\u0440\u0438\u043d\u0446\u0438\u043f \u0442\u043e\u0442 \u0436\u0435, \u0447\u0442\u043e \u0438 \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c \u043a\u0430\u043c\u0435\u0440\u044b: \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u0435, \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0442\u043e\u0447\u043a\u0443, \u043a\u0443\u0434\u0430 \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u043a\u0430\u043c\u0435\u0440\u0430.<\/p>\n<ul>\n<li>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c PointLight (\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0441\u0432\u0435\u0442\u0430) \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0435\u0433\u043e \u043d\u0430 \u0441\u0446\u0435\u043d\u0443:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"javascript\">\/\/Create a point light in our scene var light = new THREE.PointLight(0xffffff,1, 50); scene.add(light);<\/code><\/pre>\n<ul>\n<li>\n<p>\u041c\u0435\u043d\u044f\u0435\u043c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043d\u0430 \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a \u0441\u0432\u0435\u0442\u0443:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"javascript\">var material = new THREE.MeshLambertMaterial({   color: 0xff0000,   side : THREE.BackSide });<\/code><\/pre>\n<ul>\n<li>\n<p>\u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0440\u0435\u043d\u0434\u0435\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0441\u0432\u0435\u0442:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"javascript\">var percentage = 0; function render(){   percentage += 0.0003;   var p1 = path.getPointAt(percentage%1);   var p2 = path.getPointAt((percentage + 0.02)%1);   camera.position.set(p1.x,p1.y,p1.z);   camera.lookAt(p2);   light.position.set(p2.x, p2.y, p2.z);    renderer.render(scene, camera);   requestAnimationFrame(render); }<\/code><\/pre>\n<p>\u0418 \u0432\u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/611f95aef2fa57a26f179ff9\" data-style=\"\" id=\"611f95aef2fa57a26f179ff9\" width=\"\"><\/div>\n<h3>6. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c<\/h3>\n<p>\u041d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u0448\u0430\u0433\u0435 \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u0444\u043e\u0440\u043a \u0438 \u043f\u0440\u043e\u0438\u0433\u0440\u0430\u043b \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a, \u0435\u0441\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e. <\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0439 \u0434\u0435\u043c\u043e \u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b \u0440\u0430\u0437\u043d\u044b\u0435 \u0446\u0432\u0435\u0442\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0433\u0440\u0430\u043d\u0438. \u0422\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u043c\u043e\u0437\u0430\u0438\u043a\u0430:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/611f969b6f06c2a29f4b4619\" data-style=\"\" id=\"611f969b6f06c2a29f4b4619\" width=\"\"><\/div>\n<p>\u0410 \u0437\u0434\u0435\u0441\u044c, \u0447\u0442\u043e\u0431\u044b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0440\u0448\u0440\u0443\u0442, \u044f \u0438\u0433\u0440\u0430\u044e \u0441 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043d\u0430 \u043e\u0441\u0438 Y. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0442\u0440\u0443\u0431\u0430 \u0438\u0437\u0433\u0438\u0431\u0430\u0435\u0442\u0441\u044f \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043e\u0434\u043d\u043e\u0439 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438, \u0430 \u0432 \u0442\u0440\u0451\u0445 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f\u0445.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/611f97178ff4968fafa2a934\" data-style=\"\" id=\"611f97178ff4968fafa2a934\" width=\"\"><\/div>\n<p>\u0410 \u0437\u0434\u0435\u0441\u044c \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u043f\u044f\u0442\u044c \u0442\u0443\u043d\u043d\u0435\u043b\u0435\u0439 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u0440\u0430\u0434\u0438\u0443\u0441\u0430 \u0438 \u0446\u0432\u0435\u0442\u0430. \u041e\u043d\u0438 \u0442\u0430\u043a\u0436\u0435 \u0438\u043c\u0435\u044e\u0442 \u0440\u0430\u0437\u043d\u0443\u044e \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/611f97ba2077cda25f846b52\" data-style=\"\" id=\"611f97ba2077cda25f846b52\" width=\"\"><\/div>\n<p>\u041d\u0438\u0436\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0438 TubeGeometry() \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u0438\u0446\u044b.<\/p>\n<hr\/>\n<p><a href=\"https:\/\/codepen.io\/Mamboleoo\/post\/tunnel-animation-2\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/a> \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438.<\/p>\n<h2>7. \u0420\u0430\u0441\u0447\u0451\u0442 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0447\u0430\u0441\u0442\u0438\u0446<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u0436\u0435\u043b\u0430\u0435\u043c\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043a\u0440\u0443\u0433\u0438 \u0447\u0430\u0441\u0442\u0438\u0446, \u0432\u0441\u0435 \u0432\u0434\u043e\u043b\u044c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430. \u0422\u043e\u0442 \u0436\u0435 \u043f\u043e\u0434\u0445\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f Three.Js \u043f\u0440\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u0440\u0443\u0431\u044b, \u0441 \u0442\u043e\u0439 \u043b\u0438\u0448\u044c \u0440\u0430\u0437\u043d\u0438\u0446\u0435\u0439, \u0447\u0442\u043e \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438 \u0442\u0440\u0443\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0433\u0440\u0430\u043d\u0438. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0434\u0435\u0442\u0430\u043b\u044c \u0442\u0440\u0443\u0431\u044b \u0438 \u0435\u0451 \u0440\u0430\u0434\u0438\u0443\u0441. \u0414\u0435\u0442\u0430\u043b\u044c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0432\u0443\u043c\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438:<\/p>\n<pre><code class=\"javascript\">\/\/ The amount of circles that will form the tube var segments = 500; \/\/ The amount of particles that will shape each circle var circlesDetail = 10; \/\/ The radius of the tube var radius = 5;<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0431\u043e\u043b\u0435\u0435 \u0438\u043b\u0438 \u043c\u0435\u043d\u0435\u0435 \u0437\u043d\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0447\u0430\u0441\u0442\u0438\u0446 (segments * circlesDetail), \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0442\u0440\u0451\u0445\u0433\u0440\u0430\u043d\u043d\u0438\u043a\u0438 \u0424\u0440\u0435\u043d\u0435. \u042f \u043d\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0442 \u0432 \u044d\u0442\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438, \u043d\u043e, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u044e, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0442\u0440\u0451\u0445\u0433\u0440\u0430\u043d\u043d\u0438\u043a\u0438 \u0424\u0440\u0435\u043d\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430 \u0442\u0440\u0443\u0431\u044b. \u041a\u0430\u0436\u0434\u044b\u0439 \u0442\u0440\u0451\u0445\u0433\u0440\u0430\u043d\u043d\u0438\u043a \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043a\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439, \u043d\u043e\u0440\u043c\u0430\u043b\u0438 \u0438 \u0431\u0438\u043d\u043e\u0440\u043c\u0430\u043b\u0438. \u041f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u044d\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u043c\u0438, \u043a\u0443\u0434\u0430 \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u043a\u0430\u043c\u0435\u0440\u0430.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0440\u0430\u0441\u0447\u0451\u0442\u044b, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Frenet%E2%80%93Serret_formulas\">\u0441\u0442\u0430\u0442\u044c\u044e<\/a> \u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0438.<\/p>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f Three.Js \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u0442\u043e\u043c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u043e\u0434, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430:<\/p>\n<pre><code class=\"javascript\">var frames = path.computeFrenetFrames(segments, true); \/\/ True specify if the path is closed or not, in our case it must be<\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u2014 \u043d\u0430\u0431\u043e\u0440 \u0438\u0437 \u0442\u0440\u0451\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 Vector3():<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/03f\/23e\/437\/03f23e437212b5d148b159cb94c7a36b.png\" alt=\"fig:\" title=\"fig:\" width=\"232\" height=\"100\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/03f\/23e\/437\/03f23e437212b5d148b159cb94c7a36b.png\"\/><figcaption>fig:<\/figcaption><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0438\u043c\u0435\u044f \u0432\u0441\u0451 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430, \u043c\u044b \u043d\u0430\u0447\u043d\u0451\u043c \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0432\u0434\u043e\u043b\u044c \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430. \u041c\u044b \u0445\u0440\u0430\u043d\u0438\u043c \u043a\u0430\u0436\u0434\u0443\u044e \u0442\u043e\u0447\u043a\u0443 \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u043a\u0430\u043a Vector3 \u0432 Grometry() \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0437\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u0447\u043a\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e:<\/p>\n<pre><code class=\"javascript\">\/\/ Create an empty Geometry where we will insert the particles var geometry = new THREE.Geometry();<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u044b \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0435. \u0412\u043e\u0442 \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u043c\u044b \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043b\u0438 \u0446\u0438\u043a\u043b\u043e\u043c \u043f\u043e \u0432\u0441\u0435\u043c \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u043c. \u042f \u043e\u0431\u044a\u044f\u0441\u043d\u044e, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0430 \u043a\u043e\u0434 \u043d\u0438\u0436\u0435, \u0434\u0435\u0442\u0430\u043b\u0438 \u0432\u044b \u043d\u0430\u0439\u0434\u0451\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445:<\/p>\n<pre><code class=\"javascript\">\/\/ Loop through all segments for (var i = 0; i &lt; segments; i++) {    \/\/ Get the normal values of the segment from the Frenet frames   var normal = frames.normals[i];   \/\/ Get the binormal values of the segment from the Frenet frames   var binormal = frames.binormals[i];    \/\/ Calculate the index of the segment (from 0 to 1)   var index = i \/ segments;    \/\/ Get the coordinates of the point in the center of the segment   \/\/ We already used the function in the first part to move the camera along the path   var p = path.getPointAt(index);    \/\/ Loop for the amount of particles we want along each circle   for (var j = 0; j &lt; circlesDetail; j++) {      \/\/ Clone the point in the center of the circle     var position = p.clone();      \/\/ We need to position every point based on an angle from 0 to Pi*2     \/\/ If you want only half a tube (like a water slide) you could calculate the angle from 0 to Pi.     var angle = (j \/ circlesDetail) * Math.PI * 2;      \/\/ Calculate the sine of the angle     var sin = Math.sin(angle);     \/\/ Calculate the negative cosine of the angle     var cos = -Math.cos(angle);      \/\/ Calculate the normal of each point based on its angle and the normal and binormal of the segment      var normalPoint = new THREE.Vector3(0,0,0);     normalPoint.x = (cos * normal.x + sin * binormal.x);     normalPoint.y = (cos * normal.y + sin * binormal.y);     normalPoint.z = (cos * normal.z + sin * binormal.z);      \/\/ Multiple the normal by the radius so that our tube is not a tube of 1 as radius     normalPoint.multiplyScalar(radius);      \/\/ Add the normal values to the center of the circle     position.add(normalPoint);      \/\/ Push the vector into our geometry     geometry.vertices.push(position);   } }<\/code><\/pre>\n<p>\u041f\u043e\u043d\u044f\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u043e. \u042f \u0441\u0430\u043c \u0441\u043c\u043e\u0442\u0440\u0435\u043b \u043d\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 Three.Js, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0435\u0433\u043e. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u043d\u0438\u0436\u0435, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u0430 \u0437\u0430 \u0434\u0440\u0443\u0433\u043e\u0439. \u041d\u0430\u0436\u043c\u0438\u0442\u0435 \u043a\u043d\u043e\u043f\u043a\u0443 Rerun, \u0435\u0441\u043b\u0438 \u0442\u0440\u0443\u0431\u0430 \u0443\u0436\u0435 \u0432\u0438\u0434\u043d\u0430 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/611f9891920526a288c7e1d6\" data-style=\"\" id=\"611f9891920526a288c7e1d6\" width=\"\"><\/div>\n<h2>8. \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0442\u0440\u0443\u0431\u0443<\/h2>\n<p>\u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0439 \u0432\u0435\u0440\u0448\u0438\u043d\u0430\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442 Geometry. \u041f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 Points, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0435\u0433\u043e \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0442\u043e\u0447\u043a\u0438 \u0441 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0435 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0441 \u0447\u0430\u0441\u0442\u0438\u0446\u0430\u043c\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u044b \u0438\u043b\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0446\u0432\u0435\u0442\u0430.<\/p>\n<p>\u0422\u043e\u0447\u043d\u043e \u0442\u0430\u043a, \u043a\u0430\u043a \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0441\u0435\u0442\u043a\u0438 Mesh, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u0432\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 Points; \u043d\u0443\u0436\u0435\u043d \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0438 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u044f. \u041d\u043e \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u044e \u043c\u044b \u0443\u0436\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u043d\u0430 \u0448\u0430\u0433\u0435 5, \u0442\u0430\u043a \u0447\u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u043d\u0430\u0434 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u043e\u043c:<\/p>\n<pre><code class=\"javascript\">var material = new THREE.PointsMaterial({   size: 1, \/\/ The size of each point   sizeAttenuation: true, \/\/ If we want the points to change size depending of distance with camera   color: 0xff0000 \/\/ The color of the points });<\/code><\/pre>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/611f995b12b0d58fd6dde6b7\" data-style=\"\" id=\"611f995b12b0d58fd6dde6b7\" width=\"\"><\/div>\n<h2>9. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u0432\u0441\u0451 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u043b\u043e\u0441\u044c, \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u043c \u043a\u043e\u0434 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0434\u0435\u043c\u043e:<\/p>\n<pre><code class=\"javascript\">var percentage = 0; function render() {    \/\/ Increase the percentage   percentage += 0.0005;   \/\/ Get the point where the camera should go   var p1 = path.getPointAt(percentage % 1);   \/\/ Get the point where the camera should look at   var p2 = path.getPointAt((percentage + 0.01) % 1);   camera.position.set(p1.x, p1.y, p1.z);   camera.lookAt(p2);    \/\/ Render the scene   renderer.render(scene, camera);    \/\/ Animation loop   requestAnimationFrame(render); }<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0442\u0443\u043d\u043d\u0435\u043b\u044c \u0438\u0437 \u0447\u0430\u0441\u0442\u0438\u0446 \u0433\u043e\u0442\u043e\u0432:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/611f99cbabf7c98fe8a33433\" data-style=\"\" id=\"611f99cbabf7c98fe8a33433\" width=\"\"><\/div>\n<h2>10. \u041a\u0440\u0430\u0441\u043e\u0447\u043d\u044b\u0439 \u0442\u0443\u043d\u043d\u0435\u043b\u044c<\/h2>\n<p>\u0417\u0434\u0435\u0441\u044c \u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0446\u0432\u0435\u0442 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u0430 (Vector \u0432 \u043a\u043e\u0434\u0435), \u0430 \u0442\u0430\u043a\u0436\u0435 Fog \u043d\u0430 \u0441\u0446\u0435\u043d\u0435, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0430 \u0437\u0430\u0442\u0443\u0445\u0430\u043d\u0438\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u0442\u0443\u043d\u043d\u0435\u043b\u044f:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/611f9a272077cda25f846b53\" data-style=\"\" id=\"611f9a272077cda25f846b53\" width=\"\"><\/div>\n<pre><code class=\"javascript\">\/\/ First create a new color based on the index of the vertice var color = new THREE.Color(\"hsl(\" + (index * 360 * 4) + \", 100%, 50%)\"); \/\/ Push the color into the colors array in the Geometry object geometry.colors.push(color);  var material = new THREE.PointsMaterial({   size: 0.2,   vertexColors: THREE.VertexColors \/\/ We specify that the colors must come from the Geometry });  \/\/ Add some fog in the scene scene.fog = new THREE.Fog(0x000000, 30, 150);<\/code><\/pre>\n<h2>11. \u041f\u0435\u0449\u0435\u0440\u0430 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432<\/h2>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/611f9aa6f2fa57a26f179ffb\" data-style=\"\" id=\"611f9aa6f2fa57a26f179ffb\" width=\"\"><\/div>\n<p>\u042d\u0442\u043e\u0442 \u0442\u0443\u043d\u043d\u0435\u043b\u044c \u0441\u0434\u0435\u043b\u0430\u043d \u0438\u0437 \u043a\u0443\u0431\u043e\u0432. \u0412\u043c\u0435\u0441\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 Points \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0432\u0435\u0440\u0448\u0438\u043d \u044f \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c Mesh, \u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0435 \u0446\u0432\u0435\u0442\u0430 \u043e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u043b\u0438\u0441\u044c \u043d\u0430 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u0448\u0443\u043c\u0430 \u041f\u0435\u0440\u043b\u0438\u043d\u0430.<\/p>\n<h2>12. \u041e\u043a\u0442\u0430\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0443\u043d\u043d\u0435\u043b\u044c<\/h2>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/611f9aee12b0d58fd6dde6b8\" data-style=\"\" id=\"611f9aee12b0d58fd6dde6b8\" width=\"\"><\/div>\n<p>\u0417\u0434\u0435\u0441\u044c \u044f \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u044e \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u043a\u0430\u0436\u0434\u043e\u0439 \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u0438, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043b\u0438\u043d\u0438\u0438. \u042f \u0438\u0433\u0440\u0430\u044e \u0441 \u0443\u0433\u043b\u043e\u043c \u043d\u0430\u043a\u043b\u043e\u043d\u0430 \u0432\u0435\u0440\u0448\u0438\u043d \u0438 \u0438\u0445 \u0446\u0432\u0435\u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0438\u043b\u043b\u044e\u0437\u0438\u044f \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"javascript\">or (var i = 0; i &lt; tubeDetail; i++) {   \/\/ Create a new geometry for each circle   var circle = new THREE.Geometry();   for (var j = 0; j &lt; circlesDetail; j++) {     \/\/ Push the position of the vector     circle.vertices.push(position);   }   \/\/ Duplicate the first vector to make sure the circle is closed   circle.vertices.push(circle.vertices[0]);   \/\/ Create a new material with a custom color   var material = new THREE.LineBasicMaterial({     color: new THREE.Color(\"hsl(\"+(noise.simplex2(index*10,0)*60 + 300)+\",50%,50%)\")   });   \/\/ Create a Line object   var line = new THREE.Line(circle, material);   \/\/ Insert into the scene   scene.add(line);<\/code><\/pre>\n<p>\u0418\u0437 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0431\u0443\u0434\u0442\u043e \u043f\u043b\u043e\u0441\u043a\u043e\u0433\u043e \u0433\u0438\u043f\u0435\u0440\u0442\u0435\u043a\u0441\u0442\u0430 \u0432\u0435\u0431 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043b\u0441\u044f \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0442\u0432\u043e\u0440\u0447\u0435\u0441\u0442\u0432\u0430, \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432, \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u0435\u043d\u0438\u0439. \u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u0441\u0432\u044f\u0442\u0438\u0442\u044c \u0441\u0435\u0431\u044f \u0432\u0435\u0431-\u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f\u043c, \u0442\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u0438\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c\u0441\u044f \u043a \u043d\u0430\u0448\u0438\u043c \u043a\u0443\u0440\u0441\u0430\u043c\u00a0<a href=\"https:\/\/skillfactory.ru\/frontend?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_fr_200821&amp;utm_term=conc\">\u043f\u043e \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0443<\/a>\u00a0\u0438\u043b\u0438\u00a0<a href=\"https:\/\/skillfactory.ru\/python-fullstack-web-developer?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_fpw_200821&amp;utm_term=conc\">Fullstack-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043d\u0430 Python<\/a>, \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 HR, \u0447\u0442\u043e\u0431\u044b \u0441\u0442\u0430\u0442\u044c \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c. \u0412\u044b \u0442\u0430\u043a\u0436\u0435\u00a0<a href=\"https:\/\/skillfactory.ru\/courses\/?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=sf_allcourses_200821&amp;utm_term=conc\">\u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0437\u043d\u0430\u0442\u044c<\/a>, \u043a\u0430\u043a \u043d\u0430\u0447\u0430\u0442\u044c \u043a\u0430\u0440\u044c\u0435\u0440\u0443 \u0438\u043b\u0438 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0441\u0432\u043e\u0438 \u043d\u0430\u0432\u044b\u043a\u0438 \u043d\u0430 \u043d\u043e\u0432\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u0445:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/fc1\/0dc\/593\/fc10dc59305336f3a920430a052f1e81.png\" width=\"1000\" height=\"200\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fc1\/0dc\/593\/fc10dc59305336f3a920430a052f1e81.png\"\/><figcaption><\/figcaption><\/figure>\n<p><strong>Python, \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/python-fullstack-web-developer?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_fpw_200821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Fullstack-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0430 Python<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/python-for-web-developers?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_pws_200821&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00abPython \u0434\u043b\u044f \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438\u00bb<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/frontend?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_fr_200821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Frontend-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/webdev?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_webdev_200821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u0412\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>Data Science \u0438 Machine Learning<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/dstpro?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_dspr_200821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Data Scientist<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/dataanalystpro?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=analytics_dapr_200821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Data Analyst<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/math-stat-for-ds#syllabus?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_mat_200821&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00ab\u041c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430 \u0434\u043b\u044f Data Science\u00bb<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/math_and_ml?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_matml_200821&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00ab\u041c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430 \u0438 Machine Learning \u0434\u043b\u044f Data Science\u00bb<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/dataengineer?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_dea_200821&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u043f\u043e Data Engineering<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/ml-and-dl?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_mldl_200821&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00abMachine Learning \u0438 Deep Learning\u00bb<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/ml-programma-machine-learning-online?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_ml_200821&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u043f\u043e Machine Learning<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041c\u043e\u0431\u0438\u043b\u044c\u043d\u0430\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/iosdev?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_iosdev_200821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f iOS-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/android?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_andr_200821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Android-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>Java \u0438 C#<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/java?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_java_200821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Java-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/java-qa-engineer?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_qaja_200821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f QA-\u0438\u043d\u0436\u0435\u043d\u0435\u0440 \u043d\u0430 JAVA<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/csharp?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_cdev_200821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f C#-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/game-dev?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_gamedev_200821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0438\u0433\u0440 \u043d\u0430 Unity<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041e\u0442 \u043e\u0441\u043d\u043e\u0432 \u2014 \u0432 \u0433\u043b\u0443\u0431\u0438\u043d\u0443<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/algo?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_algo_200821&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00ab\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445\u00bb<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/cplus?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_cplus_200821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f C++ \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/cybersecurity?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_hacker_200821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u042d\u0442\u0438\u0447\u043d\u044b\u0439 \u0445\u0430\u043a\u0435\u0440<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>\u0410 \u0442\u0430\u043a\u0436\u0435:<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/devops?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_devops_200821&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u043f\u043e DevOps<\/a><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/570560\/\"> https:\/\/habr.com\/ru\/articles\/570560\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041e\u0434\u0438\u043d \u0438\u0437 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u0432 \u043c\u0438\u0442\u0430\u043f\u043e\u0432 \u0434\u043b\u044f \u043a\u0440\u0435\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0432 \u0411\u0435\u043b\u044c\u0433\u0438\u0438 Creative Front-end Belgium \u0432 \u0434\u0432\u0443\u0445 \u043f\u043e\u0441\u0442\u0430\u0445 \u043d\u0430 CodePen \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0438 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u043a\u0430\u043a \u0448\u0430\u0433 \u0437\u0430 \u0448\u0430\u0433\u043e\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0443\u043d\u043d\u0435\u043b\u044c \u0438\u0437 \u0447\u0430\u0441\u0442\u0438\u0446 \u0441 \u044d\u0444\u0444\u0435\u043a\u0442\u043e\u043c \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0432 \u043d\u0451\u043c. \u041a \u0441\u0442\u0430\u0440\u0442\u0443 <a href=\"https:\/\/skillfactory.ru\/frontend?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_fr_200821&amp;utm_term=lead\">\u043a\u0443\u0440\u0441\u0430 \u043f\u043e Frontend-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435<\/a> \u0434\u0435\u043b\u0438\u043c\u0441\u044f \u0441\u043e\u043a\u0440\u0430\u0449\u0451\u043d\u043d\u044b\u043c \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c \u044d\u0442\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 \u043e\u0431 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f, \u043f\u043e \u0441\u043b\u043e\u0432\u0430\u043c \u0430\u0432\u0442\u043e\u0440\u0430, \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0435\u043c\u0443 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e; \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043b\u0435\u0433\u043a\u043e \u043f\u043e\u0439\u043c\u0451\u0442\u0435, \u043a\u0430\u043a \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0434\u043b\u044f \u0441\u0432\u043e\u0438\u0445 \u043d\u0443\u0436\u0434, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0430 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 \u0438\u043b\u0438 \u0432 \u0432\u0430\u0448\u0435\u0439 \u0438\u0433\u0440\u0435.<\/p>\n<hr\/>\n<p>\u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0447\u0442\u043e-\u0442\u043e, \u0447\u0442\u043e \u043c\u043d\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f, \u0442\u043e \u044d\u0442\u043e \u0442\u0443\u043d\u043d\u0435\u043b\u044c\u043d\u0430\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f. \u041d\u0438\u0436\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u0443 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e.<\/p>\n<h2>1. \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0441\u0446\u0435\u043d\u0443<\/h2>\n<p>\u042f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0432 \u0434\u0435\u043c\u043e \u043d\u0438\u0436\u0435 \u043e\u0441\u043d\u043e\u0432\u0443 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0446\u0435\u043d\u044b Three.Js.<\/p>\n<ul>\n<li>\n<p>\u0425\u043e\u043b\u0441\u0442 HTML (canvas).<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u043c\u043d\u043e\u0433\u043e CSS \u0434\u043b\u044f \u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0433\u043e \u0433\u043b\u0430\u0437\u0443 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u043d\u0434\u0435\u0440\u0435\u0440 WebGL, \u0441\u0446\u0435\u043d\u0430, \u043a\u0430\u043c\u0435\u0440\u0430 \u0438 \u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u043a\u0443\u0431, \u0447\u0442\u043e\u0431\u044b \u0443\u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Three.Js.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/611f9354abf7c98fe8a33432\" data-style=\"\" id=\"611f9354abf7c98fe8a33432\" width=\"\"><\/div>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435 \u043a\u0443\u0431, \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c:<\/p>\n<h3>2. \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u044e \u0442\u0440\u0443\u0431\u044b<\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0440\u0443\u0431\u0443 \u0432 Three.Js, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0435\u0433\u043e \u043c\u0430\u0440\u0448\u0440\u0443\u0442, \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u043c THREE.CatmullRomCurve3(), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043b\u0430\u0432\u043d\u044b\u0439 \u0441\u043f\u043b\u0430\u0439\u043d \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0432\u0435\u0440\u0448\u0438\u043d. \u0412 \u044d\u0442\u043e\u0439 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u044f \u0436\u0451\u0441\u0442\u043a\u043e \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043b \u043c\u0430\u0441\u0441\u0438\u0432 \u0442\u043e\u0447\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u044e \u0432 Vector3(). \u0421\u043e \u0441\u0432\u043e\u0438\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c \u0432\u0435\u0440\u0448\u0438\u043d \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u043e\u0433\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442:<\/p>\n<pre><code class=\"javascript\">\/\/Hard coded array of points var points = [   [0, 2],   [2, 10],   [-1, 15],   [-3, 20],   [0, 25] ];  \/\/Convert the array of points into vertices for (var i = 0; i &lt; points.length; i++) {   var x = points[i][0];   var y = 0;   var z = points[i][1];   points[i] = new THREE.Vector3(x, y, z); } \/\/Create a path from the points var path = new THREE.CatmullRomCurve3(points);<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u0432 \u043c\u0430\u0440\u0448\u0440\u0443\u0442, \u043d\u0430 \u0435\u0433\u043e \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0440\u0443\u0431\u043a\u0443 \u0442\u0443\u043d\u043d\u0435\u043b\u044f:<\/p>\n<pre><code class=\"javascript\">\/\/Create the tube geometry from the path \/\/1st param is the path \/\/2nd param is the amount of segments we want to make the tube \/\/3rd param is the radius of the tube \/\/4th param is the amount of segment along the radius \/\/5th param specify if we want the tube to be closed or not var geometry = new THREE.TubeGeometry( path, 64, 2, 8, false ); \/\/Basic red material var material = new THREE.MeshBasicMaterial( { color: 0xff0000 } ); \/\/Create a mesh var tube = new THREE.Mesh( geometry, material ); \/\/Add tube into the scene scene.add( tube );<\/code><\/pre>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/611f93aa9b18798fbe34cc26\" data-style=\"\" id=\"611f93aa9b18798fbe34cc26\" width=\"\"><\/div>\n<p>\u0421\u0435\u0439\u0447\u0430\u0441 \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0430 \u0441\u0446\u0435\u043d\u0435 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0442\u0440\u0443\u0431\u044b.<\/p>\n<h3>3. \u0422\u0440\u0443\u0431\u0430 \u0442\u0443\u043d\u043d\u0435\u043b\u044f \u0438\u0437 \u043f\u043e\u043b\u0438\u0433\u043e\u043d\u0430 SVG<\/h3>\n<p>\u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0436\u0451\u0441\u0442\u043a\u043e \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u043d\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f. \u041c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0442\u043e\u0447\u0435\u043a \u043f\u043e \u043a\u0430\u043a\u043e\u043c\u0443-\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u043c\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0443. \u041d\u043e \u0432 \u044d\u0442\u043e\u0439 \u0434\u0435\u043c\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437 \u043d\u0435\u043a\u043e\u0435\u0433\u043e SVG, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0432 Adobe Illustrator. \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0445\u043e\u0442\u0438\u0442\u0435 \u043a\u0440\u0438\u0432\u0443\u044e \u0411\u0435\u0437\u044c\u0435, Illustrator \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u043a\u0430\u043a \u043f\u043e\u043b\u0438\u0433\u043e\u043d, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"xml\">&lt;svg viewBox=\"0 0 346.4 282.4\">     &lt;polygon points=\"68.5,185.5 1,262.5 270.9,281.9 345.5,212.8 178,155.7 240.3,72.3 153.4,0.6 52.6,53.3 \"\/> &lt;\/svg><\/code><\/pre>\n<p>\u0418\u0437 \u043f\u043e\u043b\u0438\u0433\u043e\u043d\u0430 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c SVG \u0432 \u043c\u0430\u0441\u0441\u0438\u0432:<\/p>\n<pre><code class=\"javascript\">var points = [     [68.5,185.5],     [1,262.5],     [270.9,281.9],     [345.5,212.8],     [178,155.7],     [240.3,72.3],     [153.4,0.6],     [52.6,53.3],     [68.5,185.5] ]; \/\/Do not forget to set the last parameter to True, since we want our tube to be closed var geometry = new THREE.TubeGeometry( path, 300, 2, 20, true );<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u0430, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/611f949d920526a288c7e1d5\" data-style=\"\" id=\"611f949d920526a288c7e1d5\" width=\"\"><\/div>\n<p>\u0421\u043b\u0435\u0432\u0430 \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435 \u043f\u043e\u043b\u0438\u0433\u043e\u043d. \u0422\u0440\u0443\u0431\u0430 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0437\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u043d\u0430\u043c\u0438 \u0442\u043e\u0447\u043a\u0430\u043c\u0438.<\/p>\n<h3>4. \u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c \u043a\u0430\u043c\u0435\u0440\u0443 \u0432 \u0442\u0440\u0443\u0431\u0435<\/h3>\n<p>\u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0442\u0440\u0443\u0431\u0430, \u043e\u0441\u0442\u0430\u043b\u0430\u0441\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u2014 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f. \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430 \u2014 path.getPointAt(t). \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u043e\u0447\u043a\u0443 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0430 \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430. \u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u043d\u0442 \u2014 \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0442 \u043d\u0443\u043b\u044f \u0434\u043e \u0435\u0434\u0438\u043d\u0438\u0446\u044b. 0 \u2014 \u043f\u0435\u0440\u0432\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430, 1 \u2014 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0442\u043e\u0447\u043a\u0430. \u0427\u0442\u043e\u0431\u044b \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u043a\u0430\u043c\u0435\u0440\u0443 \u0432\u0434\u043e\u043b\u044c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430, \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u043a\u0430\u0434\u0440\u0435:<\/p>\n<pre><code class=\"javascript\">\/\/Start the percentage at 0 var percentage = 0; function render(){   \/\/Increase the percentage   percentage += 0.001;   \/\/Get the point at the specific percentage   var p1 = path.getPointAt(percentage%1);   \/\/Place the camera at the point   camera.position.set(p1.x,p1.y,p1.z);    renderer.render(scene, camera);   requestAnimationFrame(render); } requestAnimationFrame(render);<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f getPointAt \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f 0 \u0438 1, \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u044b \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443, \u0447\u0442\u043e\u0431\u044b \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 \u0432\u044b\u0439\u0434\u0435\u0442 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b 1.<\/p>\n<p>\u042d\u0442\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043f\u043e\u0437\u0438\u0446\u0438\u0435\u0439, \u043d\u043e \u043a\u0430\u043c\u0435\u0440\u0430 \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u0432 \u043e\u0434\u043d\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438. \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u043c\u0435\u0440\u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0430 \u043d\u0430 \u0442\u043e\u0447\u043a\u0443 \u0432\u0434\u043e\u043b\u044c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430, \u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0434\u0430\u043b\u044c\u0448\u0435. \u041d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u043a\u0430\u0434\u0440\u0435 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0442\u043e\u0447\u043a\u0443, \u0433\u0434\u0435 \u0441\u0442\u043e\u0438\u0442 \u043a\u0430\u043c\u0435\u0440\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0442\u043e\u0447\u043a\u0443, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043a\u0430\u043c\u0435\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c:<\/p>\n<pre><code class=\"javascript\">var percentage = 0; function render(){   percentage += 0.001;   var p1 = path.getPointAt(percentage%1);   \/\/Get another point along the path but further   var p2 = path.getPointAt((percentage + 0.01)%1);   camera.position.set(p1.x,p1.y,p1.z);   \/\/Rotate the camera into the orientation of the second point   camera.lookAt(p2);    renderer.render(scene, camera);   requestAnimationFrame(render); }<\/code><\/pre>\n<p>\u0415\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430. \u0421\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0430\u043c\u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u043d\u0430\u0440\u0443\u0436\u0443. \u0418 \u0434\u0430\u0436\u0435 \u0442\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043a\u0430\u043c\u0435\u0440\u0430 \u0432\u043d\u0443\u0442\u0440\u0438 \u0442\u0440\u0443\u0431\u044b \u0442\u0443\u043d\u043d\u0435\u043b\u044f, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0442\u043e\u0440\u043e\u043d\u044b. \u0418, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0430 \u0441\u0446\u0435\u043d\u0435 \u043d\u0435\u0442 \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u043b\u0435\u0433\u043a\u043e \u0432\u0438\u0434\u0435\u0442\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0435, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043d\u0430 \u043a\u0430\u0440\u043a\u0430\u0441\u043d\u044b\u0439:<\/p>\n<pre><code class=\"javascript\">var material = new THREE.MeshBasicMaterial({   color: 0xff0000, \/\/Red color   side : THREE.BackSide, \/\/Reverse the sides   wireframe:true \/\/Display the tube as a wireframe });<\/code><\/pre>\n<p>\u0412\u0443\u0430\u043b\u044f! \u041a\u0430\u043c\u0435\u0440\u0430 \u0432 \u0442\u0440\u0443\u0431\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f.<\/p>\n<h3>5. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u0435<\/h3>\n<p>\u041d\u0435 \u0441\u0442\u0430\u043d\u0443 \u0432\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0434\u0435\u0442\u0430\u043b\u0438, \u043d\u043e \u043f\u043e\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u0435 \u0432 \u0442\u0440\u0443\u0431\u0435. \u041f\u0440\u0438\u043d\u0446\u0438\u043f \u0442\u043e\u0442 \u0436\u0435, \u0447\u0442\u043e \u0438 \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c \u043a\u0430\u043c\u0435\u0440\u044b: \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u0435, \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0442\u043e\u0447\u043a\u0443, \u043a\u0443\u0434\u0430 \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u043a\u0430\u043c\u0435\u0440\u0430.<\/p>\n<ul>\n<li>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c PointLight (\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0441\u0432\u0435\u0442\u0430) \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0435\u0433\u043e \u043d\u0430 \u0441\u0446\u0435\u043d\u0443:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"javascript\">\/\/Create a point light in our scene var light = new THREE.PointLight(0xffffff,1, 50); scene.add(light);<\/code><\/pre>\n<ul>\n<li>\n<p>\u041c\u0435\u043d\u044f\u0435\u043c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043d\u0430 \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a \u0441\u0432\u0435\u0442\u0443:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"javascript\">var material = new THREE.MeshLambertMaterial({   color: 0xff0000,   side : THREE.BackSide });<\/code><\/pre>\n<ul>\n<li>\n<p>\u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0440\u0435\u043d\u0434\u0435\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0441\u0432\u0435\u0442:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"javascript\">var percentage = 0; function render(){   percentage += 0.0003;   var p1 = path.getPointAt(percentage%1);   var p2 = path.getPointAt((percentage + 0.02)%1);   camera.position.set(p1.x,p1.y,p1.z);   camera.lookAt(p2);   light.position.set(p2.x, p2.y, p2.z);    renderer.render(scene, camera);   requestAnimationFrame(render); }<\/code><\/pre>\n<p>\u0418 \u0432\u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/611f95aef2fa57a26f179ff9\" data-style=\"\" id=\"611f95aef2fa57a26f179ff9\" width=\"\"><\/div>\n<h3>6. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c<\/h3>\n<p>\u041d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u0448\u0430\u0433\u0435 \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u0444\u043e\u0440\u043a \u0438 \u043f\u0440\u043e\u0438\u0433\u0440\u0430\u043b \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a, \u0435\u0441\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e. <\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0439 \u0434\u0435\u043c\u043e \u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b \u0440\u0430\u0437\u043d\u044b\u0435 \u0446\u0432\u0435\u0442\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0433\u0440\u0430\u043d\u0438. \u0422\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u043c\u043e\u0437\u0430\u0438\u043a\u0430:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/611f969b6f06c2a29f4b4619\" data-style=\"\" id=\"611f969b6f06c2a29f4b4619\" width=\"\"><\/div>\n<p>\u0410 \u0437\u0434\u0435\u0441\u044c, \u0447\u0442\u043e\u0431\u044b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0440\u0448\u0440\u0443\u0442, \u044f \u0438\u0433\u0440\u0430\u044e \u0441 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043d\u0430 \u043e\u0441\u0438 Y. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0442\u0440\u0443\u0431\u0430 \u0438\u0437\u0433\u0438\u0431\u0430\u0435\u0442\u0441\u044f \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043e\u0434\u043d\u043e\u0439 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438, \u0430 \u0432 \u0442\u0440\u0451\u0445 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f\u0445.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/611f97178ff4968fafa2a934\" data-style=\"\" id=\"611f97178ff4968fafa2a934\" width=\"\"><\/div>\n<p>\u0410 \u0437\u0434\u0435\u0441\u044c \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u043f\u044f\u0442\u044c \u0442\u0443\u043d\u043d\u0435\u043b\u0435\u0439 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u0440\u0430\u0434\u0438\u0443\u0441\u0430 \u0438 \u0446\u0432\u0435\u0442\u0430. \u041e\u043d\u0438 \u0442\u0430\u043a\u0436\u0435 \u0438\u043c\u0435\u044e\u0442 \u0440\u0430\u0437\u043d\u0443\u044e \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/611f97ba2077cda25f846b52\" data-style=\"\" id=\"611f97ba2077cda25f846b52\" width=\"\"><\/div>\n<p>\u041d\u0438\u0436\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0438 TubeGeometry() \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u0438\u0446\u044b.<\/p>\n<hr\/>\n<p><a href=\"https:\/\/codepen.io\/Mamboleoo\/post\/tunnel-animation-2\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/a> \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438.<\/p>\n<h2>7. \u0420\u0430\u0441\u0447\u0451\u0442 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0447\u0430\u0441\u0442\u0438\u0446<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u0436\u0435\u043b\u0430\u0435\u043c\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043a\u0440\u0443\u0433\u0438 \u0447\u0430\u0441\u0442\u0438\u0446, \u0432\u0441\u0435 \u0432\u0434\u043e\u043b\u044c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430. \u0422\u043e\u0442 \u0436\u0435 \u043f\u043e\u0434\u0445\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f Three.Js \u043f\u0440\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u0440\u0443\u0431\u044b, \u0441 \u0442\u043e\u0439 \u043b\u0438\u0448\u044c \u0440\u0430\u0437\u043d\u0438\u0446\u0435\u0439, \u0447\u0442\u043e \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438 \u0442\u0440\u0443\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0433\u0440\u0430\u043d\u0438. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0434\u0435\u0442\u0430\u043b\u044c \u0442\u0440\u0443\u0431\u044b \u0438 \u0435\u0451 \u0440\u0430\u0434\u0438\u0443\u0441. \u0414\u0435\u0442\u0430\u043b\u044c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0432\u0443\u043c\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438:<\/p>\n<pre><code class=\"javascript\">\/\/ The amount of circles that will form the tube var segments = 500; \/\/ The amount of particles that will shape each circle var circlesDetail = 10; \/\/ The radius of the tube var radius = 5;<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0431\u043e\u043b\u0435\u0435 \u0438\u043b\u0438 \u043c\u0435\u043d\u0435\u0435 \u0437\u043d\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0447\u0430\u0441\u0442\u0438\u0446 (segments * circlesDetail), \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0442\u0440\u0451\u0445\u0433\u0440\u0430\u043d\u043d\u0438\u043a\u0438 \u0424\u0440\u0435\u043d\u0435. \u042f \u043d\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0442 \u0432 \u044d\u0442\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438, \u043d\u043e, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u044e, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0442\u0440\u0451\u0445\u0433\u0440\u0430\u043d\u043d\u0438\u043a\u0438 \u0424\u0440\u0435\u043d\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430 \u0442\u0440\u0443\u0431\u044b. \u041a\u0430\u0436\u0434\u044b\u0439 \u0442\u0440\u0451\u0445\u0433\u0440\u0430\u043d\u043d\u0438\u043a \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043a\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439, \u043d\u043e\u0440\u043c\u0430\u043b\u0438 \u0438 \u0431\u0438\u043d\u043e\u0440\u043c\u0430\u043b\u0438. \u041f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u044d\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u043c\u0438, \u043a\u0443\u0434\u0430 \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u043a\u0430\u043c\u0435\u0440\u0430.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0440\u0430\u0441\u0447\u0451\u0442\u044b, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Frenet%E2%80%93Serret_formulas\">\u0441\u0442\u0430\u0442\u044c\u044e<\/a> \u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0438.<\/p>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f Three.Js \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u0442\u043e\u043c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u043e\u0434, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430:<\/p>\n<pre><code class=\"javascript\">var frames = path.computeFrenetFrames(segments, true); \/\/ True specify if the path is closed or not, in our case it must be<\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u2014 \u043d\u0430\u0431\u043e\u0440 \u0438\u0437 \u0442\u0440\u0451\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 Vector3():<\/p>\n<figure class=\"\"><figcaption>fig:<\/figcaption><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0438\u043c\u0435\u044f \u0432\u0441\u0451 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430, \u043c\u044b \u043d\u0430\u0447\u043d\u0451\u043c \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0432\u0434\u043e\u043b\u044c \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430. \u041c\u044b \u0445\u0440\u0430\u043d\u0438\u043c \u043a\u0430\u0436\u0434\u0443\u044e \u0442\u043e\u0447\u043a\u0443 \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u043a\u0430\u043a Vector3 \u0432 Grometry() \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0437\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u0447\u043a\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e:<\/p>\n<pre><code class=\"javascript\">\/\/ Create an empty Geometry where we will insert the particles var geometry = new THREE.Geometry();<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u044b \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0435. \u0412\u043e\u0442 \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u043c\u044b \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043b\u0438 \u0446\u0438\u043a\u043b\u043e\u043c \u043f\u043e \u0432\u0441\u0435\u043c \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u043c. \u042f \u043e\u0431\u044a\u044f\u0441\u043d\u044e, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0430 \u043a\u043e\u0434 \u043d\u0438\u0436\u0435, \u0434\u0435\u0442\u0430\u043b\u0438 \u0432\u044b \u043d\u0430\u0439\u0434\u0451\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445:<\/p>\n<pre><code class=\"javascript\">\/\/ Loop through all segments for (var i = 0; i &lt; segments; i++) {    \/\/ Get the normal values of the segment from the Frenet frames   var normal = frames.normals[i];   \/\/ Get the binormal values of the segment from the Frenet frames   var binormal = frames.binormals[i];    \/\/ Calculate the index of the segment (from 0 to 1)   var index = i \/ segments;    \/\/ Get the coordinates of the point in the center of the segment   \/\/ We already used the function in the first part to move the camera along the path   var p = path.getPointAt(index);    \/\/ Loop for the amount of particles we want along each circle   for (var j = 0; j &lt; circlesDetail; j++) {      \/\/ Clone the point in the center of the circle     var position = p.clone();      \/\/ We need to position every point based on an angle from 0 to Pi*2     \/\/ If you want only half a tube (like a water slide) you could calculate the angle from 0 to Pi.     var angle = (j \/ circlesDetail) * Math.PI * 2;      \/\/ Calculate the sine of the angle     var sin = Math.sin(angle);     \/\/ Calculate the negative cosine<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-418184","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/418184","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=418184"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/418184\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=418184"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=418184"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=418184"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}