{"id":412061,"date":"2024-06-29T22:19:43","date_gmt":"2024-06-29T22:19:43","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=412061"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=412061","title":{"rendered":"<span>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u0438\u043d\u0438-\u0438\u0433\u0440\u044b \u00ab\u0428\u043a\u0430\u0442\u0443\u043b\u043a\u0430\u00bb \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e JS + CSS<\/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<p>\u041f\u0440\u0438\u0432\u0435\u0442! <\/p>\n<p>\u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0421\u0435\u0440\u0433\u0435\u0439, \u044f \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043e\u0442\u0434\u0435\u043b\u0430 \u0441\u043f\u0435\u0446\u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 KTS. \u041d\u0430\u0448 \u043e\u0442\u0434\u0435\u043b \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043f\u0440\u043e\u043c\u043e\u043a\u0430\u043c\u043f\u0430\u043d\u0438\u0439. <\/p>\n<p>\u0413\u043e\u0434 \u043d\u0430\u0437\u0430\u0434 \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u0432\u0441\u0442\u0430\u043b\u0430 \u0437\u0430\u0434\u0430\u0447\u0430: \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0433\u0440\u0443-\u043a\u0432\u0435\u0441\u0442 \u0441 \u0434\u0438\u0430\u043b\u043e\u0433\u0430\u043c\u0438, 360-\u043f\u0430\u043d\u043e\u0440\u0430\u043c\u043e\u0439, drag-n-drop, \u0437\u0432\u0443\u043a\u0430\u043c\u0438 \u0438 \u043c\u0438\u043d\u0438-\u0438\u0433\u0440\u0430\u043c\u0438.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043f\u0440\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0447\u0430\u0441\u0442\u044c: \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043c\u0438\u043d\u0438-\u0438\u0433\u0440\u0443 \u0441\u043e \u0437\u0432\u0443\u043a\u0430\u043c\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/ru.reactjs.org\/\">react<\/a>, <a href=\"https:\/\/styled-components.com\/\">styled-components<\/a>, <a href=\"https:\/\/mobx.js.org\/README.html\">mobx<\/a> \u0438 <a href=\"https:\/\/howlerjs.com\/\">howler<\/a>.<\/p>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u043c \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c.<\/p>\n<p>\u0427\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435:<\/p>\n<ol>\n<li>\n<p><a href=\"#1\">\u041f\u0440\u0430\u0432\u0438\u043b\u0430<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#2\">\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0438\u0433\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435. 12 \u0448\u0430\u0433\u043e\u0432<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#3\">\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0431\u043b\u043e\u043a\u043e\u0432. 10 \u0448\u0430\u0433\u043e\u0432<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#4\">\u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f. 10 \u0448\u0430\u0433\u043e\u0432<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#5\">\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0437\u0432\u0443\u043a\u0438. 3 \u0448\u0430\u0433\u0430<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#6\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/a><\/p>\n<\/li>\n<\/ol>\n<p><a class=\"anchor\" name=\"1\" id=\"1\"><\/a><\/p>\n<h2>1 \u2014 \u041f\u0440\u0430\u0432\u0438\u043b\u0430<\/h2>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6151aaa8f61f533babdf2e7b\" data-style=\"\" id=\"6151aaa8f61f533babdf2e7b\" width=\"\"><\/div>\n<p>\u041c\u044b \u0438\u043c\u0435\u0435\u043c 12 \u0431\u043b\u043e\u043a\u043e\u0432, 3 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435. \u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0431\u043b\u043e\u043a\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432 \u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0438. <\/p>\n<p>\u0418\u0433\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 \u043f\u043e\u0434\u0435\u043b\u0435\u043d\u043e \u043d\u0430 3 \u043a\u0440\u0443\u0433\u0430 \u043f\u043e 6 \u0431\u043b\u043e\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u0447\u0430\u0441\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0435\u043b\u043a\u0435.<\/p>\n<p>\u0411\u043b\u043e\u043a\u0438 \u043d\u0430\u0440\u0438\u0441\u0443\u0435\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e\u0433\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0434\u043b\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043d\u0430\u0440\u0438\u0441\u0443\u0435\u043c \u043e\u0432\u0435\u0440\u043b\u0435\u0439. \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0431\u043b\u043e\u043a\u0438 \u043d\u0430 \u0432\u0440\u0435\u043c\u044f \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0441\u043a\u0440\u043e\u0435\u043c.<\/p>\n<p><a class=\"anchor\" name=\"2\" id=\"2\"><\/a><\/p>\n<h2>2 \u2014 \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0438\u0433\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435. 12 \u0448\u0430\u0433\u043e\u0432<\/h2>\n<p><strong>\u0428\u0430\u0433 1. <\/strong>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433 \u0438\u0433\u0440\u044b. \u041f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u043c \u0432\u0438\u0434\u044b \u0431\u043b\u043e\u043a\u043e\u0432 \u2014 \u043e\u0434\u0438\u043d \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0438 \u0442\u0440\u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445:<\/p>\n<pre><code class=\"javascript\">export enum BlocksEnum {   regular = \"regular\",   red = \"red\",   blue = \"blue\",   green = \"green\" }<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 2. <\/strong>\u041f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0431\u043b\u043e\u043a\u043e\u0432:<\/p>\n<pre><code class=\"javascript\">export const blocksImages: Record&lt;BlocksEnum, string> = {   [BlocksEnum.regular]: require(\".\/img\/block-regular.png\"),   [BlocksEnum.red]: require(\".\/img\/block-red.png\"),   [BlocksEnum.blue]: require(\".\/img\/block-blue.png\"),   [BlocksEnum.green]: require(\".\/img\/block-green.png\") };<\/code><\/pre>\n<p>\u0411\u043b\u043e\u043a\u0438 \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0433\u0434\u0435 <em>\u0438\u043d\u0434\u0435\u043a\u0441<\/em> \u2014 \u044d\u0442\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0431\u043b\u043e\u043a\u0430 \u043d\u0430 \u0438\u0433\u0440\u043e\u0432\u043e\u043c \u043f\u043e\u043b\u0435, \u0430 <em>\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/em> \u2014 \u0432\u0438\u0434 \u0431\u043b\u043e\u043a\u0430 \u0432 \u044d\u0442\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438, BlocksEnum:<\/p>\n<p><a class=\"anchor\" name=\"A\" id=\"A\"><\/a><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/353\/c3b\/65e\/353c3b65e4dad0f1f88c633e1a40c654.jpg\" width=\"1114\" height=\"782\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/353\/c3b\/65e\/353c3b65e4dad0f1f88c633e1a40c654.jpg\" data-blurred=\"true\"\/><\/figure>\n<p><strong>\u0428\u0430\u0433 4. <\/strong>\u041f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u043f\u043e\u0437\u0438\u0446\u0438\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0431\u043b\u043e\u043a\u0438:<\/p>\n<pre><code class=\"javascript\">export enum CorrectEnum {   red = \"1\",   green = \"7\",   blue = \"9\" }<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 5.<\/strong> \u0422\u0430\u043a\u0436\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u043c, \u043a\u0430\u043a\u0438\u0435 \u0432\u0438\u0434\u044b \u0431\u043b\u043e\u043a\u043e\u0432 \u0434\u043e\u043b\u0436\u043d\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0445:<\/p>\n<pre><code class=\"javascript\">export const correctIndexes: Record&lt;CorrectEnum,  BlocksEnum> = {   [CorrectEnum.red]:  BlocksEnum.red,   [CorrectEnum.green]:  BlocksEnum.green,   [CorrectEnum.blue]:  BlocksEnum.blue, };<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438 \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c CorrectEnum \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c \u0441 \u0442\u0435\u043a\u0443\u0449\u0438\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c \u0431\u043b\u043e\u043a\u043e\u0432. \u0414\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u0438 \u043b\u043e\u0433\u0438\u043a\u0438 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c MobX. \u041e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435, \u0438\u043b\u0438 \u0441\u0442\u043e\u0440, \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u043d\u0443\u0436\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435.<\/p>\n<p>\u0421\u0430\u043c\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u2014 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442. \u0412\u0441\u044f \u043c\u0430\u0433\u0438\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u043c\u0435\u0447\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043b\u0438\u044f\u044e\u0442 \u043d\u0430 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u043a\u0430\u043a \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c\u044b\u0435 (observable), \u0438 \u0434\u0435\u043b\u0430\u0435\u043c \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c\u044b\u043c \u0441\u0430\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 (observer).<\/p>\n<p>\u0422\u0430\u043a \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u0430\u0439\u0434-\u044d\u0444\u0444\u0435\u043a\u0442\u044b \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u043a\u0443 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/mobx.js.org\/observable-state.html\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p><strong>\u0428\u0430\u0433 6.<\/strong> \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0438\u0432\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"javascript\">import { makeObservable, observable, action } from \"mobx\";  export class BoxStore {   \/\/ \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 12 \u0432\u0438\u0434\u043e\u0432 \u0431\u043b\u043e\u043a\u043e\u0432 (9 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0438 3 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435)   blocks: BlocksEnum[] = [];   constructor() { makeObservable(this, {       blocks: observable,       isAnimation: observable,       rotationIndex: observable,       rotate: action.bound,       shuffle: action.bound,       setAnimation: action.bound,     });   this.shuffle();   } shuffle(): void {     this.blocks = [       ...new Array(9).fill(BlocksEnum.regular),       BlocksEnum.red,       BlocksEnum.blue,       BlocksEnum.green     ].sort(() => Math.random() - 0.5);     \/\/ \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0438\u0432\u0430\u0435\u043c \u0435\u0449\u0435 \u0440\u0430\u0437, \u0435\u0441\u043b\u0438 \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u0438\u043d \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0431\u043b\u043e\u043a \u0441\u0442\u043e\u0438\u0442 \u043d\u0430 \u043d\u0443\u0436\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435     if (this.isOneCorrect) {       this.shuffle();     }   } get isOneCorrect(): boolean {     return Object.keys(correctIndexes).some((index) =>       this.isCorrectIndex(index)     );   }  isCorrectIndex(index: number | string): boolean {     return correctIndexes[index] === this.blocks[index];   } }<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 7. <\/strong>\u0423 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0431\u043b\u043e\u043a\u0430 \u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0441 \u043e\u0432\u0435\u0440\u043b\u0435\u0435\u043c \u0434\u043b\u044f \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442, \u0447\u0442\u043e\u0431\u044b \u0438\u043c\u0435\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0443 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0438\u0437 \u044d\u0442\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432: <\/p>\n<pre><code class=\"javascript\">import { createContext } from 'react'; export const BoxGameContext = createContext&lt;BoxStore | null>(null); export const useStore = &lt;T>(context: React.Context&lt;T | null>): T => {   const data = useContext(context);   if (!data) {     throw new Error(\"Using store outside of context\");   }   return data; };<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 8. <\/strong>\u0414\u043b\u044f \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e\u0433\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0431\u043b\u043e\u043a\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043f\u0438\u0448\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0441 \u043d\u0438\u043c\u0438:<\/p>\n<pre><code class=\"javascript\">export type PositionType = [number, number]; export const blocksPositions: PositionType[] = [   [11.88, 22.93],   \/*\u2026*\/ ];<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 9. <\/strong>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 React-\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0441 \u0438\u0433\u0440\u043e\u0439. \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c \u043a \u043d\u0435\u043c\u0443 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435, \u043f\u0440\u043e\u0431\u0435\u0436\u0438\u043c\u0441\u044f \u043f\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0443 \u0441 \u043f\u043e\u0437\u0438\u0446\u0438\u044f\u043c\u0438 \u0438 \u043d\u0430\u0440\u0438\u0441\u0443\u0435\u043c \u0431\u043b\u043e\u043a\u0438:<\/p>\n<pre><code class=\"javascript\">import * as React from 'react'; import { observer } from 'mobx-react';  const Box: React.FC = () => { const [store] = React.useState(() => new BoxStore()); return ( \/* \u041e\u0431\u0435\u0440\u043d\u0435\u043c \u0438\u0433\u0440\u0443 \u0432 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430,      \u0442\u0430\u043a \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u0445 *\/ &lt;BoxGameContext.Provider value={store}> &lt;BoxWrapper> {blocksPositions.map((position, i) => ( &lt;Block type={store[i]} \/\/ \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0432\u0438\u0434 \u0431\u043b\u043e\u043a\u0430 \u0432 \u044d\u0442\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 position={position} index={i} key={i} \/> ))} &lt;\/BoxWrapper> &lt;\/BoxGameContext.Provider> ); };  \/\/ \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0435\u043d\u0434\u0435\u0440\u043e\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 MobX export default observer(Box);<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 10. <\/strong>\u0414\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0441\u0442\u0438\u043b\u0438\u0437\u0443\u0435\u043c BoxWrapper \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e styled-components.<\/p>\n<pre><code class=\"javascript\">import styled from 'styled-components';  export const BoxWrapper = styled.div`   background: url(${require(.\/img\/box.jpg).default}) no-repeat center \/ contain;   width: 69.7rem;   height: 49rem;   position: absolute;   margin: auto;   top: 0;   right: 0;   bottom: 0;   left: 0; `;<\/code><\/pre>\n<p>\u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 Block \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"javascript\">import { observer } from 'mobx-react';  export const generatePositionStyle = (position: PositionType) => ({   top: position[0] + \"rem\",   left: position[1] + \"rem\" });  const Block: React.FC&lt;Props> = ({ position, type, index }: BlockProps) => { const store = useStore(BoxGameContext); return ( &lt;BlockImg \/*  \u0410\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 inline style,  \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 css-\u043a\u043b\u0430\u0441\u0441\u043e\u0432  (\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u0443\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0438\u0434\u043e\u0432 \u0431\u043b\u043e\u043a\u043e\u0432)  *\/ style={generatePositionStyle(position)} type={type} \/> ); };  export default observer(Block);<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 11.<\/strong> \u0414\u043b\u044f \u0431\u043b\u043e\u043a\u0430 \u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0432\u0435\u0440\u043b\u0435\u044f \u0441 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435\u043c \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0440\u0430\u0434\u0438\u0443\u0441 \u0431\u043b\u043e\u043a\u0430. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0435\u0433\u043e \u0432 \u043a\u043e\u043d\u0444\u0438\u0433:<\/p>\n<pre><code class=\"javascript\">export const BLOCK_RADIUS = 3.6;<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 12. <\/strong>\u0421\u0442\u0438\u043b\u0438\u0437\u0443\u0435\u043c \u0431\u043b\u043e\u043a. \u0418\u0437 \u043a\u043e\u043d\u0444\u0438\u0433\u0430 \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u043f\u043e \u0432\u0438\u0434\u0443 \u0431\u043b\u043e\u043a\u0430 \u0438 \u0440\u0430\u0434\u0438\u0443\u0441:<\/p>\n<pre><code class=\"javascript\">export const generateCicleStyle = (radius: number) => ({   \"border-radius\": \"50%\",   width: radius * 2 + \"rem\",   height: radius * 2 + \"rem\" });  export const BlockImg = styled.div&lt;{ type: BlocksEnum; }>` position: absolute; ${generateCicleStyle(BLOCK_RADIUS)}; background: url(${(props) => blocksImages[props.type]}) no-repeat center \/ contain; `;<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/954\/4fc\/ffa\/9544fcffa2eb1eddef7b973257e6dd04.jpg\" width=\"1114\" height=\"782\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/954\/4fc\/ffa\/9544fcffa2eb1eddef7b973257e6dd04.jpg\" data-blurred=\"true\"\/><\/figure>\n<p>\u0423 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0432\u0438\u0434\u0430. \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0440\u0430\u0449\u0430\u0442\u044c!<\/p>\n<p><a class=\"anchor\" name=\"3\" id=\"3\"><\/a><\/p>\n<h2>3 \u2014 \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0431\u043b\u043e\u043a\u043e\u0432. 10 \u0448\u0430\u0433\u043e\u0432<\/h2>\n<p>\u041c\u044b \u0438\u043c\u0435\u0435\u043c \u0442\u0440\u0438 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u0430. \u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043d\u0438\u0445 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0435 6 \u0432\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u0447\u0430\u0441\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0435\u043b\u043a\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/681\/42f\/ad6\/68142fad69309d582990135397682578.jpg\" width=\"1114\" height=\"782\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/681\/42f\/ad6\/68142fad69309d582990135397682578.jpg\" data-blurred=\"true\"\/><\/figure>\n<p>\u0411\u043b\u043e\u043a\u0438 \u043c\u044b \u0445\u0440\u0430\u043d\u0438\u043c \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043f\u0438\u0448\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435. \u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u0431\u0435\u0440\u0435\u043c \u0438\u0437 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0432\u0438\u0434 \u0431\u043b\u043e\u043a\u0430 \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0438\u043d\u0434\u0435\u043a\u0441\u0443 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u043c\u0435\u043d\u044f\u0435\u043c \u0435\u0433\u043e \u0441 \u0432\u0438\u0434\u043e\u043c \u0431\u043b\u043e\u043a\u0430 \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c.<\/p>\n<p><strong>\u0428\u0430\u0433 1. <\/strong>\u041f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u043c <a href=\"#A\">\u0438\u043d\u0434\u0435\u043a\u0441\u044b <\/a>\u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u043e\u0432:<\/p>\n<pre><code class=\"javascript\">export enum RotationsEnum {   topLeft = \"4\",   topRight = \"5\",   bottom = \"8\" }<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 2. <\/strong>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043c\u0435\u0442\u043e\u0434 \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435:<\/p>\n<pre><code class=\"javascript\">\/\/ 3 \u043a\u0440\u0443\u0433\u0430 \u043f\u043e 6 \u0431\u043b\u043e\u043a\u043e\u0432 export const rotations: Record&lt;RotationsEnum, number[]> = {   [RotationsEnum.topLeft]: [0, 1, 5, 8, 7, 3],   [RotationsEnum.topRight]: [1, 2, 6, 9, 8, 4],   [RotationsEnum.bottom]: [4, 5, 9, 11, 10, 7] };<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 3. <\/strong>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043a \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"javascript\">rotate(clickIndex: number): void { if (!rotations[clickIndex]) { return; } const blocks = [...this.blocks]; \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043c\u0430\u0441\u0441\u043e\u0432 \u0432\u0438\u0434\u043e\u0432 \u0431\u043b\u043e\u043a\u043e\u0432 const rotationsMap = rotations[clickIndex]; \/\/ \u0431\u0435\u0440\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0439 \/\/ \u0438 \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u043c \u0435\u0433\u043e rotationsMap.forEach((rotationIndex: number, index: number) => { if (rotationsMap.length - 1 === index) { \/\/ \u043c\u0435\u043d\u044f\u0435\u043c \u0432\u0438\u0434\u044b \u0431\u043b\u043e\u043a\u043e\u0432 \u043f\u043e \u043d\u0443\u043b\u0435\u0432\u043e\u043c\u0443 \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c\u0443 \u0438\u043d\u0434\u0435\u043a\u0441\u0443 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f this.blocks[rotationsMap[0]] = blocks[rotationsMap[rotationsMap.length - 1]]; } else { \/\/ \u043c\u0435\u043d\u044f\u0435\u043c \u0432\u0438\u0434\u044b \u0431\u043b\u043e\u043a\u043e\u0432 \u043f\u043e \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f this.blocks[rotationsMap[index + 1]] = blocks[rotationIndex]; } }); }<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 4. <\/strong>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u044d\u0442\u043e\u0442 \u0431\u043b\u043e\u043a \u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u043c, \u0438 \u0432\u0435\u0448\u0430\u0435\u043c store.rotate \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u0431\u043b\u043e\u043a\u0430:<\/p>\n<pre><code class=\"javascript\">const isRotation = rotations[index]; \/*\u2026*\/ &lt;BlockImg \/*\u2026*\/ onClick={isRotation  ?  ()  => store.rotate(index) : undefined} \/><\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 5. <\/strong>\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u0433\u0435\u0442\u0442\u0435\u0440 \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432, \u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0433\u043e\u0442\u043e\u0432\u0430:<\/p>\n<pre><code class=\"javascript\">get isCorrect(): boolean { return Object.keys(correctIndexes).every((block) => this.isCorrectIndex(block) ); }<\/code><\/pre>\n<p><a class=\"anchor\" name=\"4\" id=\"4\"><\/a><\/p>\n<h2>4 \u2014 \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f. 10 \u0448\u0430\u0433\u043e\u0432<\/h2>\n<p><strong>\u0428\u0430\u0433 1. <\/strong>\u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0435 \u0431\u043b\u043e\u043a\u0438 \u0438 \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0435. \u0412 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043c\u0435\u0442\u043e\u0434, \u043c\u0435\u043d\u044f\u044e\u0449\u0438\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0431\u043b\u043e\u043a\u0430: <\/p>\n<pre><code class=\"javascript\">isAnimation = false; rotationIndex: number | null = null; setAnimation(value: boolean, index?: number): void { this.isAnimation = value; this.rotationIndex = index || null; }<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 2. <\/strong>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043a\u043e\u043d\u0444\u0438\u0433 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"javascript\">export const ANIMATION_TIME = 500;<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 3. <\/strong>\u0414\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043a\u043b\u0438\u043a\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 &lt;Block \/>:<\/p>\n<pre><code class=\"javascript\">const handleRotation = () => { if (store.isAnimation) { return; } store.setAnimation(true, index); setTimeout(() => { store.rotate(index); store.setAnimation(false); }); }<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 4. <\/strong>\u041f\u043e\u0440\u044f\u0434\u043e\u043a \u0431\u043b\u043e\u043a\u043e\u0432 \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438. \u041d\u0430 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043c\u044b \u0441\u043a\u0440\u043e\u0435\u043c \u0431\u043b\u043e\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u044e\u0442 \u0432 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438, \u0438 \u043d\u0430\u0440\u0438\u0441\u0443\u0435\u043c \u043f\u043e\u0432\u0435\u0440\u0445 \u043d\u043e\u0432\u044b\u0435. \u0412 Block.tsx \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443:<\/p>\n<pre><code class=\"javascript\">const isHide = () => { if (!store.rotationIndex) { return false; } const rotationIndexes = rotations[store.rotationIndex]; return Object.keys(rotationIndexes) .some((key) => rotationIndexes[key] === index); };<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 5. <\/strong>\u041e\u0431\u043d\u043e\u0432\u0438\u043c \u0441\u0442\u0438\u043b\u044c \u0431\u043b\u043e\u043a\u0430:<\/p>\n<pre><code class=\"javascript\">export const BlockImg = styled.div&lt;{ \/*\u2026*\/ isHide?: boolean; }>` \/*\u2026*\/ display: ${(props) => (props.isHide ? 'none' : 'block')}; `;<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 6. <\/strong>\u041f\u043e\u043b\u043e\u0436\u0438\u043c \u0432\u043d\u0443\u0442\u0440\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442-\u043e\u0432\u0435\u0440\u043b\u0435\u0439 \u0434\u043b\u044f \u0445\u043e\u0432\u0435\u0440\u0430 \u0438 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"javascript\">const withRotaionCircle =  isRotation &amp;&amp; (!store.rotationIndex || store.rotationIndex === index); &lt;BlockImg \/*\u2026*\/ onClick={isRotation &amp;&amp; !store.isCorrect ? handleRotation : undefined} isHide={isHide()} withRotaionCircle={withRotaionCircle} > {withRotaionCircle &amp;&amp; ( &lt;RotationCircle position={position} type={type} overlayIndex={index} \/> )} &lt;\/BlockImg><\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 7. <\/strong>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043a\u043e\u043d\u0444\u0438\u0433 \u0443\u0433\u043e\u043b \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430, \u0440\u0430\u0434\u0438\u0443\u0441 \u043e\u0432\u0435\u0440\u043b\u0435\u044f \u0438 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0432\u0435\u0440\u043b\u0435\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0431\u043b\u043e\u043a\u0430:<\/p>\n<pre><code class=\"javascript\">export const ROTATION_ANGLE = 360 \/ 6; \/\/ 6 \u0431\u043b\u043e\u043a\u043e\u0432 \u0432 \u043a\u0440\u0443\u0433\u0435 export const ROTATION_CIRCLE_RADIUS = 12.7; \/\/ \u0440\u0430\u0434\u0438\u0443\u0441 \u043e\u0432\u0435\u0440\u043b\u0435\u044f \u0441 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0435\u0439<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/b65\/a2e\/48f\/b65a2e48f302b3269b3ace84b259b355.jpg\" width=\"1782\" height=\"710\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b65\/a2e\/48f\/b65a2e48f302b3269b3ace84b259b355.jpg\" data-blurred=\"true\"\/><\/figure>\n<p><strong>\u0428\u0430\u0433 8.<\/strong> \u041e\u0432\u0435\u0440\u043b\u0435\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u0431\u043b\u043e\u043a\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u043d \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u043e \u0432\u0435\u0440\u0445\u043d\u0435\u043c\u0443 \u043b\u0435\u0432\u043e\u043c\u0443 \u043a\u0440\u0430\u044e \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430. \u0427\u0442\u043e\u0431\u044b \u0432\u044b\u0440\u043e\u0432\u043d\u044f\u0442\u044c \u043e\u0432\u0435\u0440\u043b\u0435\u0439 \u043f\u043e \u0446\u0435\u043d\u0442\u0440\u0443 \u0441 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u043c \u0431\u043b\u043e\u043a\u043e\u043c, \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u043e\u0432\u0438\u043d \u0438\u0445 \u0448\u0438\u0440\u0438\u043d \u0438 \u0441\u0434\u0432\u0438\u043d\u0443\u0442\u044c \u043e\u0432\u0435\u0440\u043b\u0435\u0439 \u0432\u0432\u0435\u0440\u0445 \u0438 \u0432\u043b\u0435\u0432\u043e \u043d\u0430 \u044d\u0442\u0443 \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c. \u0423 \u043d\u0430\u0441 \u043a\u0430\u043a \u0440\u0430\u0437 \u0435\u0441\u0442\u044c \u0440\u0430\u0434\u0438\u0443\u0441\u044b:<\/p>\n<pre><code class=\"javascript\">export const ROTATION_CIRCLE_SHIFT = ROTATION_CIRCLE_RADIUS - BLOCK_RADIUS;<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 9. <\/strong>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 RotationCircle:<\/p>\n<pre><code class=\"javascript\">const RotationCircle: React.FC&lt;Props> = ({ position, type, index }: BlockProps) => { const store = React.useContext(BoxGameContext); const getPosition = (inCirclePosition: PositionType): PositionType => { return [ inCirclePosition[0] - position[0] + ROTATION_CIRCLE_SHIFT, inCirclePosition[1] - position[1] + ROTATION_CIRCLE_SHIFT,     ]; }; const rotate = store.isAnimation &amp;&amp; store.rotationIndex === index; return ( \/*  \u0420\u0438\u0441\u0443\u0435\u043c \u043e\u0432\u0435\u0440\u043b\u0435\u0439 \u0434\u043b\u044f \u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u0431\u043b\u043e\u043a\u043e\u0432 \u0422\u0430\u043a \u043a\u0430\u043a \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0431\u043b\u043e\u043a\u0438 \u043d\u0430 \u0432\u0440\u0435\u043c\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u0441\u043a\u0440\u044b\u0442\u044b, \u0431\u0443\u0434\u0435\u043c \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0431\u043b\u043e\u043a\u0438 \u0434\u043b\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u043e\u0432\u0435\u0440\u043b\u0435\u044f *\/ &lt;RotationCircleWrapper $rotate={store.isAnimation &amp;&amp; store.rotationIndex === index} isCorrect={store.isCorrect} > {Object.keys(rotations[index]).map((rotationBlockIndex, i) => { \/\/ \u041f\u0440\u043e\u0445\u043e\u0434\u0438\u043c\u0441\u044f \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0439 - \u0440\u0438\u0441\u0443\u0435\u043c \u0431\u043b\u043e\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f const block = rotations[index][rotationBlockIndex]; const blockPosition = getPosition(blocksPositions[block]); return ( &lt;BlockImg position={blockPosition} type={store.blocks[block]} key={i} $rotate={isRotate} \/> ); })} {\/* \u0420\u0438\u0441\u0443\u0435\u043c \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0439 \u0431\u043b\u043e\u043a *\/} &lt;BlockImg position={getPosition(position)} type={type} isRotation $rotate={rotate} \/> &lt;\/RotationCircleWrapper> ); };  export default observer(RotationCircle);<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 10. <\/strong>\u0421\u0442\u0438\u043b\u0438\u0437\u0443\u0435\u043c \u043e\u0432\u0435\u0440\u043b\u0435\u0439 RotationCircleWrapper:<\/p>\n<pre><code class=\"javascript\">import styled, { css } from 'styled-components';  export const RotationCircleWrapper = styled.div&lt;{   $rotate: boolean;   isCorrect: boolean; }>`   position: absolute;   z-index: 1;   opacity: 0;   transform: rotate(0);   will-change: transform, opacity;   background: url(${require('.\/img\/rotation-circle.svg').default}) no-repeat     center \/ contain;   ${generateCicleStyle(ROTATION_CIRCLE_RADIUS)}   left: -${ROTATION_CIRCLE_SHIFT}rem;   top: -${ROTATION_CIRCLE_SHIFT}rem;    \/*      \u041e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0434\u043b\u044f \u043e\u0432\u0435\u0440\u043b\u0435\u044f, \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043a\u043b\u0438\u043a\u0430\u0442\u044c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0431\u043b\u043e\u043a    *\/   pointer-events: none;    \/* \u041f\u0435\u0440\u0435\u0445\u043e\u0434 \u0434\u043b\u044f \u0445\u043e\u0432\u0435\u0440\u0430 *\/   transition: opacity 0.2s linear;    \/* \u0410\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u043c mixin \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f *\/   ${(props) => props.$rotate &amp;&amp; rotationCircleMixin};    \/* \u0421\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043e\u0432\u0435\u0440\u043b\u0435\u0439, \u043a\u043e\u0433\u0434\u0430 \u0433\u043e\u043b\u043e\u0432\u043e\u043b\u043e\u043c\u043a\u0430 \u0440\u0435\u0448\u0435\u043d\u0430 *\/   display: ${(props) => (props.isCorrect ? 'none' : 'block')}; `;  const rotationCircleMixin = css`   transition: transform ${ANIMATION_TIME}ms linear;   transform: rotate(${ROTATION_ANGLE}deg);   opacity: 1; `;<\/code><\/pre>\n<p>\u0412\u043d\u0435\u0448\u043d\u0438\u0439 \u0432\u0438\u0434 \u0433\u043e\u0442\u043e\u0432:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6151b0266ea11f3bbbaf1f6d\" data-style=\"\" id=\"6151b0266ea11f3bbbaf1f6d\" width=\"\"><\/div>\n<p><a class=\"anchor\" name=\"5\" id=\"5\"><\/a><\/p>\n<h2>5 \u2014 \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0437\u0432\u0443\u043a\u0438. 3 \u0448\u0430\u0433\u0430<\/h2>\n<p>\u041d\u043e \u043a\u0430\u043a\u0430\u044f \u0438\u0433\u0440\u0430 \u0431\u0435\u0437 \u0437\u0432\u0443\u043a\u043e\u0432? \u041e\u043d\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0434\u0430\u0436\u0435 \u0432 \u043c\u0438\u043d\u0438-\u0438\u0433\u0440\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0430\u0443\u0434\u0438\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440.<\/p>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0430\u0443\u0434\u0438\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/howlerjs.com\/\">Howler<\/a>. \u042d\u0442\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0430\u0443\u0434\u0438\u043e\u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u044b \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043e\u0432, \u0438\u043c\u0435\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c \u0438 \u0434\u0435\u043b\u0430\u0435\u0442 \u0437\u0430 \u043d\u0430\u0441 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<p><strong>\u0428\u0430\u0433 1. <\/strong>\u041f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u043c \u043d\u0430\u0448\u0438 \u0437\u0432\u0443\u043a\u0438:<\/p>\n<pre><code class=\"javascript\">export enum AudioEnum {     boxRotate,     boxOpened, }  export const AUDIOS: Record&lt;AudioEnum, HowlOptions> = {   [AudioEnum.boxRotate]: {     src: require('.\/sounds\/box-rotate.mp3').default,   },   [AudioEnum.boxOpened]: {     src: require('.\/sounds\/box-opened.mp3').default,   }, }<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 2.<\/strong> \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043f\u0440\u0435\u0434\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">export class AudioController {   audios: Partial&lt;Record&lt;AudioEnum, Howl>> = {};  \/\/ \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u043a\u043b\u044e\u0447\u0435\u0439 \u043d\u0443\u0436\u043d\u044b\u0445 \u0437\u0432\u0443\u043a\u043e\u0432   async preload(audios: AudioEnum[]): Promise&lt;unknown> {     const loadAudio = (key: AudioEnum) =>       new Promise&lt;void>((res) => {         this.addAudio(key);         const onLoad = () => res();         this.audios[key]?.on(\"load\", onLoad);         this.audios[key]?.on(\"loaderror\", onLoad);         this.audios[key]?.load();       });     return Promise.all(audios.map(loadAudio));   }    addAudio(key: AudioEnum, audio?: HowlOptions): void {     if (!(key in this.audios)) {       this.audios[key] = new Howl(audio || AUDIOS[key]);     }   }    play = (key: AudioEnum): Howl | null => {     if (!(key in this.audios)) {       this.addAudio(key);     }     const audio = this.audios[key];     if (audio) {       audio.play();       return audio;     }     return null;   }; }<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 3. <\/strong>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0432 \u043d\u0430\u0448\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435:<\/p>\n<pre><code class=\"javascript\">export class BoxStore {   \/*...*\/   audioController = new AudioController();   \/*...*\/ }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u044b \u0434\u043b\u044f \u0430\u0443\u0434\u0438\u043e \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 &lt;Box \/>. <\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u044d\u0444\u0444\u0435\u043a\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 \u043f\u0440\u0435\u0434\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0437\u0432\u0443\u043a\u043e\u0432 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430, \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u0442 \u0437\u0432\u0443\u043a \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u0448\u043a\u0430\u0442\u0443\u043b\u043a\u0438 \u043f\u0440\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0438:<\/p>\n<pre><code class=\"javascript\">React.useEffect(() => {   store.audioController.preload([     AudioEnum.boxOpened,     AudioEnum.boxRotate,   ]); }, []);  React.useEffect(() => { if (store.isCorrect) { store.audioController.play(AudioEnum.boxOpened); } }, [store.isCorrect]);<\/code><\/pre>\n<p>\u041f\u043e \u043a\u043b\u0438\u043a\u0443 \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 &lt;Block \/> \u0431\u0443\u0434\u0435\u043c \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0437\u0432\u0443\u043a \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"javascript\">const handleRotation = () => {     \/*...*\/     store.audioController.play(AudioEnum.boxRotate);     \/*...*\/ }<\/code><\/pre>\n<p><a class=\"anchor\" name=\"6\" id=\"6\"><\/a><\/p>\n<h2>6 \u2014 \u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 &lt;Box \/> \u043e \u0440\u0435\u0448\u0435\u043d\u043d\u043e\u0439 \u0433\u043e\u043b\u043e\u0432\u043e\u043b\u043e\u043c\u043a\u0435:<\/p>\n<pre><code class=\"javascript\">  &lt;BoxWrapper>     \/*...*\/     {store.isCorrect &amp;&amp; &lt;Success>Try not. Do, or do not. There is no try.&lt;\/Success>}     \/*...*\/   &lt;\/BoxWrapper><\/code><\/pre>\n<pre><code class=\"javascript\">export const Success = styled.div`   position: absolute;   width: 100%;   text-align: center;   top: 1rem;   font-size: 3rem;   background: green;   color: white; `;<\/code><\/pre>\n<p>\u0428\u043a\u0430\u0442\u0443\u043b\u043a\u0430 \u0433\u043e\u0442\u043e\u0432\u0430:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/2cc\/017\/62a\/2cc01762a85a925ba798ceb93e8610a7.jpg\" width=\"1111\" height=\"780\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2cc\/017\/62a\/2cc01762a85a925ba798ceb93e8610a7.jpg\" data-blurred=\"true\"\/><\/figure>\n<p>\u0413\u043e\u0442\u043e\u0432\u044b\u0439 \u043a\u043e\u0434 \u043b\u0435\u0436\u0438\u0442 <a href=\"https:\/\/codesandbox.io\/s\/fervent-mestorf-byo4h\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>\u041f\u043e\u0438\u0433\u0440\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/byo4h.csb.app\/\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u044b\u043b\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439 \u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439. \u0411\u0443\u0434\u0443 \u0440\u0430\u0434 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u043c \u0438 \u0441\u043e\u0432\u0435\u0442\u0430\u043c \u043f\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p>\u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0437 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0430\u043d\u043e\u0440\u0430\u043c\u0443 \u043d\u0430 Three.js \u0441 \u043a\u0443\u0447\u0435\u0439 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u0437\u0432\u0443\u043a\u043e\u0432 \u0438 \u0442\u0435\u043a\u0441\u0442\u0430 \u0438 \u043d\u0435 \u043f\u043e\u0442\u0435\u0440\u044f\u0442\u044c\u0441\u044f.<\/p>\n<p>\u0414\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0438!<\/p>\n<hr\/>\n<p><strong>\u0414\u0440\u0443\u0433\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0440\u043e frontend \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445:<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/companies\/kts\/articles\/775948\/\">\u0420\u043e\u0430\u0434\u043c\u044d\u043f \u043f\u043e \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c\u0443 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0443 <\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/company\/kts\/blog\/576682\/\">\u041a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 \u043d\u0430 React.js<\/a><\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u044b:\u00a0<a href=\"https:\/\/habr.com\/ru\/company\/kts\/blog\/669784\/\">\u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044f \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/a>,\u00a0<a href=\"https:\/\/habr.com\/ru\/company\/kts\/blog\/678034\/\">\u043f\u0430\u0440\u0441\u0438\u043d\u0433 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 JS<\/a>,\u00a0<a href=\"https:\/\/habr.com\/ru\/company\/kts\/blog\/683240\/\">\u0434\u0435\u0440\u0435\u0432\u044c\u044f \u0441\u043f\u0435\u0446 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0438 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>\u0414\u0440\u0443\u0433\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0440\u043e frontend \u0434\u043b\u044f \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0445:<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/company\/kts\/blog\/569448\/\">\u041a\u0430\u043a \u043c\u044b \u0432\u044b\u0431\u0438\u0440\u0430\u043b\u0438 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 \u043c\u0438\u043a\u0440\u043e\u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u043e\u0432 \u0432 \u041b\u041a \u0434\u043b\u044f 260 000 \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u043e\u0432 \u041f\u044f\u0442\u0451\u0440\u043e\u0447\u043a\u0438<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/company\/kts\/blog\/560058\/\">\u041a\u0430\u043a \u043c\u044b \u0441\u0435\u0442\u0430\u043f\u0438\u043b\u0438 \u043c\u043e\u043d\u043e\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 SSR \u0438 SPA \u0434\u043b\u044f Otus.ru<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/company\/kts\/blog\/566176\/\">\u041a\u0430\u043a \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0434\u043b\u044f SSR \u043d\u0430 React<\/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\/580198\/\"> https:\/\/habr.com\/ru\/articles\/580198\/<\/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<p>\u041f\u0440\u0438\u0432\u0435\u0442! <\/p>\n<p>\u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0421\u0435\u0440\u0433\u0435\u0439, \u044f \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043e\u0442\u0434\u0435\u043b\u0430 \u0441\u043f\u0435\u0446\u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 KTS. \u041d\u0430\u0448 \u043e\u0442\u0434\u0435\u043b \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043f\u0440\u043e\u043c\u043e\u043a\u0430\u043c\u043f\u0430\u043d\u0438\u0439. <\/p>\n<p>\u0413\u043e\u0434 \u043d\u0430\u0437\u0430\u0434 \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u0432\u0441\u0442\u0430\u043b\u0430 \u0437\u0430\u0434\u0430\u0447\u0430: \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0433\u0440\u0443-\u043a\u0432\u0435\u0441\u0442 \u0441 \u0434\u0438\u0430\u043b\u043e\u0433\u0430\u043c\u0438, 360-\u043f\u0430\u043d\u043e\u0440\u0430\u043c\u043e\u0439, drag-n-drop, \u0437\u0432\u0443\u043a\u0430\u043c\u0438 \u0438 \u043c\u0438\u043d\u0438-\u0438\u0433\u0440\u0430\u043c\u0438.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043f\u0440\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0447\u0430\u0441\u0442\u044c: \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043c\u0438\u043d\u0438-\u0438\u0433\u0440\u0443 \u0441\u043e \u0437\u0432\u0443\u043a\u0430\u043c\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/ru.reactjs.org\/\">react<\/a>, <a href=\"https:\/\/styled-components.com\/\">styled-components<\/a>, <a href=\"https:\/\/mobx.js.org\/README.html\">mobx<\/a> \u0438 <a href=\"https:\/\/howlerjs.com\/\">howler<\/a>.<\/p>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u043c \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c.<\/p>\n<p>\u0427\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435:<\/p>\n<ol>\n<li>\n<p><a href=\"#1\">\u041f\u0440\u0430\u0432\u0438\u043b\u0430<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#2\">\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0438\u0433\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435. 12 \u0448\u0430\u0433\u043e\u0432<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#3\">\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0431\u043b\u043e\u043a\u043e\u0432. 10 \u0448\u0430\u0433\u043e\u0432<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#4\">\u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f. 10 \u0448\u0430\u0433\u043e\u0432<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#5\">\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0437\u0432\u0443\u043a\u0438. 3 \u0448\u0430\u0433\u0430<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#6\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/a><\/p>\n<\/li>\n<\/ol>\n<p><a class=\"anchor\" name=\"1\" id=\"1\"><\/a><\/p>\n<h2>1 \u2014 \u041f\u0440\u0430\u0432\u0438\u043b\u0430<\/h2>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6151aaa8f61f533babdf2e7b\" data-style=\"\" id=\"6151aaa8f61f533babdf2e7b\" width=\"\"><\/div>\n<p>\u041c\u044b \u0438\u043c\u0435\u0435\u043c 12 \u0431\u043b\u043e\u043a\u043e\u0432, 3 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435. \u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0431\u043b\u043e\u043a\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432 \u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0438. <\/p>\n<p>\u0418\u0433\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 \u043f\u043e\u0434\u0435\u043b\u0435\u043d\u043e \u043d\u0430 3 \u043a\u0440\u0443\u0433\u0430 \u043f\u043e 6 \u0431\u043b\u043e\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u0447\u0430\u0441\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0435\u043b\u043a\u0435.<\/p>\n<p>\u0411\u043b\u043e\u043a\u0438 \u043d\u0430\u0440\u0438\u0441\u0443\u0435\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e\u0433\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0434\u043b\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043d\u0430\u0440\u0438\u0441\u0443\u0435\u043c \u043e\u0432\u0435\u0440\u043b\u0435\u0439. \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0431\u043b\u043e\u043a\u0438 \u043d\u0430 \u0432\u0440\u0435\u043c\u044f \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0441\u043a\u0440\u043e\u0435\u043c.<\/p>\n<p><a class=\"anchor\" name=\"2\" id=\"2\"><\/a><\/p>\n<h2>2 \u2014 \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0438\u0433\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435. 12 \u0448\u0430\u0433\u043e\u0432<\/h2>\n<p><strong>\u0428\u0430\u0433 1. <\/strong>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433 \u0438\u0433\u0440\u044b. \u041f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u043c \u0432\u0438\u0434\u044b \u0431\u043b\u043e\u043a\u043e\u0432 \u2014 \u043e\u0434\u0438\u043d \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0438 \u0442\u0440\u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445:<\/p>\n<pre><code class=\"javascript\">export enum BlocksEnum {   regular = \"regular\",   red = \"red\",   blue = \"blue\",   green = \"green\" }<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 2. <\/strong>\u041f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0431\u043b\u043e\u043a\u043e\u0432:<\/p>\n<pre><code class=\"javascript\">export const blocksImages: Record&lt;BlocksEnum, string> = {   [BlocksEnum.regular]: require(\".\/img\/block-regular.png\"),   [BlocksEnum.red]: require(\".\/img\/block-red.png\"),   [BlocksEnum.blue]: require(\".\/img\/block-blue.png\"),   [BlocksEnum.green]: require(\".\/img\/block-green.png\") };<\/code><\/pre>\n<p>\u0411\u043b\u043e\u043a\u0438 \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0433\u0434\u0435 <em>\u0438\u043d\u0434\u0435\u043a\u0441<\/em> \u2014 \u044d\u0442\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0431\u043b\u043e\u043a\u0430 \u043d\u0430 \u0438\u0433\u0440\u043e\u0432\u043e\u043c \u043f\u043e\u043b\u0435, \u0430 <em>\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/em> \u2014 \u0432\u0438\u0434 \u0431\u043b\u043e\u043a\u0430 \u0432 \u044d\u0442\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438, BlocksEnum:<\/p>\n<p><a class=\"anchor\" name=\"A\" id=\"A\"><\/a><\/p>\n<figure class=\"full-width\"><\/figure>\n<p><strong>\u0428\u0430\u0433 4. <\/strong>\u041f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u043f\u043e\u0437\u0438\u0446\u0438\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0431\u043b\u043e\u043a\u0438:<\/p>\n<pre><code class=\"javascript\">export enum CorrectEnum {   red = \"1\",   green = \"7\",   blue = \"9\" }<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 5.<\/strong> \u0422\u0430\u043a\u0436\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u043c, \u043a\u0430\u043a\u0438\u0435 \u0432\u0438\u0434\u044b \u0431\u043b\u043e\u043a\u043e\u0432 \u0434\u043e\u043b\u0436\u043d\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0445:<\/p>\n<pre><code class=\"javascript\">export const correctIndexes: Record&lt;CorrectEnum,  BlocksEnum> = {   [CorrectEnum.red]:  BlocksEnum.red,   [CorrectEnum.green]:  BlocksEnum.green,   [CorrectEnum.blue]:  BlocksEnum.blue, };<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438 \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c CorrectEnum \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c \u0441 \u0442\u0435\u043a\u0443\u0449\u0438\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c \u0431\u043b\u043e\u043a\u043e\u0432. \u0414\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u0438 \u043b\u043e\u0433\u0438\u043a\u0438 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c MobX. \u041e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435, \u0438\u043b\u0438 \u0441\u0442\u043e\u0440, \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u043d\u0443\u0436\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435.<\/p>\n<p>\u0421\u0430\u043c\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u2014 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442. \u0412\u0441\u044f \u043c\u0430\u0433\u0438\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u043c\u0435\u0447\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043b\u0438\u044f\u044e\u0442 \u043d\u0430 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u043a\u0430\u043a \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c\u044b\u0435 (observable), \u0438 \u0434\u0435\u043b\u0430\u0435\u043c \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c\u044b\u043c \u0441\u0430\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 (observer).<\/p>\n<p>\u0422\u0430\u043a \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u0430\u0439\u0434-\u044d\u0444\u0444\u0435\u043a\u0442\u044b \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u043a\u0443 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/mobx.js.org\/observable-state.html\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p><strong>\u0428\u0430\u0433 6.<\/strong> \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0438\u0432\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"javascript\">import { makeObservable, observable, action } from \"mobx\";  export class BoxStore {   \/\/ \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 12 \u0432\u0438\u0434\u043e\u0432 \u0431\u043b\u043e\u043a\u043e\u0432 (9 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0438 3 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435)   blocks: BlocksEnum[] = [];   constructor() { makeObservable(this, {       blocks: observable,       isAnimation: observable,       rotationIndex: observable,       rotate: action.bound,       shuffle: action.bound,       setAnimation: action.bound,     });   this.shuffle();   } shuffle(): void {     this.blocks = [       ...new Array(9).fill(BlocksEnum.regular),       BlocksEnum.red,       BlocksEnum.blue,       BlocksEnum.green     ].sort(() => Math.random() - 0.5);     \/\/ \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0438\u0432\u0430\u0435\u043c \u0435\u0449\u0435 \u0440\u0430\u0437, \u0435\u0441\u043b\u0438 \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u0438\u043d \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0431\u043b\u043e\u043a \u0441\u0442\u043e\u0438\u0442 \u043d\u0430 \u043d\u0443\u0436\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435     if (this.isOneCorrect) {       this.shuffle();     }   } get isOneCorrect(): boolean {     return Object.keys(correctIndexes).some((index) =>       this.isCorrectIndex(index)     );   }  isCorrectIndex(index: number | string): boolean {     return correctIndexes[index] === this.blocks[index];   } }<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 7. <\/strong>\u0423 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0431\u043b\u043e\u043a\u0430 \u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0441 \u043e\u0432\u0435\u0440\u043b\u0435\u0435\u043c \u0434\u043b\u044f \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442, \u0447\u0442\u043e\u0431\u044b \u0438\u043c\u0435\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0443 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0438\u0437 \u044d\u0442\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432: <\/p>\n<pre><code class=\"javascript\">import { createContext } from 'react'; export const BoxGameContext = createContext&lt;BoxStore | null>(null); export const useStore = &lt;T>(context: React.Context&lt;T | null>): T => {   const data = useContext(context);   if (!data) {     throw new Error(\"Using store outside of context\");   }   return data; };<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 8. <\/strong>\u0414\u043b\u044f \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e\u0433\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0431\u043b\u043e\u043a\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043f\u0438\u0448\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0441 \u043d\u0438\u043c\u0438:<\/p>\n<pre><code class=\"javascript\">export type PositionType = [number, number]; export const blocksPositions: PositionType[] = [   [11.88, 22.93],   \/*\u2026*\/ ];<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 9. <\/strong>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 React-\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0441 \u0438\u0433\u0440\u043e\u0439. \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c \u043a \u043d\u0435\u043c\u0443 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435, \u043f\u0440\u043e\u0431\u0435\u0436\u0438\u043c\u0441\u044f \u043f\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0443 \u0441 \u043f\u043e\u0437\u0438\u0446\u0438\u044f\u043c\u0438 \u0438 \u043d\u0430\u0440\u0438\u0441\u0443\u0435\u043c \u0431\u043b\u043e\u043a\u0438:<\/p>\n<pre><code class=\"javascript\">import * as React from 'react'; import { observer } from 'mobx-react';  const Box: React.FC = () => { const [store] = React.useState(() => new BoxStore()); return ( \/* \u041e\u0431\u0435\u0440\u043d\u0435\u043c \u0438\u0433\u0440\u0443 \u0432 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430,      \u0442\u0430\u043a \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u0445 *\/ &lt;BoxGameContext.Provider value={store}> &lt;BoxWrapper> {blocksPositions.map((position, i) => ( &lt;Block type={store[i]} \/\/ \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0432\u0438\u0434 \u0431\u043b\u043e\u043a\u0430 \u0432 \u044d\u0442\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 position={position} index={i} key={i} \/> ))} &lt;\/BoxWrapper> &lt;\/BoxGameContext.Provider> ); };  \/\/ \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0435\u043d\u0434\u0435\u0440\u043e\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 MobX export default observer(Box);<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 10. <\/strong>\u0414\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0441\u0442\u0438\u043b\u0438\u0437\u0443\u0435\u043c BoxWrapper \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e styled-components.<\/p>\n<pre><code class=\"javascript\">import styled from 'styled-components';  export const BoxWrapper = styled.div`   background: url(${require(.\/img\/box.jpg).default}) no-repeat center \/ contain;   width: 69.7rem;   height: 49rem;   position: absolute;   margin: auto;   top: 0;   right: 0;   bottom: 0;   left: 0; `;<\/code><\/pre>\n<p>\u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 Block \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"javascript\">import { observer } from 'mobx-react';  export const generatePositionStyle = (position: PositionType) => ({   top: position[0] + \"rem\",   left: position[1] + \"rem\" });  const Block: React.FC&lt;Props> = ({ position, type, index }: BlockProps) => { const store = useStore(BoxGameContext); return ( &lt;BlockImg \/*  \u0410\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 inline style,  \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 css-\u043a\u043b\u0430\u0441\u0441\u043e\u0432  (\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u0443\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0438\u0434\u043e\u0432 \u0431\u043b\u043e\u043a\u043e\u0432)  *\/ style={generatePositionStyle(position)} type={type} \/> ); };  export default observer(Block);<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 11.<\/strong> \u0414\u043b\u044f \u0431\u043b\u043e\u043a\u0430 \u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0432\u0435\u0440\u043b\u0435\u044f \u0441 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435\u043c \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0440\u0430\u0434\u0438\u0443\u0441 \u0431\u043b\u043e\u043a\u0430. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0435\u0433\u043e \u0432 \u043a\u043e\u043d\u0444\u0438\u0433:<\/p>\n<pre><code class=\"javascript\">export const BLOCK_RADIUS = 3.6;<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 12. <\/strong>\u0421\u0442\u0438\u043b\u0438\u0437\u0443\u0435\u043c \u0431\u043b\u043e\u043a. \u0418\u0437 \u043a\u043e\u043d\u0444\u0438\u0433\u0430 \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u043f\u043e \u0432\u0438\u0434\u0443 \u0431\u043b\u043e\u043a\u0430 \u0438 \u0440\u0430\u0434\u0438\u0443\u0441:<\/p>\n<pre><code class=\"javascript\">export const generateCicleStyle = (radius: number) => ({   \"border-radius\": \"50%\",   width: radius * 2 + \"rem\",   height: radius * 2 + \"rem\" });  export const BlockImg = styled.div&lt;{ type: BlocksEnum; }>` position: absolute; ${generateCicleStyle(BLOCK_RADIUS)}; background: url(${(props) => blocksImages[props.type]}) no-repeat center \/ contain; `;<\/code><\/pre>\n<figure class=\"full-width\"><\/figure>\n<p>\u0423 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0432\u0438\u0434\u0430. \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0440\u0430\u0449\u0430\u0442\u044c!<\/p>\n<p><a class=\"anchor\" name=\"3\" id=\"3\"><\/a><\/p>\n<h2>3 \u2014 \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0431\u043b\u043e\u043a\u043e\u0432. 10 \u0448\u0430\u0433\u043e\u0432<\/h2>\n<p>\u041c\u044b \u0438\u043c\u0435\u0435\u043c \u0442\u0440\u0438 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u0430. \u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043d\u0438\u0445 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0435 6 \u0432\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u0447\u0430\u0441\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0435\u043b\u043a\u0435.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0411\u043b\u043e\u043a\u0438 \u043c\u044b \u0445\u0440\u0430\u043d\u0438\u043c \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043f\u0438\u0448\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435. \u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u0431\u0435\u0440\u0435\u043c \u0438\u0437 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0432\u0438\u0434 \u0431\u043b\u043e\u043a\u0430 \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0438\u043d\u0434\u0435\u043a\u0441\u0443 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u043c\u0435\u043d\u044f\u0435\u043c \u0435\u0433\u043e \u0441 \u0432\u0438\u0434\u043e\u043c \u0431\u043b\u043e\u043a\u0430 \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c.<\/p>\n<p><strong>\u0428\u0430\u0433 1. <\/strong>\u041f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u043c <a href=\"#A\">\u0438\u043d\u0434\u0435\u043a\u0441\u044b <\/a>\u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u043e\u0432:<\/p>\n<pre><code class=\"javascript\">export enum RotationsEnum {   topLeft = \"4\",   topRight = \"5\",   bottom = \"8\" }<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 2. <\/strong>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043c\u0435\u0442\u043e\u0434 \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435:<\/p>\n<pre><code class=\"javascript\">\/\/ 3 \u043a\u0440\u0443\u0433\u0430 \u043f\u043e 6 \u0431\u043b\u043e\u043a\u043e\u0432 export const rotations: Record&lt;RotationsEnum, number[]> = {   [RotationsEnum.topLeft]: [0, 1, 5, 8, 7, 3],   [RotationsEnum.topRight]: [1, 2, 6, 9, 8, 4],   [RotationsEnum.bottom]: [4, 5, 9, 11, 10, 7] };<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 3. <\/strong>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043a \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"javascript\">rotate(clickIndex: number): void { if (!rotations[clickIndex]) { return; } const blocks = [...this.blocks]; \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043c\u0430\u0441\u0441\u043e\u0432 \u0432\u0438\u0434\u043e\u0432 \u0431\u043b\u043e\u043a\u043e\u0432 const rotationsMap = rotations[clickIndex]; \/\/ \u0431\u0435\u0440\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0439 \/\/ \u0438 \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u043c \u0435\u0433\u043e rotationsMap.forEach((rotationIndex: number, index: number) => { if (rotationsMap.length - 1 === index) { \/\/ \u043c\u0435\u043d\u044f\u0435\u043c \u0432\u0438\u0434\u044b \u0431\u043b\u043e\u043a\u043e\u0432 \u043f\u043e \u043d\u0443\u043b\u0435\u0432\u043e\u043c\u0443 \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c\u0443 \u0438\u043d\u0434\u0435\u043a\u0441\u0443 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f this.blocks[rotationsMap[0]] = blocks[rotationsMap[rotationsMap.length - 1]]; } else { \/\/ \u043c\u0435\u043d\u044f\u0435\u043c \u0432\u0438\u0434\u044b \u0431\u043b\u043e\u043a\u043e\u0432 \u043f\u043e \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f this.blocks[rotationsMap[index + 1]] = blocks[rotationIndex]; } }); }<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 4. <\/strong>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u044d\u0442\u043e\u0442 \u0431\u043b\u043e\u043a \u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u043c, \u0438 \u0432\u0435\u0448\u0430\u0435\u043c store.rotate \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u0431\u043b\u043e\u043a\u0430:<\/p>\n<pre><code class=\"javascript\">const isRotation = rotations[index]; \/*\u2026*\/ &lt;BlockImg \/*\u2026*\/ onClick={isRotation  ?  ()  => store.rotate(index) : undefined} \/><\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 5. <\/strong>\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u0433\u0435\u0442\u0442\u0435\u0440 \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432, \u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0433\u043e\u0442\u043e\u0432\u0430:<\/p>\n<pre><code class=\"javascript\">get isCorrect(): boolean { return Object.keys(correctIndexes).every((block) => this.isCorrectIndex(block) ); }<\/code><\/pre>\n<p><a class=\"anchor\" name=\"4\" id=\"4\"><\/a><\/p>\n<h2>4 \u2014 \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f. 10 \u0448\u0430\u0433\u043e\u0432<\/h2>\n<p><strong>\u0428\u0430\u0433 1. <\/strong>\u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0435 \u0431\u043b\u043e\u043a\u0438 \u0438 \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0435. \u0412 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043c\u0435\u0442\u043e\u0434, \u043c\u0435\u043d\u044f\u044e\u0449\u0438\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0431\u043b\u043e\u043a\u0430: <\/p>\n<pre><code class=\"javascript\">isAnimation = false; rotationIndex: number | null = null; setAnimation(value: boolean, index?: number): void { this.isAnimation = value; this.rotationIndex = index || null; }<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 2. <\/strong>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043a\u043e\u043d\u0444\u0438\u0433 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"javascript\">export const ANIMATION_TIME = 500;<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 3. <\/strong>\u0414\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043a\u043b\u0438\u043a\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 &lt;Block \/>:<\/p>\n<pre><code class=\"javascript\">const handleRotation = () => { if (store.isAnimation) { return; } store.setAnimation(true, index); setTimeout(() => { store.rotate(index); store.setAnimation(false); }); }<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 4. <\/strong>\u041f\u043e\u0440\u044f\u0434\u043e\u043a \u0431\u043b\u043e\u043a\u043e\u0432 \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438. \u041d\u0430 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043c\u044b \u0441\u043a\u0440\u043e\u0435\u043c \u0431\u043b\u043e\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u044e\u0442 \u0432 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438, \u0438 \u043d\u0430\u0440\u0438\u0441\u0443\u0435\u043c \u043f\u043e\u0432\u0435\u0440\u0445 \u043d\u043e\u0432\u044b\u0435. \u0412 Block.tsx \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443:<\/p>\n<pre><code class=\"javascript\">const isHide = () => { if (!store.rotationIndex) { return false; } const rotationIndexes = rotations[store.rotationIndex]; return Object.keys(rotationIndexes) .some((key) => rotationIndexes[key] === index); };<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 5. <\/strong>\u041e\u0431\u043d\u043e\u0432\u0438\u043c \u0441\u0442\u0438\u043b\u044c \u0431\u043b\u043e\u043a\u0430:<\/p>\n<pre><code class=\"javascript\">export const BlockImg = styled.div&lt;{ \/*\u2026*\/ isHide?: boolean; }>` \/*\u2026*\/ display: ${(props) => (props.isHide ? 'none' : 'block')}; `;<\/code><\/pre>\n<p><strong>\u0428\u0430\u0433 6. <\/strong>\u041f\u043e\u043b\u043e\u0436\u0438\u043c \u0432\u043d\u0443\u0442\u0440\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442-\u043e\u0432\u0435\u0440\u043b\u0435\u0439 \u0434\u043b\u044f \u0445\u043e\u0432\u0435\u0440\u0430 \u0438 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"javascript\">const withRotaionCircle =  isRotation &amp;&amp; (!store.rotationIndex || store.rotationIndex === index); &lt;BlockImg \/*\u2026*\/ onClick={isRotation &amp;&amp; !store.isCorrect ? handleRotation : undefined} <\/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-412061","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/412061","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=412061"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/412061\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=412061"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=412061"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=412061"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}