{"id":289666,"date":"2023-11-30T16:03:50","date_gmt":"2023-11-30T09:03:50","guid":{"rendered":"https:\/\/hoanghamobile.com\/tin-tuc\/?p=289666"},"modified":"2023-11-30T16:03:50","modified_gmt":"2023-11-30T09:03:50","slug":"code-trai-tim","status":"publish","type":"post","link":"https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/","title":{"rendered":"3 c\u00e1ch t\u1ea1o code tr\u00e1i tim \u0111\u01a1n gi\u1ea3n t\u1eb7ng m\u1ed9t n\u1eeda y\u00eau th\u01b0\u01a1ng"},"content":{"rendered":"<p><b>Code tr\u00e1i tim<\/b><span style=\"font-weight: 400;\"> l\u00e0 m\u1ed9t trend b\u1eaft ngu\u1ed3n t\u1eeb b\u1ed9 phim \u201cTh\u1eafp s\u00e1ng anh, s\u01b0\u1edfi \u1ea5m em\u201d. Theo \u0111\u00f3, m\u1ecdi ng\u01b0\u1eddi ch\u1ec9 c\u1ea7n l\u00e0m theo \u0111o\u1ea1n code n\u00e0y \u0111\u1ec3 t\u1ea1o n\u00ean t\u00e1c ph\u1ea9m tr\u00e1i tim d\u00e0nh t\u1eb7ng n\u1eeda y\u00eau th\u01b0\u01a1ng. B\u00e0i vi\u1ebft d\u01b0\u1edbi \u0111\u00e2y, Ho\u00e0ng H\u00e0 Mobile s\u1ebd t\u1ed5ng h\u1ee3p nh\u1eefng c\u00e1ch vi\u1ebft code t\u1ea1o h\u00ecnh tr\u00e1i tim cho c\u00e1c b\u1ea1n tham kh\u1ea3o nh\u00e9!\u00a0<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">Code tr\u00e1i tim l\u00e0 g\u00ec?<\/span><span style=\"font-weight: 400;\">\u00a0<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Code h\u00ecnh tr\u00e1i tim c\u00f3 ngu\u1ed3n g\u1ed1c t\u1eeb b\u1ed9 phim Trung Qu\u1ed1c mang t\u00ean \u201cTh\u1eafp s\u00e1ng anh, s\u01b0\u1edfi \u1ea5m em\u201d. C\u1ee5 th\u1ec3 trong t\u1eadp 5 c\u1ee7a b\u1ed9 phim, m\u1ed9t ch\u00e0ng trai th\u1ee7 khoa L\u00fd (L\u00fd Tu\u00e2n) \u0111\u00e3 vi\u1ebft code \u0111\u1ec3 t\u1ea1o ra h\u00ecnh tr\u00e1i tim l\u00e3ng m\u1ea1n g\u1eedi t\u1edbi crush. Ngay sau t\u1eadp phim, gi\u1edbi tr\u1ebb \u0111\u00e3 \u201c\u0111u trend\u201d v\u00e0 nhanh ch\u00f3ng \u0111\u01b0\u1ee3c lan truy\u1ec1n tr\u00ean n\u1ec1n t\u1ea3ng m\u1ea1ng x\u00e3 h\u1ed9i Facebook, Tiktok. So v\u1edbi b\u1ea3n g\u1ed1c, code h\u00ecnh tr\u00e1i tim \u0111\u01b0\u1ee3c bi\u1ebfn t\u1ea5u nh\u01b0 code k\u00e8m ch\u1eef, k\u00e8m h\u00ecnh \u1ea3nh,&#8230; Nh\u00ecn chung \u0111\u00e2y l\u00e0 m\u1ed9t th\u1ee7 thu\u1eadt kh\u00e1 ph\u1ee9c t\u1ea1p \u0111\u00f2i h\u1ecfi m\u1ecdi ng\u01b0\u1eddi c\u1ea7n t\u1eadp trung khi vi\u1ebft code.\u00a0<\/span><\/p>\n<p><picture><source srcset=\"https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/webp-express\/webp-images\/uploads\/2023\/11\/code-trai-tim-2.jpg.webp 800w, https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/webp-express\/webp-images\/uploads\/2023\/11\/code-trai-tim-2-300x200.jpg.webp 300w, https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/webp-express\/webp-images\/uploads\/2023\/11\/code-trai-tim-2-768x512.jpg.webp 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" type=\"image\/webp\"><img fetchpriority=\"high\" decoding=\"async\" class=\"size-full wp-image-291048 aligncenter webpexpress-processed\" src=\"https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2023\/11\/code-trai-tim-2.jpg\" alt=\"code-trai-tim-2\" width=\"800\" height=\"533\" srcset=\"https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2023\/11\/code-trai-tim-2.jpg 800w, https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2023\/11\/code-trai-tim-2-300x200.jpg 300w, https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2023\/11\/code-trai-tim-2-768x512.jpg 768w\" sizes=\"(max-width: 800px) 100vw, 800px\"><\/picture><\/p>\n<h2><span style=\"font-weight: 400;\">H\u01b0\u1edbng d\u1eabn nh\u1eefng c\u00e1ch vi\u1ebft code tr\u00e1i tim \u0111\u01a1n gi\u1ea3n\u00a0<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Sau khi trend vi\u1ebft code t\u1ea1o h\u00ecnh tr\u00e1i tim \u0111\u01b0\u1ee3c lan truy\u1ec1n tr\u00ean m\u1ea1ng, c\u00e1ch vi\u1ebft code \u0111\u01b0\u1ee3c bi\u1ebfn t\u1ea5u, thay \u0111\u1ed5i. Sau \u0111\u00e2y, ch\u00fang t\u00f4i s\u1ebd h\u01b0\u1edbng d\u1eabn c\u00e1ch vi\u1ebft code t\u1ea1o h\u00ecnh tr\u00e1i tim \u0111a d\u1ea1ng cho c\u00e1c b\u1ea1n tham kh\u1ea3o:\u00a0<\/span><\/p>\n<h3><span style=\"font-weight: 400;\">T\u1ea1o code tr\u00e1i tim ch\u00e8n ch\u1eef\u00a0<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">C\u00e1ch vi\u1ebft code h\u00ecnh tr\u00e1i tim ch\u00e8n ch\u1eef t\u1eb7ng m\u1ed9t n\u1eeda y\u00eau th\u01b0\u01a1ng kh\u00e1 \u0111\u01a1n gi\u1ea3n, m\u1ecdi ng\u01b0\u1eddi h\u00e3y d\u00f9ng \u0111o\u1ea1n m\u00e3 d\u01b0\u1edbi \u0111\u00e2y. L\u01b0u \u00fd, ng\u01b0\u1eddi d\u00f9ng h\u00e3y copy ch\u00ednh x\u00e1c \u0111o\u1ea1n m\u00e3 n\u00e0y v\u00e0 c\u00f3 th\u1ec3 \u0111i\u1ec1u ch\u1ec9nh n\u1ed9i dung theo \u00fd mu\u1ed1n.\u00a0<\/span><\/p>\n<p><picture><source srcset=\"https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/webp-express\/webp-images\/uploads\/2023\/11\/code-trai-tim-3.jpg.webp 800w, https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/webp-express\/webp-images\/uploads\/2023\/11\/code-trai-tim-3-300x200.jpg.webp 300w, https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/webp-express\/webp-images\/uploads\/2023\/11\/code-trai-tim-3-768x512.jpg.webp 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" type=\"image\/webp\"><img decoding=\"async\" class=\"size-full wp-image-291049 aligncenter webpexpress-processed\" src=\"https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2023\/11\/code-trai-tim-3.jpg\" alt=\"code-trai-tim-3\" width=\"800\" height=\"533\" srcset=\"https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2023\/11\/code-trai-tim-3.jpg 800w, https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2023\/11\/code-trai-tim-3-300x200.jpg 300w, https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2023\/11\/code-trai-tim-3-768x512.jpg 768w\" sizes=\"(max-width: 800px) 100vw, 800px\"><\/picture><\/p>\n<p><span style=\"font-weight: 400;\">&lt;!DOCTYPE HTML PUBLIC \u201c-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\u201d&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&lt;HTML&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0&lt;HEAD&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&lt;TITLE&gt; Heart &lt;\/TITLE&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&lt;META NAME=\u201dGenerator\u201d CONTENT=\u201dEditPlus\u201d&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&lt;META NAME=\u201dAuthor\u201d CONTENT=\u201d\u201d&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&lt;META NAME=\u201dKeywords\u201d CONTENT=\u201d\u201d&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&lt;META NAME=\u201dDescription\u201d CONTENT=\u201d\u201d&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&lt;style&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0html, body {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0height: 100%;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0padding: 0;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0margin: 0;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0background: #000;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0display: flex;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0justify-content: center;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0align-items: center;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">.box {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0width: 100%;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0position: absolute;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0top: 50%;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0left: 50%;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0transform: translate(-50%, -50%);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0display: flex;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0flex-direction: column;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">canvas {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0position: absolute;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0width: 100%;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0height: 100%;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">#pinkboard {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0position: relative;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0margin: auto;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0height: 500px;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0width: 500px;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0animation: animate 1.3s infinite;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">#pinkboard:before, #pinkboard:after {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0content: \u201d;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0position: absolute;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0background: #FF5CA4;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0width: 100px;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0height: 160px;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0border-top-left-radius: 50px;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0border-top-right-radius: 50px;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">#pinkboard:before {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0left: 100px;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0transform: rotate(-45deg);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0transform-origin: 0 100%;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0box-shadow: 0 14px 28px rgba(0,0,0,0.25),<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a00 10px 10px rgba(0,0,0,0.22);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">#pinkboard:after {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0left: 0;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0transform: rotate(45deg);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0transform-origin: 100% 100%;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">@keyframes animate {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a00% {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0transform: scale(1);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a030% {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0transform: scale(.8);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a060% {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0transform: scale(1.2);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0}<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0100% {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0transform: scale(1);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&lt;\/style&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0&lt;\/HEAD&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0&lt;BODY&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0&lt;div class=\u201dbox\u201d&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;canvas id=\u201dpinkboard\u201d&gt;&lt;\/canvas&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0&lt;\/div&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&lt;script&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\/*<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0* Settings<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0*\/<\/span><\/p>\n<p><span style=\"font-weight: 400;\">var settings = {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0particles: {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0length: \u00a0 2000, \/\/ maximum amount of particles<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0duration: \u00a0 2, \/\/ particle duration in sec<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0velocity: 100, \/\/ particle velocity in pixels\/sec<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0effect: -1.3, \/\/ play with this for a nice effect<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0size:\u00a0 \u00a0 \u00a0 13, \/\/ particle size in pixels<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0},<\/span><\/p>\n<p><span style=\"font-weight: 400;\">};<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/*<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0* RequestAnimationFrame polyfill by Erik M\u00f6ller<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0*\/<\/span><\/p>\n<p><span style=\"font-weight: 400;\">(function(){var b=0;var c=[\u201cms\u201d,\u201dmoz\u201d,\u201dwebkit\u201d,\u201do\u201d];for(var a=0;a&lt;c.length&amp;&amp;!window.requestAnimationFrame;++a){window.requestAnimationFrame=window[c[a]+\u201dRequestAnimationFrame\u201d];window.cancelAnimationFrame=window[c[a]+\u201dCancelAnimationFrame\u201d]||window[c[a]+\u201dCancelRequestAnimationFrame\u201d]}if(!window.requestAnimationFrame){window.requestAnimationFrame=function(h,e){var d=new Date().getTime();var f=Math.max(0,16-(d-b));var g=window.setTimeout(function(){h(d+f)},f);b=d+f;return g}}if(!window.cancelAnimationFrame){window.cancelAnimationFrame=function(d){clearTimeout(d)}}}());<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/*<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0* Point class<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0*\/<\/span><\/p>\n<p><span style=\"font-weight: 400;\">var Point = (function() {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0function Point(x, y) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0this.x = (typeof x !== \u2018undefined\u2019) ? x : 0;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0this.y = (typeof y !== \u2018undefined\u2019) ? y : 0;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0Point.prototype.clone = function() {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0return new Point(this.x, this.y);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0};<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0Point.prototype.length = function(length) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0if (typeof length == \u2018undefined\u2019)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return Math.sqrt(this.x * this.x + this.y * this.y);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0this.normalize();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0this.x *= length;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0this.y *= length;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0return this;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0};<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0Point.prototype.normalize = function() {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0var length = this.length();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0this.x \/= length;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0this.y \/= length;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0return this;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0};<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0return Point;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">})();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/*<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0* Particle class<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0*\/<\/span><\/p>\n<p><span style=\"font-weight: 400;\">var Particle = (function() {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0function Particle() {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0this.position = new Point();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0this.velocity = new Point();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0this.acceleration = new Point();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0this.age = 0;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0Particle.prototype.initialize = function(x, y, dx, dy) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0this.position.x = x;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0this.position.y = y;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0this.velocity.x = dx;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0this.velocity.y = dy;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0this.acceleration.x = dx * settings.particles.effect;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0this.acceleration.y = dy * settings.particles.effect;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0this.age = 0;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0};<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0Particle.prototype.update = function(deltaTime) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0this.position.x += this.velocity.x * deltaTime;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0this.position.y += this.velocity.y * deltaTime;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0this.velocity.x += this.acceleration.x * deltaTime;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0this.velocity.y += this.acceleration.y * deltaTime;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0this.age += deltaTime;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0};<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0Particle.prototype.draw = function(context, image) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0function ease(t) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return (\u2013t) * t * t + 1;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0var size = image.width * ease(this.age \/ settings.particles.duration);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0context.globalAlpha = 1 \u2013 this.age \/ settings.particles.duration;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0context.drawImage(image, this.position.x \u2013 size \/ 2, this.position.y \u2013 size \/ 2, size, size);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0};<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0return Particle;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">})();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/*<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0* ParticlePool class<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0*\/<\/span><\/p>\n<p><span style=\"font-weight: 400;\">var ParticlePool = (function() {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0var particles,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0firstActive = 0,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0firstFree \u00a0 = 0,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0duration\u00a0 \u00a0 = settings.particles.duration;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0function ParticlePool(length) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\/\/ create and populate particle pool<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0particles = new Array(length);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0for (var i = 0; i &lt; particles.length; i++)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0particles[i] = new Particle();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0ParticlePool.prototype.add = function(x, y, dx, dy) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0particles[firstFree].initialize(x, y, dx, dy);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\/\/ handle circular queue<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0firstFree++;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0if (firstFree \u00a0 == particles.length) firstFree \u00a0 = 0;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0if (firstActive == firstFree \u00a0 \u00a0 \u00a0 ) firstActive++;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0if (firstActive == particles.length) firstActive = 0;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0};<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0ParticlePool.prototype.update = function(deltaTime) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0var i;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\/\/ update active particles<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0if (firstActive &lt; firstFree) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0for (i = firstActive; i &lt; firstFree; i++)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0particles[i].update(deltaTime);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0if (firstFree &lt; firstActive) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0for (i = firstActive; i &lt; particles.length; i++)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0particles[i].update(deltaTime);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0for (i = 0; i &lt; firstFree; i++)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0particles[i].update(deltaTime);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\/\/ remove inactive particles<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0while (particles[firstActive].age &gt;= duration &amp;&amp; firstActive != firstFree) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0firstActive++;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (firstActive == particles.length) firstActive = 0;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0};<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0ParticlePool.prototype.draw = function(context, image) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\/\/ draw active particles<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0if (firstActive &lt; firstFree) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0for (i = firstActive; i &lt; firstFree; i++)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0particles[i].draw(context, image);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0if (firstFree &lt; firstActive) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0for (i = firstActive; i &lt; particles.length; i++)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0particles[i].draw(context, image);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0for (i = 0; i &lt; firstFree; i++)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0particles[i].draw(context, image);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0};<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0return ParticlePool;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">})();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/*<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0* Putting it all together<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0*\/<\/span><\/p>\n<p><span style=\"font-weight: 400;\">(function(canvas) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0var context = canvas.getContext(\u20182d\u2019),<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0particles = new ParticlePool(settings.particles.length),<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0particleRate = settings.particles.length \/ settings.particles.duration, \/\/ particles\/sec<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0time;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\/\/ get point on heart with -PI &lt;= t &lt;= PI<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0function pointOnHeart(t) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0return new Point(<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0160 * Math.pow(Math.sin(t), 3),<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0130 * Math.cos(t) \u2013 50 * Math.cos(2 * t) \u2013 20 * Math.cos(3 * t) \u2013 10 * Math.cos(4 * t) + 25<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\/\/ creating the particle image using a dummy canvas<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0var image = (function() {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0var canvas\u00a0 = document.createElement(\u2018canvas\u2019),<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0context = canvas.getContext(\u20182d\u2019);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0canvas.width\u00a0 = settings.particles.size;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0canvas.height = settings.particles.size;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\/\/ helper function to create the path<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0function to(t) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0var point = pointOnHeart(t);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0point.x = settings.particles.size \/ 2 + point.x * settings.particles.size \/ 350;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0point.y = settings.particles.size \/ 2 \u2013 point.y * settings.particles.size \/ 350;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return point;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\/\/ create the path<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0context.beginPath();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0var t = -Math.PI;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0var point = to(t);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0context.moveTo(point.x, point.y);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0while (t &lt; Math.PI) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0t += 0.01; \/\/ baby steps!<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0point = to(t);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0context.lineTo(point.x, point.y);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0context.closePath();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\/\/ create the fill<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0context.fillStyle = \u2018#FF5CA4\u2019;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0context.fill();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\/\/ create the image<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0var image = new Image();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0image.src = canvas.toDataURL();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0return image;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0})();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\/\/ render that thing!<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0function render() {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\/\/ next animation frame<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0requestAnimationFrame(render);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\/\/ update time<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0var newTime \u00a0 = new Date().getTime() \/ 1000,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0deltaTime = newTime \u2013 (time || newTime);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0time = newTime;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\/\/ clear canvas<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0context.clearRect(0, 0, canvas.width, canvas.height);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\/\/ create new particles<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0var amount = particleRate * deltaTime;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0for (var i = 0; i &lt; amount; i++) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0var pos = pointOnHeart(Math.PI \u2013 2 * Math.PI * Math.random());<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0var dir = pos.clone().length(settings.particles.velocity);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0particles.add(canvas.width \/ 2 + pos.x, canvas.height \/ 2 \u2013 pos.y, dir.x, -dir.y);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\/\/ update and draw particles<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0particles.update(deltaTime);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0particles.draw(context, image);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\/\/ handle (re-)sizing of the canvas<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0function onResize() {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0canvas.width\u00a0 = canvas.clientWidth;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0canvas.height = canvas.clientHeight;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0window.onresize = onResize;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\/\/ delay rendering bootstrap<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0setTimeout(function() {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0onResize();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0render();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0}, 10);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">})(document.getElementById(\u2018pinkboard\u2019));<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&lt;\/script&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&lt;div class=\u201dcenter-text\u201d,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0style=\u201dbackground-color:rgb(0, 0, 0);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0width: 100%;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0color: rgb(225, 12, 168);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0height:100%;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0font-size: 31px;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0font-style: italic;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0display: flex;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0align-items: center;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0justify-content: center;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0margin-bottom: 5px<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0text-align: center;\u201d&gt;Anh Y\u00eau Em&lt;\/div&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0&lt;\/BODY&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&lt;\/HTML&gt;<\/span><\/p>\n<h3><span style=\"font-weight: 400;\">T\u1ea1o code tr\u00e1i tim \u0111\u1eadp kh\u00f4ng c\u00f3 t\u00ean\u00a0<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Ngo\u00e0i c\u00e1ch t\u1ea1o code c\u00f3 h\u00ecnh tr\u00e1i tim c\u00f3 ch\u1eef, m\u1ecdi ng\u01b0\u1eddi c\u00f3 th\u1ec3 t\u1ea1o h\u00ecnh tr\u00e1i tim kh\u00f4ng c\u00f3 ch\u1eef. \u0110\u1ec3 t\u1ea1o code h\u00ecnh tr\u00e1i tim kh\u00f4ng hi\u1ec3n th\u1ecb ch\u1eef, m\u1ecdi ng\u01b0\u1eddi h\u00e3y copy \u0111o\u1ea1n code sau \u0111\u00e2y:\u00a0<\/span><\/p>\n<p><picture><source srcset=\"https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/webp-express\/webp-images\/uploads\/2023\/11\/code-trai-tim-4.jpg.webp 800w, https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/webp-express\/webp-images\/uploads\/2023\/11\/code-trai-tim-4-300x200.jpg.webp 300w, https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/webp-express\/webp-images\/uploads\/2023\/11\/code-trai-tim-4-768x512.jpg.webp 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" type=\"image\/webp\"><img decoding=\"async\" class=\"size-full wp-image-291050 aligncenter webpexpress-processed\" src=\"https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2023\/11\/code-trai-tim-4.jpg\" alt=\"code-trai-tim-4\" width=\"800\" height=\"533\" srcset=\"https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2023\/11\/code-trai-tim-4.jpg 800w, https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2023\/11\/code-trai-tim-4-300x200.jpg 300w, https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2023\/11\/code-trai-tim-4-768x512.jpg 768w\" sizes=\"(max-width: 800px) 100vw, 800px\"><\/picture><\/p>\n<p><span style=\"font-weight: 400;\">&lt;!DOCTYPE HTML PUBLIC \u201c-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\u201d&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&lt;HTML&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0&lt;HEAD&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&lt;TITLE&gt; New Document &lt;\/TITLE&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&lt;META NAME=\u201dGenerator\u201d CONTENT=\u201dEditPlus\u201d&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&lt;META NAME=\u201dAuthor\u201d CONTENT=\u201d\u201d&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&lt;META NAME=\u201dKeywords\u201d CONTENT=\u201d\u201d&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&lt;META NAME=\u201dDescription\u201d CONTENT=\u201d\u201d&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&lt;style&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0html, body {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0height: 100%;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0padding: 0;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0margin: 0;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0background: #000;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">canvas {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0position: absolute;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0width: 100%;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0height: 100%;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&lt;\/style&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0&lt;\/HEAD&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0&lt;BODY&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&lt;canvas id=\u201dpinkboard\u201d&gt;&lt;\/canvas&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&lt;script&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\/*<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0* Settings<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0*\/<\/span><\/p>\n<p><span style=\"font-weight: 400;\">var settings = {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0particles: {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">length: \u00a0 500, \/\/ maximum amount of particles<\/span><\/p>\n<p><span style=\"font-weight: 400;\">duration: \u00a0 2, \/\/ particle duration in sec<\/span><\/p>\n<p><span style=\"font-weight: 400;\">velocity: 100, \/\/ particle velocity in pixels\/sec<\/span><\/p>\n<p><span style=\"font-weight: 400;\">effect: -0.75, \/\/ play with this for a nice effect<\/span><\/p>\n<p><span style=\"font-weight: 400;\">size:\u00a0 <\/span> <span style=\"font-weight: 400;\">30, \/\/ particle size in pixels<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0},<\/span><\/p>\n<p><span style=\"font-weight: 400;\">};<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/*<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0* RequestAnimationFrame polyfill by Erik M\u00f6ller<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0*\/<\/span><\/p>\n<p><span style=\"font-weight: 400;\">(function(){var b=0;var c=[\u201cms\u201d,\u201dmoz\u201d,\u201dwebkit\u201d,\u201do\u201d];for(var a=0;a&lt;c.length&amp;&amp;!window.requestAnimationFrame;++a){window.requestAnimationFrame=window[c[a]+\u201dRequestAnimationFrame\u201d];window.cancelAnimationFrame=window[c[a]+\u201dCancelAnimationFrame\u201d]||window[c[a]+\u201dCancelRequestAnimationFrame\u201d]}if(!window.requestAnimationFrame){window.requestAnimationFrame=function(h,e){var d=new Date().getTime();var f=Math.max(0,16-(d-b));var g=window.setTimeout(function(){h(d+f)},f);b=d+f;return g}}if(!window.cancelAnimationFrame){window.cancelAnimationFrame=function(d){clearTimeout(d)}}}());<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/*<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0* Point class<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0*\/<\/span><\/p>\n<p><span style=\"font-weight: 400;\">var Point = (function() {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0function Point(x, y) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0this.x = (typeof x !== \u2018undefined\u2019) ? x : 0;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">this.y = (typeof y !== \u2018undefined\u2019) ? y : 0;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0Point.prototype.clone = function() {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">return new Point(this.x, this.y);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0};<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0Point.prototype.length = function(length) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">if (typeof length == \u2018undefined\u2019)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">return Math.sqrt(this.x * this.x + this.y * this.y);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">this.normalize();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">this.x *= length;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">this.y *= length;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">return this;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0};<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0Point.prototype.normalize = function() {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">var length = this.length();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">this.x \/= length;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0this.y \/= length;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">return this;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0};<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0return Point;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">})();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/*<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0* Particle class<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0*\/<\/span><\/p>\n<p><span style=\"font-weight: 400;\">var Particle = (function() {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0function Particle() {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">this.position = new Point();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">this.velocity = new Point();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">this.acceleration = new Point();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">this.age = 0;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0Particle.prototype.initialize = function(x, y, dx, dy) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">this.position.x = x;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">this.position.y = y;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">this.velocity.x = dx;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">this.velocity.y = dy;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">this.acceleration.x = dx * settings.particles.effect;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">this.acceleration.y = dy * settings.particles.effect;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">this.age = 0;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0};<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0Particle.prototype.update = function(deltaTime) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">this.position.x += this.velocity.x * deltaTime;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">this.position.y += this.velocity.y * deltaTime;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">this.velocity.x += this.acceleration.x * deltaTime;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">this.velocity.y += this.acceleration.y * deltaTime;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">this.age += deltaTime;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0};<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0Particle.prototype.draw = function(context, image) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">function ease(t) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">return (\u2013t) * t * t + 1;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">var size = image.width * ease(this.age \/ settings.particles.duration);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">context.globalAlpha = 1 \u2013 this.age \/ settings.particles.duration;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">context.drawImage(image, this.position.x \u2013 size \/ 2, this.position.y \u2013 size \/ 2, size, size);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0};<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0return Particle;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">})();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/*<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0* ParticlePool class<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0*\/<\/span><\/p>\n<p><span style=\"font-weight: 400;\">var ParticlePool = (function() {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0var particles,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">firstActive = 0,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">firstFree \u00a0 = 0,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">duration<\/span> <span style=\"font-weight: 400;\">= settings.particles.duration;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0function ParticlePool(length) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/\/ create and populate particle pool<\/span><\/p>\n<p><span style=\"font-weight: 400;\">particles = new Array(length);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">for (var i = 0; i &lt; particles.length; i++)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">particles[i] = new Particle();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0ParticlePool.prototype.add = function(x, y, dx, dy) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">particles[firstFree].initialize(x, y, dx, dy);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/\/ handle circular queue<\/span><\/p>\n<p><span style=\"font-weight: 400;\">firstFree++;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">if (firstFree \u00a0 == particles.length) firstFree \u00a0 = 0;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">if (firstActive == firstFree \u00a0 <\/span> <span style=\"font-weight: 400;\">) firstActive++;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">if (firstActive == particles.length) firstActive = 0;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0};<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0ParticlePool.prototype.update = function(deltaTime) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">var i;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/\/ update active particles<\/span><\/p>\n<p><span style=\"font-weight: 400;\">if (firstActive &lt; firstFree) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">for (i = firstActive; i &lt; firstFree; i++)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">particles[i].update(deltaTime);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">if (firstFree &lt; firstActive) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">for (i = firstActive; i &lt; particles.length; i++)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">particles[i].update(deltaTime);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">for (i = 0; i &lt; firstFree; i++)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">particles[i].update(deltaTime);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/\/ remove inactive particles<\/span><\/p>\n<p><span style=\"font-weight: 400;\">while (particles[firstActive].age &gt;= duration &amp;&amp; firstActive != firstFree) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">firstActive++;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">if (firstActive == particles.length) firstActive = 0;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0};<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0ParticlePool.prototype.draw = function(context, image) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/\/ draw active particles<\/span><\/p>\n<p><span style=\"font-weight: 400;\">if (firstActive &lt; firstFree) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">for (i = firstActive; i &lt; firstFree; i++)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">particles[i].draw(context, image);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">if (firstFree &lt; firstActive) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">for (i = firstActive; i &lt; particles.length; i++)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">particles[i].draw(context, image);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">for (i = 0; i &lt; firstFree; i++)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">particles[i].draw(context, image);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0};<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0return ParticlePool;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">})();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/*<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0* Putting it all together<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0*\/<\/span><\/p>\n<p><span style=\"font-weight: 400;\">(function(canvas) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0var context = canvas.getContext(\u20182d\u2019),<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0<\/span> <span style=\"font-weight: 400;\"> particles = new ParticlePool(settings.particles.length),<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">particleRate = settings.particles.length \/ settings.particles.duration, \/\/ particles\/sec<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">time;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\/\/ get point on heart with -PI &lt;= t &lt;= PI<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0function pointOnHeart(t) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">return new Point(<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">160 * Math.pow(Math.sin(t), 3),<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">130 * Math.cos(t) \u2013 50 * Math.cos(2 * t) \u2013 20 * Math.cos(3 * t) \u2013 10 * Math.cos(4 * t) + 25<\/span><\/p>\n<p><span style=\"font-weight: 400;\">);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\/\/ creating the particle image using a dummy canvas<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0var image = (function() {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">var canvas\u00a0 = document.createElement(\u2018canvas\u2019),<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">context = canvas.getContext(\u20182d\u2019);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">canvas.width\u00a0 = settings.particles.size;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">canvas.height = settings.particles.size;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/\/ helper function to create the path<\/span><\/p>\n<p><span style=\"font-weight: 400;\">function to(t) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var point = pointOnHeart(t);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">point.x = settings.particles.size \/ 2 + point.x * settings.particles.size \/ 350;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">point.y = settings.particles.size \/ 2 \u2013 point.y * settings.particles.size \/ 350;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">return point;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/\/ create the path<\/span><\/p>\n<p><span style=\"font-weight: 400;\">context.beginPath();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">var t = -Math.PI;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">var point = to(t);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">context.moveTo(point.x, point.y);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">while (t &lt; Math.PI) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">t += 0.01; \/\/ baby steps!<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">point = to(t);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">context.lineTo(point.x, point.y);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">context.closePath();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/\/ create the fill<\/span><\/p>\n<p><span style=\"font-weight: 400;\">context.fillStyle = \u2018#ea80b0\u2019;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">context.fill();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/\/ create the image<\/span><\/p>\n<p><span style=\"font-weight: 400;\">var image = new Image();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">image.src = canvas.toDataURL();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">return image;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0})();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\/\/ render that thing!<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0function render() {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/\/ next animation frame<\/span><\/p>\n<p><span style=\"font-weight: 400;\">requestAnimationFrame(render);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/\/ update time<\/span><\/p>\n<p><span style=\"font-weight: 400;\">var newTime \u00a0 = new Date().getTime() \/ 1000,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">deltaTime = newTime \u2013 (time || newTime);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">time = newTime;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/\/ clear canvas<\/span><\/p>\n<p><span style=\"font-weight: 400;\">context.clearRect(0, 0, canvas.width, canvas.height);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/\/ create new particles<\/span><\/p>\n<p><span style=\"font-weight: 400;\">var amount = particleRate * deltaTime;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">for (var i = 0; i &lt; amount; i++) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var pos = pointOnHeart(Math.PI \u2013 2 * Math.PI * Math.random());<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var dir = pos.clone().length(settings.particles.velocity);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">particles.add(canvas.width \/ 2 + pos.x, canvas.height \/ 2 \u2013 pos.y, dir.x, -dir.y);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/\/ update and draw particles<\/span><\/p>\n<p><span style=\"font-weight: 400;\">particles.update(deltaTime);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">particles.draw(context, image);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\/\/ handle (re-)sizing of the canvas<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0function onResize() {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">canvas.width\u00a0 = canvas.clientWidth;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">canvas.height = canvas.clientHeight;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0window.onresize = onResize;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\/\/ delay rendering bootstrap<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0setTimeout(function() {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">onResize();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">render();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0}, 10);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">})(document.getElementById(\u2018pinkboard\u2019));<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&lt;\/script&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0&lt;\/BODY&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&lt;\/HTML&gt;<\/span><\/p>\n<h3><span style=\"font-weight: 400;\">T\u1ea1o code tr\u00e1i tim tia s\u00e1ng ngh\u1ec7 thu\u1eadt\u00a0<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">N\u1ebfu m\u1ecdi ng\u01b0\u1eddi mu\u1ed1n t\u1ea1o h\u00ecnh tr\u00e1i tim c\u00f3 th\u00eam tia s\u00e1ng th\u00ec h\u00e3y vi\u1ebft code theo \u0111o\u1ea1n code d\u01b0\u1edbi \u0111\u00e2y. L\u01b0u \u00fd, m\u1ecdi ng\u01b0\u1eddi n\u00ean vi\u1ebft \u0111\u00fang m\u00e3 code \u0111\u1ec3 t\u1ea1o th\u00e0nh h\u00ecnh tr\u00e1i tim \u0111\u1eb9p nh\u00e9!\u00a0<\/span><\/p>\n<p><picture><source srcset=\"https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/webp-express\/webp-images\/uploads\/2023\/11\/code-trai-tim-5.jpg.webp 800w, https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/webp-express\/webp-images\/uploads\/2023\/11\/code-trai-tim-5-300x200.jpg.webp 300w, https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/webp-express\/webp-images\/uploads\/2023\/11\/code-trai-tim-5-768x512.jpg.webp 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" type=\"image\/webp\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-291051 aligncenter webpexpress-processed\" src=\"https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2023\/11\/code-trai-tim-5.jpg\" alt=\"code-trai-tim-5\" width=\"800\" height=\"533\" srcset=\"https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2023\/11\/code-trai-tim-5.jpg 800w, https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2023\/11\/code-trai-tim-5-300x200.jpg 300w, https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2023\/11\/code-trai-tim-5-768x512.jpg 768w\" sizes=\"(max-width: 800px) 100vw, 800px\"><\/picture><\/p>\n<p><span style=\"font-weight: 400;\">&lt;!DOCTYPE html&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&lt;html lang=\u201den\u201d&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&lt;head&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&lt;meta charset=\u201dUTF-8\u2033&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&lt;meta http-equiv=\u201dX-UA-Compatible\u201d content=\u201dIE=edge\u201d&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&lt;meta name=\u201dviewport\u201d content=\u201dwidth=device-width, initial-scale=1.0\u2033&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&lt;title&gt;Document&lt;\/title&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&lt;style&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">canvas {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">position: absolute;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">left: 0;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">top: 0;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">width: 100%;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">height: 100%;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">background-color: rgba(0, 0, 0, .2);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&lt;\/style&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&lt;\/head&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&lt;body&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&lt;canvas id=\u201dheart\u201d&gt;&lt;\/canvas&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&lt;script&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">window.requestAnimationFrame =<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">window.__requestAnimationFrame ||<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">window.requestAnimationFrame ||<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">window.webkitRequestAnimationFrame ||<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0window.mozRequestAnimationFrame ||<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">window.oRequestAnimationFrame ||<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">window.msRequestAnimationFrame ||<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">(function () {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">return function (callback, element) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var lastTime = element.__lastTime;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">if (lastTime === undefined) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\"> \u00a0 lastTime = 0;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var currTime = Date.now();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var timeToCall = Math.max(1, 33 \u2013 (currTime \u2013 lastTime));<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0<\/span> <span style=\"font-weight: 400;\"> \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 window.setTimeout(callback, timeToCall);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">element.__lastTime = currTime + timeToCall;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">};<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">})();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">window.isDevice = (\/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini\/i.test(((navigator.userAgent || navigator.vendor || window.opera)).toLowerCase()));<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var loaded = false;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var init = function () {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">if (loaded) return;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">loaded = true;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var mobile = window.isDevice;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var koef = mobile ? 0.5 : 1;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var canvas = document.getElementById(\u2018heart\u2019);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 var ctx = canvas.getContext(\u20182d\u2019);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var width = canvas.width = koef * innerWidth;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var height = canvas.height = koef * innerHeight;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var rand = Math.random;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">ctx.fillStyle = \u201crgba(0,0,0,1)\u201d;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">ctx.fillRect(0, 0, width, height);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var heartPosition = function (rad) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">\/\/return [Math.sin(rad), Math.cos(rad)];<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\"> \u00a0 \u00a0 return [Math.pow(Math.sin(rad), 3), -(15 * Math.cos(rad) \u2013 5 * Math.cos(2 * rad) \u2013 2 * Math.cos(3 * rad) \u2013 Math.cos(4 * rad))];<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">};<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var scaleAndTranslate = function (pos, sx, sy, dx, dy) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">return [dx + pos[0] * sx, dy + pos[1] * sy];<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">};<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">window.addEventListener(\u2018resize\u2019, function () {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 width = canvas.width = koef * innerWidth;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">height = canvas.height = koef * innerHeight;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">ctx.fillStyle = \u201crgba(0,0,0,1)\u201d;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">ctx.fillRect(0, 0, width, height);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">});<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var traceCount = mobile ? 20 : 50;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var pointsOrigin = [];<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var i;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var dr = mobile ? 0.3 : 0.1;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">for (i = 0; i &lt; Math.PI * 2; i += dr) pointsOrigin.push(scaleAndTranslate(heartPosition(i), 210, 13, 0, 0));<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">for (i = 0; i &lt; Math.PI * 2; i += dr) pointsOrigin.push(scaleAndTranslate(heartPosition(i), 150, 9, 0, 0));<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">for (i = 0; i &lt; Math.PI * 2; i += dr) pointsOrigin.push(scaleAndTranslate(heartPosition(i), 90, 5, 0, 0));<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var heartPointsCount = pointsOrigin.length;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var targetPoints = [];<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var pulse = function (kx, ky) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">for (i = 0; i &lt; pointsOrigin.length; i++) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">targetPoints[i] = [];<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">targetPoints[i][0] = kx * pointsOrigin[i][0] + width \/ 2;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">targetPoints[i][1] = ky * pointsOrigin[i][1] + height \/ 2;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\"> \u00a0 }<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">};<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var e = [];<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">for (i = 0; i &lt; heartPointsCount; i++) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var x = rand() * width;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 var y = rand() * height;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">e[i] = {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">vx: 0,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">vy: 0,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">R: 2,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">speed: rand() + 5,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">q: ~~(rand() * heartPointsCount),<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">D: 2 * (i % 2) \u2013 1,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">force: 0.2 * rand() + 0.7,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">f: \u201chsla(0,\u201d + ~~(40 * rand() + 60) + \u201c%,\u201d + ~~(60 * rand() + 20) + \u201c%,.3)\u201d,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">trace: []<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">};<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">for (var k = 0; k &lt; traceCount; k++) e[i].trace[k] = { x: x, y: y };<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var config = {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">traceK: 0.4,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">timeDelta: 0.01<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">};<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var time = 0;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var loop = function () {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var n = -Math.cos(time);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">pulse((1 + n) * .5, (1 + n) * .5);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">time += ((Math.sin(time)) &lt; 0 ? 9 : (n &gt; 0.8) ? .2 : 1) * config.timeDelta;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">ctx.fillStyle = \u201crgba(0,0,0,.1)\u201d;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">ctx.fillRect(0, 0, width, height);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 for (i = e.length; i\u2013;) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var u = e[i];<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var q = targetPoints[u.q];<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var dx = u.trace[0].x \u2013 q[0];<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var dy = u.trace[0].y \u2013 q[1];<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var length = Math.sqrt(dx * dx + dy * dy);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">if (10 &gt; length) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">if (0.95 &lt; rand()) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">u.q = ~~(rand() * heartPointsCount);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">else {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\"> \u00a0 \u00a0 if (0.99 &lt; rand()) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">u.D *= -1;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">u.q += u.D;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">u.q %= heartPointsCount;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">if (0 &gt; u.q) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\"> \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 u.q += heartPointsCount;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">u.vx += -dx \/ length * u.speed;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">u.vy += -dy \/ length * u.speed;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">u.trace[0].x += u.vx;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">u.trace[0].y += u.vy;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">u.vx *= u.force;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">u.vy *= u.force;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">for (k = 0; k &lt; u.trace.length \u2013 1;) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var T = u.trace[k];<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var N = u.trace[++k];<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\"> \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 N.x -= config.traceK * (N.x \u2013 T.x);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">N.y -= config.traceK * (N.y \u2013 T.y);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">ctx.fillStyle = u.f;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">for (k = 0; k &lt; u.trace.length; k++) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">ctx.fillRect(u.trace[k].x, u.trace[k].y, 1, 1);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">\/\/ctx.fillStyle = \u201crgba(255,255,255,1)\u201d;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">\/\/for (i = u.trace.length; i\u2013;) ctx.fillRect(targetPoints[i][0], targetPoints[i][1], 2, 2);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">window.requestAnimationFrame(loop, canvas);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">};<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">loop();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">};<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">var s = document.readyState;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">if (s === \u2018complete\u2019 || s === \u2018loaded\u2019 || s === \u2018interactive\u2019) init();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">else document.addEventListener(\u2018DOMContentLoaded\u2019, init, false);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&lt;\/script&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&lt;\/body&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&lt;\/html&gt;<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">T\u1ea1m K\u1ebft\u00a0<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Nh\u01b0 v\u1eady, ch\u00fang t\u00f4i \u0111\u00e3 h\u01b0\u1edbng d\u1eabn ba c\u00e1ch t\u1ea1o <\/span><b>code tr\u00e1i tim<\/b><span style=\"font-weight: 400;\"> ngh\u1ec7 thu\u1eadt cho c\u00e1c b\u1ea1n tham kh\u1ea3o. Hy v\u1ecdng h\u01b0\u1edbng d\u1eabn tr\u00ean gi\u00fap m\u1ecdi ng\u01b0\u1eddi t\u1ea1o n\u00ean m\u00f3n qu\u00e0 \u00fd ngh\u0129a d\u00e0nh t\u1eb7ng m\u1ed9t n\u1eeda y\u00eau th\u01b0\u01a1ng. H\u00e3y b\u1ea5m theo d\u00f5i fanpage <\/span><b>Ho\u00e0ng H\u00e0 Mobile<\/b><span style=\"font-weight: 400;\"> v\u00e0 k\u00eanh Youtube <\/span><b>Ho\u00e0ng H\u00e0 Channel<\/b><span style=\"font-weight: 400;\"> \u0111\u1ec3 kh\u00f4ng b\u1ecf qua th\u00f4ng tin th\u00fa v\u1ecb nh\u00e9!\u00a0<\/span><\/p>\n<p><strong>XEM TH\u00caM:\u00a0<\/strong><\/p>\n<ul>\n<li><strong><a href=\"https:\/\/hoanghamobile.com\/tin-tuc\/hinh-nen-trai-tim\/\">H\u00ecnh n\u1ec1n tr\u00e1i tim: BST c\u00e1c m\u1eabu h\u00ecnh n\u1ec1n n\u1ed5i b\u1eadt v\u00e0 l\u00e3ng m\u1ea1n<\/a><\/strong><\/li>\n<li><strong><a href=\"https:\/\/hoanghamobile.com\/tin-tuc\/bst-50-anh-nen-trang-chat-luong-cao-moi-nhat\/\">BST 50 \u1ea2nh n\u1ec1n tr\u1eafng ch\u1ea5t l\u01b0\u1ee3ng cao m\u1edbi nh\u1ea5t<\/a><\/strong><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Code tr\u00e1i tim l\u00e0 m\u1ed9t trend b\u1eaft ngu\u1ed3n t\u1eeb b\u1ed9 phim \u201cTh\u1eafp s\u00e1ng anh, s\u01b0\u1edfi \u1ea5m em\u201d. Theo \u0111\u00f3, m\u1ecdi ng\u01b0\u1eddi ch\u1ec9 c\u1ea7n l\u00e0m theo \u0111o\u1ea1n code n\u00e0y \u0111\u1ec3 t\u1ea1o n\u00ean t\u00e1c ph\u1ea9m tr\u00e1i tim d\u00e0nh t\u1eb7ng n\u1eeda y\u00eau th\u01b0\u01a1ng. B\u00e0i vi\u1ebft d\u01b0\u1edbi \u0111\u00e2y, Ho\u00e0ng H\u00e0 Mobile s\u1ebd t\u1ed5ng h\u1ee3p nh\u1eefng c\u00e1ch vi\u1ebft code t\u1ea1o [&hellip;]<\/p>\n","protected":false},"author":73,"featured_media":291047,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-289666","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thu-thuat"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v24.2 (Yoast SEO v24.2) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>3 c\u00e1ch t\u1ea1o code tr\u00e1i tim \u0111\u01a1n gi\u1ea3n t\u1eb7ng m\u1ed9t n\u1eeda y\u00eau th\u01b0\u01a1ng<\/title>\n<meta name=\"description\" content=\"C\u00e1ch vi\u1ebft code tr\u00e1i tim \u0111\u01b0\u1ee3c th\u1ef1c hi\u1ec7n nh\u01b0 th\u1ebf n\u00e0o? H\u00e3y theo d\u00f5i b\u00e0i vi\u1ebft d\u01b0\u1edbi \u0111\u00e2y c\u1ee7a Ho\u00e0ng H\u00e0 Mobile \u0111\u1ec3 \u0111\u01b0\u1ee3c h\u01b0\u1edbng d\u1eabn nh\u00e9!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/\" \/>\n<meta property=\"og:locale\" content=\"vi_VN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"3 c\u00e1ch t\u1ea1o code tr\u00e1i tim \u0111\u01a1n gi\u1ea3n t\u1eb7ng m\u1ed9t n\u1eeda y\u00eau th\u01b0\u01a1ng\" \/>\n<meta property=\"og:description\" content=\"C\u00e1ch vi\u1ebft code tr\u00e1i tim \u0111\u01b0\u1ee3c th\u1ef1c hi\u1ec7n nh\u01b0 th\u1ebf n\u00e0o? H\u00e3y theo d\u00f5i b\u00e0i vi\u1ebft d\u01b0\u1edbi \u0111\u00e2y c\u1ee7a Ho\u00e0ng H\u00e0 Mobile \u0111\u1ec3 \u0111\u01b0\u1ee3c h\u01b0\u1edbng d\u1eabn nh\u00e9!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/\" \/>\n<meta property=\"og:site_name\" content=\"Tin t\u1ee9c c\u00f4ng ngh\u1ec7 - HoangHaMobile\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/hoanghamobilecom\" \/>\n<meta property=\"article:published_time\" content=\"2023-11-30T09:03:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2023\/11\/code-trai-tim.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"H\u1ed3ng Th\u01a1\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi\" \/>\n\t<meta name=\"twitter:data1\" content=\"H\u1ed3ng Th\u01a1\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc\" \/>\n\t<meta name=\"twitter:data2\" content=\"16 ph\u00fat\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/\"},\"author\":{\"name\":\"H\u1ed3ng Th\u01a1\",\"@id\":\"https:\/\/hoanghamobile.com\/tin-tuc\/#\/schema\/person\/6db3b2e6d8fb7f2e308c4625aeaa7dc2\"},\"headline\":\"3 c\u00e1ch t\u1ea1o code tr\u00e1i tim \u0111\u01a1n gi\u1ea3n t\u1eb7ng m\u1ed9t n\u1eeda y\u00eau th\u01b0\u01a1ng\",\"datePublished\":\"2023-11-30T09:03:50+00:00\",\"dateModified\":\"2023-11-30T09:03:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/\"},\"wordCount\":3340,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/hoanghamobile.com\/tin-tuc\/#organization\"},\"image\":{\"@id\":\"https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2023\/11\/code-trai-tim.jpg\",\"articleSection\":[\"Th\u1ee7 thu\u1eadt\"],\"inLanguage\":\"vi\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/#respond\"]}],\"copyrightYear\":\"2023\",\"copyrightHolder\":{\"@id\":\"https:\/\/hoanghamobile.com\/tin-tuc\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/\",\"url\":\"https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/\",\"name\":\"3 c\u00e1ch t\u1ea1o code tr\u00e1i tim \u0111\u01a1n gi\u1ea3n t\u1eb7ng m\u1ed9t n\u1eeda y\u00eau th\u01b0\u01a1ng\",\"isPartOf\":{\"@id\":\"https:\/\/hoanghamobile.com\/tin-tuc\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2023\/11\/code-trai-tim.jpg\",\"datePublished\":\"2023-11-30T09:03:50+00:00\",\"dateModified\":\"2023-11-30T09:03:50+00:00\",\"description\":\"C\u00e1ch vi\u1ebft code tr\u00e1i tim \u0111\u01b0\u1ee3c th\u1ef1c hi\u1ec7n nh\u01b0 th\u1ebf n\u00e0o? H\u00e3y theo d\u00f5i b\u00e0i vi\u1ebft d\u01b0\u1edbi \u0111\u00e2y c\u1ee7a Ho\u00e0ng H\u00e0 Mobile \u0111\u1ec3 \u0111\u01b0\u1ee3c h\u01b0\u1edbng d\u1eabn nh\u00e9!\",\"breadcrumb\":{\"@id\":\"https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/#breadcrumb\"},\"inLanguage\":\"vi\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"vi\",\"@id\":\"https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/#primaryimage\",\"url\":\"https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2023\/11\/code-trai-tim.jpg\",\"contentUrl\":\"https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2023\/11\/code-trai-tim.jpg\",\"width\":1200,\"height\":628,\"caption\":\"code-trai-tim\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Trang ch\u1ee7\",\"item\":\"https:\/\/hoanghamobile.com\/tin-tuc\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Th\u1ee7 thu\u1eadt\",\"item\":\"https:\/\/hoanghamobile.com\/tin-tuc\/category\/thu-thuat\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"3 c\u00e1ch t\u1ea1o code tr\u00e1i tim \u0111\u01a1n gi\u1ea3n t\u1eb7ng m\u1ed9t n\u1eeda y\u00eau th\u01b0\u01a1ng\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/hoanghamobile.com\/tin-tuc\/#website\",\"url\":\"https:\/\/hoanghamobile.com\/tin-tuc\/\",\"name\":\"Tin t\u1ee9c c\u00f4ng ngh\u1ec7 - HoangHaMobile\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/hoanghamobile.com\/tin-tuc\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/hoanghamobile.com\/tin-tuc\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"vi\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/hoanghamobile.com\/tin-tuc\/#organization\",\"name\":\"Tin t\u1ee9c c\u00f4ng ngh\u1ec7 - HoangHaMobile\",\"url\":\"https:\/\/hoanghamobile.com\/tin-tuc\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"vi\",\"@id\":\"https:\/\/hoanghamobile.com\/tin-tuc\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2021\/12\/logo-text.png\",\"contentUrl\":\"https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2021\/12\/logo-text.png\",\"width\":256,\"height\":37,\"caption\":\"Tin t\u1ee9c c\u00f4ng ngh\u1ec7 - HoangHaMobile\"},\"image\":{\"@id\":\"https:\/\/hoanghamobile.com\/tin-tuc\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/hoanghamobilecom\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/hoanghamobile.com\/tin-tuc\/#\/schema\/person\/6db3b2e6d8fb7f2e308c4625aeaa7dc2\",\"name\":\"H\u1ed3ng Th\u01a1\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"vi\",\"@id\":\"https:\/\/hoanghamobile.com\/tin-tuc\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b74c49ea2aa5069714f9b552602efd03?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b74c49ea2aa5069714f9b552602efd03?s=96&d=mm&r=g\",\"caption\":\"H\u1ed3ng Th\u01a1\"},\"description\":\"M\u00ecnh l\u00e0 Th\u01a1 - c\u00f4 g\u00e1i \u0111am m\u00ea vi\u1ebft l\u00e1ch, th\u00edch tr\u1ea3i nghi\u1ec7m nh\u1eefng s\u1ea3n ph\u1ea9m c\u00f4ng ngh\u1ec7 m\u1edbi!\",\"url\":\"https:\/\/hoanghamobile.com\/tin-tuc\/author\/hong-tho\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"3 c\u00e1ch t\u1ea1o code tr\u00e1i tim \u0111\u01a1n gi\u1ea3n t\u1eb7ng m\u1ed9t n\u1eeda y\u00eau th\u01b0\u01a1ng","description":"C\u00e1ch vi\u1ebft code tr\u00e1i tim \u0111\u01b0\u1ee3c th\u1ef1c hi\u1ec7n nh\u01b0 th\u1ebf n\u00e0o? H\u00e3y theo d\u00f5i b\u00e0i vi\u1ebft d\u01b0\u1edbi \u0111\u00e2y c\u1ee7a Ho\u00e0ng H\u00e0 Mobile \u0111\u1ec3 \u0111\u01b0\u1ee3c h\u01b0\u1edbng d\u1eabn nh\u00e9!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/","og_locale":"vi_VN","og_type":"article","og_title":"3 c\u00e1ch t\u1ea1o code tr\u00e1i tim \u0111\u01a1n gi\u1ea3n t\u1eb7ng m\u1ed9t n\u1eeda y\u00eau th\u01b0\u01a1ng","og_description":"C\u00e1ch vi\u1ebft code tr\u00e1i tim \u0111\u01b0\u1ee3c th\u1ef1c hi\u1ec7n nh\u01b0 th\u1ebf n\u00e0o? H\u00e3y theo d\u00f5i b\u00e0i vi\u1ebft d\u01b0\u1edbi \u0111\u00e2y c\u1ee7a Ho\u00e0ng H\u00e0 Mobile \u0111\u1ec3 \u0111\u01b0\u1ee3c h\u01b0\u1edbng d\u1eabn nh\u00e9!","og_url":"https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/","og_site_name":"Tin t\u1ee9c c\u00f4ng ngh\u1ec7 - HoangHaMobile","article_publisher":"https:\/\/www.facebook.com\/hoanghamobilecom","article_published_time":"2023-11-30T09:03:50+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2023\/11\/code-trai-tim.jpg","type":"image\/jpeg"}],"author":"H\u1ed3ng Th\u01a1","twitter_card":"summary_large_image","twitter_misc":{"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi":"H\u1ed3ng Th\u01a1","\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc":"16 ph\u00fat"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/#article","isPartOf":{"@id":"https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/"},"author":{"name":"H\u1ed3ng Th\u01a1","@id":"https:\/\/hoanghamobile.com\/tin-tuc\/#\/schema\/person\/6db3b2e6d8fb7f2e308c4625aeaa7dc2"},"headline":"3 c\u00e1ch t\u1ea1o code tr\u00e1i tim \u0111\u01a1n gi\u1ea3n t\u1eb7ng m\u1ed9t n\u1eeda y\u00eau th\u01b0\u01a1ng","datePublished":"2023-11-30T09:03:50+00:00","dateModified":"2023-11-30T09:03:50+00:00","mainEntityOfPage":{"@id":"https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/"},"wordCount":3340,"commentCount":0,"publisher":{"@id":"https:\/\/hoanghamobile.com\/tin-tuc\/#organization"},"image":{"@id":"https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/#primaryimage"},"thumbnailUrl":"https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2023\/11\/code-trai-tim.jpg","articleSection":["Th\u1ee7 thu\u1eadt"],"inLanguage":"vi","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/#respond"]}],"copyrightYear":"2023","copyrightHolder":{"@id":"https:\/\/hoanghamobile.com\/tin-tuc\/#organization"}},{"@type":"WebPage","@id":"https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/","url":"https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/","name":"3 c\u00e1ch t\u1ea1o code tr\u00e1i tim \u0111\u01a1n gi\u1ea3n t\u1eb7ng m\u1ed9t n\u1eeda y\u00eau th\u01b0\u01a1ng","isPartOf":{"@id":"https:\/\/hoanghamobile.com\/tin-tuc\/#website"},"primaryImageOfPage":{"@id":"https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/#primaryimage"},"image":{"@id":"https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/#primaryimage"},"thumbnailUrl":"https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2023\/11\/code-trai-tim.jpg","datePublished":"2023-11-30T09:03:50+00:00","dateModified":"2023-11-30T09:03:50+00:00","description":"C\u00e1ch vi\u1ebft code tr\u00e1i tim \u0111\u01b0\u1ee3c th\u1ef1c hi\u1ec7n nh\u01b0 th\u1ebf n\u00e0o? H\u00e3y theo d\u00f5i b\u00e0i vi\u1ebft d\u01b0\u1edbi \u0111\u00e2y c\u1ee7a Ho\u00e0ng H\u00e0 Mobile \u0111\u1ec3 \u0111\u01b0\u1ee3c h\u01b0\u1edbng d\u1eabn nh\u00e9!","breadcrumb":{"@id":"https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/#breadcrumb"},"inLanguage":"vi","potentialAction":[{"@type":"ReadAction","target":["https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/"]}]},{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/#primaryimage","url":"https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2023\/11\/code-trai-tim.jpg","contentUrl":"https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2023\/11\/code-trai-tim.jpg","width":1200,"height":628,"caption":"code-trai-tim"},{"@type":"BreadcrumbList","@id":"https:\/\/hoanghamobile.com\/tin-tuc\/code-trai-tim\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Trang ch\u1ee7","item":"https:\/\/hoanghamobile.com\/tin-tuc\/"},{"@type":"ListItem","position":2,"name":"Th\u1ee7 thu\u1eadt","item":"https:\/\/hoanghamobile.com\/tin-tuc\/category\/thu-thuat\/"},{"@type":"ListItem","position":3,"name":"3 c\u00e1ch t\u1ea1o code tr\u00e1i tim \u0111\u01a1n gi\u1ea3n t\u1eb7ng m\u1ed9t n\u1eeda y\u00eau th\u01b0\u01a1ng"}]},{"@type":"WebSite","@id":"https:\/\/hoanghamobile.com\/tin-tuc\/#website","url":"https:\/\/hoanghamobile.com\/tin-tuc\/","name":"Tin t\u1ee9c c\u00f4ng ngh\u1ec7 - HoangHaMobile","description":"","publisher":{"@id":"https:\/\/hoanghamobile.com\/tin-tuc\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/hoanghamobile.com\/tin-tuc\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"vi"},{"@type":"Organization","@id":"https:\/\/hoanghamobile.com\/tin-tuc\/#organization","name":"Tin t\u1ee9c c\u00f4ng ngh\u1ec7 - HoangHaMobile","url":"https:\/\/hoanghamobile.com\/tin-tuc\/","logo":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/hoanghamobile.com\/tin-tuc\/#\/schema\/logo\/image\/","url":"https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2021\/12\/logo-text.png","contentUrl":"https:\/\/hoanghamobile.com\/tin-tuc\/wp-content\/uploads\/2021\/12\/logo-text.png","width":256,"height":37,"caption":"Tin t\u1ee9c c\u00f4ng ngh\u1ec7 - HoangHaMobile"},"image":{"@id":"https:\/\/hoanghamobile.com\/tin-tuc\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/hoanghamobilecom"]},{"@type":"Person","@id":"https:\/\/hoanghamobile.com\/tin-tuc\/#\/schema\/person\/6db3b2e6d8fb7f2e308c4625aeaa7dc2","name":"H\u1ed3ng Th\u01a1","image":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/hoanghamobile.com\/tin-tuc\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b74c49ea2aa5069714f9b552602efd03?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b74c49ea2aa5069714f9b552602efd03?s=96&d=mm&r=g","caption":"H\u1ed3ng Th\u01a1"},"description":"M\u00ecnh l\u00e0 Th\u01a1 - c\u00f4 g\u00e1i \u0111am m\u00ea vi\u1ebft l\u00e1ch, th\u00edch tr\u1ea3i nghi\u1ec7m nh\u1eefng s\u1ea3n ph\u1ea9m c\u00f4ng ngh\u1ec7 m\u1edbi!","url":"https:\/\/hoanghamobile.com\/tin-tuc\/author\/hong-tho\/"}]}},"_links":{"self":[{"href":"https:\/\/hoanghamobile.com\/tin-tuc\/wp-json\/wp\/v2\/posts\/289666","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hoanghamobile.com\/tin-tuc\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hoanghamobile.com\/tin-tuc\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hoanghamobile.com\/tin-tuc\/wp-json\/wp\/v2\/users\/73"}],"replies":[{"embeddable":true,"href":"https:\/\/hoanghamobile.com\/tin-tuc\/wp-json\/wp\/v2\/comments?post=289666"}],"version-history":[{"count":0,"href":"https:\/\/hoanghamobile.com\/tin-tuc\/wp-json\/wp\/v2\/posts\/289666\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hoanghamobile.com\/tin-tuc\/wp-json\/wp\/v2\/media\/291047"}],"wp:attachment":[{"href":"https:\/\/hoanghamobile.com\/tin-tuc\/wp-json\/wp\/v2\/media?parent=289666"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hoanghamobile.com\/tin-tuc\/wp-json\/wp\/v2\/categories?post=289666"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hoanghamobile.com\/tin-tuc\/wp-json\/wp\/v2\/tags?post=289666"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}