{"id":9869,"date":"2022-01-03T07:00:24","date_gmt":"2022-01-02T22:00:24","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=9869"},"modified":"2022-01-03T03:19:05","modified_gmt":"2022-01-02T18:19:05","slug":"javascript-canvas-%e3%81%a7%e7%89%b9%e5%ae%9a%e3%81%ae%e8%89%b2%e3%81%a0%e3%81%91%e5%a4%89%e6%9b%b4%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=9869","title":{"rendered":"JavaScript + Canvas \u3067\u7279\u5b9a\u306e\u8272\u3060\u3051\u5909\u66f4\u3059\u308b"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u79c1\u306f\u30d5\u30a1\u30c3\u30b7\u30e7\u30f3\u304c\u5f97\u610f\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u304c\u3001\u5c11\u3057\u3067\u3082\u591a\u304f\u306e\u4eba\u306b\u5370\u8c61\u3092\u6b8b\u3057\u305f\u3044\u3068\u3044\u3046\u3053\u3068\u3067\u30dc\u30c8\u30e0\uff08\u30d1\u30f3\u30c4\uff1f\uff09\u306e\u8272\u306f\u8d64\u3067\u56fa\u5b9a\u306b\u3057\u3066\u3044\u307e\u3059\u3002\uff08\u8d64\u306f\u597d\u304d\u3067\u3059\u3057\u3001\u30db\u30f3\u30c8\u898b\u305f\u76ee\u306b\u7279\u5fb4\u304c\u306a\u3044\u306e\u3067\u2026\uff09<\/p>\n<p>\u3053\u308c\u306f\u3001\u305f\u304f\u3055\u3093\u30a8\u30cd\u30eb\u30ae\u30fc\u3092\u4f7f\u3046\u3068\u8a00\u308f\u308c\u3066\u3044\u308b<strong>\u300c\u610f\u601d\u6c7a\u5b9a\u300d\u3092\u65e5\u5e38\u304b\u3089\u5c11\u3057\u3067\u3082\u6e1b\u3089\u3059<\/strong>\u5f79\u5272\u3082\u3042\u308a\u307e\u3059\u3002\uff08\u30b9\u30c6\u30a3\u30fc\u30d6\u30fb\u30b8\u30e7\u30d6\u30ba\u304c\u540c\u3058\u670d\u3092\u7740\u3066\u305f\u306e\u306f\u3001\u3053\u308c\u3068\u540c\u3058\u7406\u7531\u304b\u3089\u3060\u3068\u3044\u3046\u8aac\u304c\u3042\u308a\u307e\u3059\u3088\u306d\uff09<\/p>\n<p>\u305d\u308c\u306f\u826f\u3044\u306e\u3067\u3059\u304c\u3001\u5148\u307b\u3069\u8a00\u3044\u307e\u3057\u305f\u3068\u304a\u308a\u30d5\u30a1\u30c3\u30b7\u30e7\u30f3\u306b\u660e\u308b\u304f\u306a\u3044\u306e\u3067\u3001\u30cd\u30c3\u30c8\u30b7\u30e7\u30c3\u30d4\u30f3\u30b0\u3092\u3057\u3066\u3044\u3066\u56f0\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u306f\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb\u300c\u8d64\u3044\u30dc\u30c8\u30e0\u306e\u5199\u771f\u300d\u3067\u3057\u304b\u3001<\/p>\n<p><strong style=\"font-size: 35px;\">\u4ed5\u4e0a\u304c\u308a\u304c\u30a4\u30e1\u30fc\u30b8\u304c\u3067\u304d\u306a\u3044\ud83d\ude05<\/strong><\/p>\n<p>\u3053\u3068\u3067\u3059\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u3053\u308c\u307e\u3067\u306f\u3044\u3061\u3044\u3061\u753b\u50cf\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u753b\u50cf\u30bd\u30d5\u30c8\u3067\u30dc\u30c8\u30e0\u3092\u8d64\u306b\u5857\u308a\u76f4\u3057\u3066\u78ba\u8a8d\u3057\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u3057\u304b\u3057\u3001\u305d\u308c\u306f\u679c\u3066\u3057\u306a\u304f\u3081\u3093\u3069\u304f\u3055\u3044\u3093\u3067\u3059\u2026\u3002<\/p>\n<p>\u305d\u3053\u3067\u2757<\/p>\n<p>\u305b\u3063\u304b\u304f\u30a8\u30f3\u30b8\u30cb\u30a2\u306a\u306e\u3067\u4f55\u304b\u3067\u304d\u306a\u3044\u3060\u308d\u3046\u304b\u3001\u3068\u8003\u3048\u3066\u3044\u305f\u3068\u3053\u308d\u601d\u3044\u3064\u304d\u307e\u3057\u305f\u3002<\/p>\n<p><strong style=\"font-size: 35px;\">Canvas \u3092\u4f7f\u3048\u3070\u3067\u304d\u308b\u3058\u3083\u306a\u3044\u304b<\/strong><\/p>\n<p>\u3068\u3002<\/p>\n<p>\u305d\u3053\u3067\u2757<\/p>\n<p>\u4eca\u56de\u306f<code>JavaScript + Canvas<\/code>\u3067\u300c<strong>\u6307\u5b9a\u3057\u305f\u8272\u3060\u3051\u5857\u308a\u3064\u3076\u3059\u3053\u3068\u304c\u3067\u304d\u308b<\/strong>\u300d\u6a5f\u80fd\u3092\u3064\u304f\u3063\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u4f55\u304b\u306e\u53c2\u8003\u306b\u306a\u308a\u307e\u3057\u305f\u3089\u5b09\u3057\u3044\u3067\u3059\ud83d\ude04\u2728<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6068 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_12.png\" alt=\"\" width=\"226\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_12.png 226w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_12-212x300.png 212w\" sizes=\"auto, (max-width: 226px) 100vw, 226px\" \/>\u300c2021\u5e74\u306e\u7d2f\u8a08PV\u304c<br \/>\n100\u4e07\u3092\u8d85\u3048\u307e\u3057\u305f\u2757<br \/>\n\u7686\u3055\u3093\u30db\u30f3\u30c8\u306b\u3044\u3064\u3082<br \/>\n\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3059\u2728\u300d<\/p>\n<p><strong>\u958b\u767a\u74b0\u5883\uff1a<\/strong> Vue 3<\/p>\n<h1>\u3084\u308a\u305f\u3044\u3053\u3068<\/h1>\n<p>\u3067\u306f\u3001\u307e\u305a\u306f\u3084\u308a\u305f\u3044\u3053\u3068\u3067\u3059\u304c\u3001\u4ee5\u4e0b\uff14\u70b9\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u3092\u9078\u629e\u3057\u3066\u30d7\u30ec\u30d3\u30e5\u30fc\u8868\u793a\u3059\u308b<\/li>\n<li>\u5bfe\u8c61\u306b\u3059\u308b\u8272\u3001\u5857\u308a\u3064\u3076\u3059\u8272\u306f\u5909\u66f4\u3067\u304d\u308b<\/li>\n<li>\u753b\u50cf\u4e0a\u3092\u30c0\u30d6\u30eb\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u305d\u306e\u8272\u3092\u53d6\u5f97\u3067\u304d\u308b<\/li>\n<li>\u9078\u629e\u3057\u305f\u8272\u306b\u300c\u8fd1\u3044\u8272\u300d\u3060\u3051\u5857\u308a\u3064\u3076\u3059<\/li>\n<\/ul>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b\u4f5c\u696d\u306b\u79fb\u308a\u307e\u3057\u3087\u3046\u2757<\/p>\n<h1>\u5b9f\u969b\u306e\u30b3\u30fc\u30c9<\/h1>\n<p>\u4eca\u56de\u306f<code>JavaScript + HTML<\/code>\u3060\u3051\u3067\u3059\u306e\u3067\u3001\uff11\u30d5\u30a1\u30a4\u30eb\u3067\u5b8c\u4e86\u3067\u304d\u307e\u3059\u3002<br \/>\n\u307e\u305a\u306f\u5b9f\u969b\u306e\u30b3\u30fc\u30c9\u3067\u3059\u3002<\/p>\n<pre><strong>&lt;html&gt;<\/strong>\r\n<strong>&lt;head&gt;<\/strong>\r\n<strong>    &lt;link href=\"https:\/\/cdn.jsdelivr.net\/npm\/bootstrap@5.0.1\/dist\/css\/bootstrap.min.css\" rel=\"stylesheet\"&gt;<\/strong>\r\n<strong>    &lt;style&gt;<\/strong>\r\n\r\n<strong>        #canvas {<\/strong>\r\n\r\n<strong>            cursor: crosshair;<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n<strong>    &lt;\/style&gt;<\/strong>\r\n<strong>&lt;\/head&gt;<\/strong>\r\n<strong>&lt;body&gt;<\/strong>\r\n<strong>&lt;div id=\"app\" class=\"p-5\"&gt;<\/strong>\r\n<strong>    &lt;div class=\"h3\"&gt;\u30ad\u30e3\u30f3\u30d0\u30b9\u306e\u7279\u5b9a\u8272\u3092\u5909\u66f4\u3059\u308b\u30b5\u30f3\u30d7\u30eb&lt;\/div&gt;<\/strong>\r\n<strong>    &lt;label class=\"btn btn-primary\"&gt;<\/strong>\r\n<strong>        \u753b\u50cf\u3092\u9078\u629e\u3059\u308b<\/strong>\r\n<strong>        &lt;input type=\"file\" accept=\"image\/*\" class=\"d-none\" @change=\"onFileChange\"&gt;<\/strong>\r\n<strong>    &lt;\/label&gt;<\/strong>\r\n<strong>    &lt;hr&gt;<\/strong>\r\n<strong>    \u30d7\u30ec\u30d3\u30e5\u30fc\u753b\u50cf&lt;br&gt;<\/strong>\r\n<strong>    &lt;canvas<\/strong>\r\n<strong>        id=\"canvas\"<\/strong>\r\n<strong>        class=\"mb-5\"<\/strong>\r\n<strong>        width=\"0\"<\/strong>\r\n<strong>        height=\"0\"<\/strong>\r\n<strong>        @dblclick=\"onCanvasDoubleClick($event)\"<\/strong>\r\n<strong>        @mousedown=\"onMouseDown\"<\/strong>\r\n<strong>        @mouseup=\"onMouseUp\"<\/strong>\r\n<strong>        @mousemove=\"onMouseMove($event)\"&gt;&lt;\/canvas&gt;<\/strong>\r\n<strong>    &lt;div class=\"row\"&gt;<\/strong>\r\n<strong>        &lt;div class=\"col-3\"&gt;<\/strong>\r\n<strong>            &lt;div class=\"h5\"&gt;\u3069\u306e\u8272\u3092\uff1f&lt;\/div&gt;<\/strong>\r\n<strong>            &lt;input type=\"color\" v-model=\"colors.from\"&gt;<\/strong>\r\n<strong>            &lt;br&gt;<\/strong>\r\n<strong>            &lt;small&gt;<\/strong>\r\n<strong>                \u753b\u50cf\u4e0a\u3092\u30c0\u30d6\u30eb\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u8272\u3092\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002<\/strong>\r\n<strong>            &lt;\/small&gt;<\/strong>\r\n<strong>        &lt;\/div&gt;<\/strong>\r\n<strong>        &lt;div class=\"col-3\"&gt;<\/strong>\r\n<strong>            &lt;div class=\"h5\"&gt;\u3069\u306e\u8272\u3078\u5909\u3048\u308b\uff1f&lt;\/div&gt;<\/strong>\r\n<strong>            &lt;input type=\"color\" v-model=\"colors.to\"&gt;<\/strong>\r\n<strong>        &lt;\/div&gt;<\/strong>\r\n<strong>    &lt;\/div&gt;<\/strong>\r\n<strong>&lt;\/div&gt;<\/strong>\r\n<strong>&lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/@popperjs\/core@2.9.2\/dist\/umd\/popper.min.js\"&gt;&lt;\/script&gt;<\/strong>\r\n<strong>&lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/bootstrap@5.0.1\/dist\/js\/bootstrap.min.js\"&gt;&lt;\/script&gt;<\/strong>\r\n<strong>&lt;script src=\"https:\/\/unpkg.com\/vue@3.1.1\/dist\/vue.global.prod.js\"&gt;&lt;\/script&gt;<\/strong>\r\n<strong>&lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/axios\/0.21.1\/axios.min.js\"&gt;&lt;\/script&gt;<\/strong>\r\n<strong>&lt;script&gt;<\/strong>\r\n\r\n<strong>    Vue.createApp({<\/strong>\r\n<strong>        data() {<\/strong>\r\n<strong>            return {<\/strong>\r\n<strong>                canvas: null,<\/strong>\r\n<strong>                ctx: null,<\/strong>\r\n<strong>                colors: {<\/strong>\r\n<strong>                    from: '#ffffff',<\/strong>\r\n<strong>                    to: '#BC0C23'<\/strong>\r\n<strong>                },<\/strong>\r\n<strong>                threshold: 30, \/\/ \u5404\u8272\u304c\u30d7\u30e9\u30b9\u30de\u30a4\u30ca\u30b9\u3053\u306e\u6570\u5b57\u4ee5\u5185\u306a\u3089\u300c\u4f3c\u3066\u3044\u308b\u300d\u3068\u5224\u65ad\u3059\u308b,<\/strong>\r\n<strong>                drawingLength: 30, \/\/ \u8272\u3092\u5909\u3048\u308b\u7bc4\u56f2\uff08px\uff09<\/strong>\r\n<strong>                isDragging: false<\/strong>\r\n<strong>            }<\/strong>\r\n<strong>        },<\/strong>\r\n<strong>        methods: {<\/strong>\r\n<strong>            isSimilarColor(color1, color2) { \/\/ \u2460 \u8272\u304c\u4f3c\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u30c1\u30a7\u30c3\u30af\u3059\u308b<\/strong>\r\n\r\n<strong>                const keys = ['red', 'green', 'blue'];<\/strong>\r\n<strong>                let results = [];<\/strong>\r\n\r\n<strong>                keys.forEach(key =&gt; {<\/strong>\r\n\r\n<strong>                    const colorPart1 = color1[key];<\/strong>\r\n<strong>                    const colorPart2 = color2[key];<\/strong>\r\n<strong>                    const minColor = colorPart1 - this.threshold;<\/strong>\r\n<strong>                    const maxColor = colorPart1 + this.threshold;<\/strong>\r\n<strong>                    const result = (colorPart2 &gt;= minColor &amp;&amp; colorPart2 &lt;= maxColor);<\/strong>\r\n<strong>                    results.push(result);<\/strong>\r\n\r\n<strong>                });<\/strong>\r\n\r\n<strong>                return !results.includes(false);<\/strong>\r\n\r\n<strong>            },<\/strong>\r\n<strong>            onFileChange(e) { \/\/ \u2461 \u30d5\u30a1\u30a4\u30eb\u304c\u9078\u629e\u3055\u308c\u305f\u3089\u753b\u50cf\u3092\u30d7\u30ec\u30d3\u30e5\u30fc\u8868\u793a\u3059\u308b<\/strong>\r\n\r\n<strong>                const files = e.target.files;<\/strong>\r\n\r\n<strong>                if(files.length &gt; 0) {<\/strong>\r\n\r\n<strong>                    const file = files[0];<\/strong>\r\n<strong>                    const reader = new FileReader();<\/strong>\r\n<strong>                    reader.onload = e =&gt; {<\/strong>\r\n\r\n<strong>                        let image = new Image();<\/strong>\r\n<strong>                        image.onload = () =&gt; {<\/strong>\r\n\r\n<strong>                            const width = image.width;<\/strong>\r\n<strong>                            const height = image.height;<\/strong>\r\n<strong>                            this.canvas.width = width;<\/strong>\r\n<strong>                            this.canvas.height = height;<\/strong>\r\n<strong>                            this.ctx.drawImage(image, 0, 0, width, height);<\/strong>\r\n\r\n<strong>                        }<\/strong>\r\n<strong>                        image.src = e.target.result;<\/strong>\r\n\r\n<strong>                    };<\/strong>\r\n<strong>                    reader.readAsDataURL(file);<\/strong>\r\n\r\n<strong>                }<\/strong>\r\n\r\n<strong>            },<\/strong>\r\n<strong>            onCanvasDoubleClick(e) { \/\/ \u2462 \u30d7\u30ec\u30d3\u30e5\u30fc\u753b\u50cf\u4e0a\u3092\u30c0\u30d6\u30eb\u30af\u30ea\u30c3\u30af\u3055\u308c\u305f\u3089\u3001\u305d\u306e\u4f4d\u7f6e\u306e\u8272\u3092\u53d6\u5f97\u3059\u308b<\/strong>\r\n\r\n<strong>                const x = e.layerX;<\/strong>\r\n<strong>                const y = e.layerY;<\/strong>\r\n<strong>                const imageData = this.ctx.getImageData(x, y, 1, 1);<\/strong>\r\n<strong>                this.colors.from = this.rgbToHex(imageData.data[0], imageData.data[1], imageData.data[2]);<\/strong>\r\n<strong>                window.getSelection().empty();<\/strong>\r\n\r\n<strong>            },<\/strong>\r\n<strong>            onMouseDown() { \/\/ \u2463 \u30de\u30a6\u30b9\u304c\u62bc\u3055\u308c\u305f\u3089\u3001\u30de\u30a6\u30b9\u30c9\u30e9\u30c3\u30b0\u4e2d<\/strong>\r\n\r\n<strong>                this.isDragging = true;<\/strong>\r\n\r\n<strong>            },<\/strong>\r\n<strong>            onMouseUp() { \/\/ \u2463 \u30de\u30a6\u30b9\u304c\u96e2\u3055\u308c\u305f\u3089\u3001\u30de\u30a6\u30b9\u30c9\u30e9\u30c3\u30b0\u4e2d\u3067\u306f\u306a\u3044<\/strong>\r\n\r\n<strong>                this.isDragging = false;<\/strong>\r\n\r\n<strong>            },<\/strong>\r\n<strong>            onMouseMove(e) { \/\/ \u2464 \u30de\u30a6\u30b9\u30c9\u30e9\u30c3\u30b0\u4e2d\u306b\u79fb\u52d5\u3057\u305f\u3089\u3001\u5bfe\u8c61\u306e\u8272\u306e\u307f\u5909\u66f4\u3059\u308b<\/strong>\r\n\r\n<strong>                if(this.isDragging === true) {<\/strong>\r\n\r\n<strong>                    const drawingLength = this.drawingLength;<\/strong>\r\n<strong>                    const mouseX = e.layerX;<\/strong>\r\n<strong>                    const mouseY = e.layerY;<\/strong>\r\n<strong>                    const minX = Math.max(0, mouseX - drawingLength);<\/strong>\r\n<strong>                    const maxX = Math.min(this.canvas.width, mouseX + drawingLength);<\/strong>\r\n<strong>                    const minY = Math.max(0, mouseY - drawingLength);<\/strong>\r\n<strong>                    const maxY = Math.min(this.canvas.height, mouseY + drawingLength);<\/strong>\r\n\r\n<strong>                    for(let x = minX ; x &lt;= maxX ; x++) {<\/strong>\r\n\r\n<strong>                        for(let y = minY ; y &lt;= maxY ; y++) {<\/strong>\r\n\r\n<strong>                            const imageData = this.ctx.getImageData(x, y, 1, 1);<\/strong>\r\n<strong>                            const currentColors = {<\/strong>\r\n<strong>                                red: imageData.data[0],<\/strong>\r\n<strong>                                green: imageData.data[1],<\/strong>\r\n<strong>                                blue: imageData.data[2]<\/strong>\r\n<strong>                            };<\/strong>\r\n<strong>                            const fromColors = this.hexToRgb(this.colors.from);<\/strong>\r\n<strong>                            const toColors = this.hexToRgb(this.colors.to);<\/strong>\r\n\r\n<strong>                            if(this.isSimilarColor(currentColors, fromColors)) {<\/strong>\r\n\r\n<strong>                                imageData.data[0] = toColors.red;<\/strong>\r\n<strong>                                imageData.data[1] = toColors.green;<\/strong>\r\n<strong>                                imageData.data[2] = toColors.blue;<\/strong>\r\n<strong>                                this.ctx.putImageData(imageData, x, y);<\/strong>\r\n\r\n<strong>                            }<\/strong>\r\n\r\n<strong>                        }<\/strong>\r\n\r\n<strong>                    }<\/strong>\r\n\r\n<strong>                }<\/strong>\r\n\r\n<strong>            },<\/strong>\r\n\r\n<strong>            \/\/ \u2465 16\u9032\u6570 \u2194 RGB \u5909\u63db<\/strong>\r\n<strong>            \/\/ from https:\/\/stackoverflow.com\/questions\/5623838\/rgb-to-hex-and-hex-to-rgb<\/strong>\r\n<strong>            hexToRgb(hex) {<\/strong>\r\n\r\n<strong>                const result = \/^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$\/i.exec(hex);<\/strong>\r\n\r\n<strong>                if(result) {<\/strong>\r\n\r\n<strong>                    return {<\/strong>\r\n<strong>                        red: parseInt(result[1], 16),<\/strong>\r\n<strong>                        green: parseInt(result[2], 16),<\/strong>\r\n<strong>                        blue: parseInt(result[3], 16)<\/strong>\r\n<strong>                    };<\/strong>\r\n\r\n<strong>                }<\/strong>\r\n\r\n<strong>                return null;<\/strong>\r\n\r\n<strong>            },<\/strong>\r\n<strong>            rgbToHex(r, g, b) {<\/strong>\r\n\r\n<strong>                return '#' + ((1 &lt;&lt; 24) + (r &lt;&lt; 16) + (g &lt;&lt; 8) + b)<\/strong>\r\n<strong>                    .toString(16)<\/strong>\r\n<strong>                    .slice(1);<\/strong>\r\n\r\n<strong>            }<\/strong>\r\n<strong>        },<\/strong>\r\n<strong>        mounted() {<\/strong>\r\n\r\n<strong>            \/\/ \u2466 \u3069\u3053\u304b\u3089\u3067\u3082Canvas\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u5909\u6570\u3078\u683c\u7d0d\u3059\u308b<\/strong>\r\n<strong>            this.canvas = document.querySelector('#canvas');<\/strong>\r\n<strong>            this.ctx = this.canvas.getContext('2d');<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n<strong>    }).mount('#app');<\/strong>\r\n\r\n<strong>&lt;\/script&gt;<\/strong>\r\n<strong>&lt;\/body&gt;<\/strong>\r\n<strong>&lt;\/html&gt;<\/strong><\/pre>\n<p>\u3067\u306f\u3001\u5c11\u3057\u30b3\u30fc\u30c9\u304c\u9577\u3044\u306e\u3067\u3072\u3068\u3064\u305a\u3064\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u2757<\/p>\n<h2>\u2460 \u8272\u304c\u4f3c\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u30c1\u30a7\u30c3\u30af\u3059\u308b<\/h2>\n<p>\u3053\u3053\u3067\u3001<code>color1<\/code>\u3068<code>color2<\/code>\u304c\u300c<strong>\u8fd1\u3044\u8272\u306a\u306e\u304b\u3069\u3046\u304b<\/strong>\u300d\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u5b9f\u969b\u306b\u306f\u3001<code>RBG<\/code>\uff13\u3064\u306e\u5024\u304c\u3057\u304d\u3044\u5024\uff08\u4eca\u56de\u306f<code>\u00b130<\/code>\uff09\u306e\u7bc4\u56f2\u5185\u306b\u5165\u3063\u3066\u3044\u308c\u3070\u4f3c\u3066\u3044\u308b\u3068\u5224\u5225\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001<code>threshold<\/code>\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u3067\u3053\u306e\u5224\u5225\u306e\u5f37\u5f31\u3092\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u306a\u304a\u3001\u6700\u5f8c\u306e<code>!results.includes()<\/code>\u306f\u3001<code>RBG<\/code>\u30c1\u30a7\u30c3\u30af\u306e\u7d50\u679c <strong>\u3072\u3068\u3064\u3067\u3082<code>false<\/code>\u304c\u5165\u3063\u3066\u3044\u308c\u3070\u3001<code>false<\/code><\/strong>\u304c\u5e30\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30d1\u30bf\u30fc\u30f3\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre>[<strong>false<\/strong>, <strong>false<\/strong>, <strong>false<\/strong>] \u2192 \u3082\u3061\u308d\u3093 false\r\n[<strong>false<\/strong>, true, <strong>false<\/strong>] \u2192 \uff12\u3064\u3082 false \u304c\u3042\u308b\u306e\u3067 false\r\n[<strong>false<\/strong>, true, true] \u2192 \u304a\u3057\u3044\u3051\u3069\u3001\uff11\u3064 false \u304c\u3042\u308b\u306e\u3067 false\r\n[true, true, true] \u2192 \u3053\u308c\u3060\u3051 <strong>true<\/strong> \u2728<\/pre>\n<h2>\u2461 \u30d5\u30a1\u30a4\u30eb\u304c\u9078\u629e\u3055\u308c\u305f\u3089\u753b\u50cf\u3092\u30d7\u30ec\u30d3\u30e5\u30fc\u8868\u793a\u3059\u308b<\/h2>\n<p>\u9078\u629e\u3055\u308c\u305f\u753b\u50cf\u3092<code>JavaScript<\/code>\u5185\u90e8\u3067\u547c\u3073\u51fa\u3057\u3001\u300c\u6a2a\u5e45\uff06\u9ad8\u3055\u300d\u3092\u53d6\u5f97\u3001\u3055\u3089\u306b<code>&lt;canvas&gt;&lt;\/canvas&gt;<\/code>\u30bf\u30b0\u306b\u305d\u306e\u753b\u50cf\u3092\u66f8\u304d\u8fbc\u3093\u3067\u3044\u307e\u3059\u3002<\/p>\n<p>\u306a\u304a\u3001<code>FileReader<\/code>\u306f\u975e\u540c\u671f\u51e6\u7406\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u2462 \u30d7\u30ec\u30d3\u30e5\u30fc\u753b\u50cf\u4e0a\u3092\u30c0\u30d6\u30eb\u30af\u30ea\u30c3\u30af\u3055\u308c\u305f\u3089\u3001\u305d\u306e\u4f4d\u7f6e\u306e\u8272\u3092\u53d6\u5f97\u3059\u308b<\/h2>\n<p>\u6d41\u308c\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n<ol>\n<li>\u30af\u30ea\u30c3\u30af\u3055\u308c\u305f\u4f4d\u7f6e\uff08X, Y\uff09\u3092\u53d6\u5f97<\/li>\n<li>\u305d\u306e\u4f4d\u7f6e\u306b\u3042\u308b\u8272\u3092\u30ad\u30e3\u30f3\u30d0\u30b9\u304b\u3089\u53d6\u5f97<\/li>\n<li>\u5909\u66f4\u5bfe\u8c61\u306e\u8272\u3068\u3057\u3066\u30bb\u30c3\u30c8<\/li>\n<\/ol>\n<p>\u3061\u306a\u307f\u306b\u3001\u6700\u5f8c\u306e<code>window.getSelection().empty();<\/code>\u306f\u30c0\u30d6\u30eb\u30af\u30ea\u30c3\u30af\u3057\u305f\u3068\u304d\u306b\u30c6\u30ad\u30b9\u30c8\u304c\u9078\u629e\u72b6\u614b\u306b\u306a\u308b\u306e\u304c\u6c17\u306b\u306a\u3063\u305f\u306e\u3067\u3064\u3051\u3066\u3044\u307e\u3059\u304c\u3001\u306a\u304f\u3066\u3082\u554f\u984c\u3042\u308a\u307e\u305b\u3093\u3002\uff08\u3053\u308cChrome\u3060\u3051\u304b\u306a\uff1f\uff1f\uff09<\/p>\n<h2>\u2463 \u30de\u30a6\u30b9\u304c\u62bc\u3055\u308c\u305f\u3089\u3001\u30de\u30a6\u30b9\u30c9\u30e9\u30c3\u30b0\u4e2d\uff06\u30de\u30a6\u30b9\u304c\u96e2\u3055\u308c\u305f\u3089\u3001\u30de\u30a6\u30b9\u30c9\u30e9\u30c3\u30b0\u4e2d\u3067\u306f\u306a\u3044\uff1a\u5207\u308a\u66ff\u3048<\/h2>\n<p>\u30de\u30a6\u30b9\u304c\u52d5\u3044\u3066\u3044\u308b\u306e\u306f\u3001<code>mousemove<\/code>\u30a4\u30d9\u30f3\u30c8\u3067\u53d6\u5f97\u3067\u304d\u308b\u306e\u3067\u3059\u304c\u3001\u30de\u30a6\u30b9\u30c9\u30e9\u30c3\u30b0\uff08\u30af\u30ea\u30c3\u30af\u3057\u305f\u307e\u307e\u306e\u72b6\u614b\u3067\u30de\u30a6\u30b9\u3092\u52d5\u304b\u3059\u3053\u3068\uff09\u3092\u3057\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b\u306b\u306f\u3001<\/p>\n<ul>\n<li>\u30de\u30a6\u30b9\u304c\u62bc\u3055\u308c\u305f\u3089 isDragging \u3092 true \u306b\u3059\u308b<\/li>\n<li>\u30de\u30a6\u30b9\u304c\u96e2\u3055\u308c\u305f\u3089 isDragging \u3092 false \u306b\u3059\u308b<\/li>\n<\/ul>\n<p>\u3068\u3044\u3046\u5207\u308a\u66ff\u3048\u3092\u5229\u7528\u3057\u307e\u3059\u3002<\/p>\n<p>\u3064\u307e\u308a\u3001<code>isDragging<\/code>\u304c<code>true<\/code>\u306e\u3068\u304d\u306f\u300c<strong>\u30de\u30a6\u30b9\u306e\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u305f\u307e\u307e\u96e2\u3057\u3066\u3044\u306a\u3044<\/strong>\u300d\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308b\u306e\u3067\u3001\u3064\u307e\u308a\u300c\u30de\u30a6\u30b9\u30c9\u30e9\u30c3\u30b0\u4e2d\u300d\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u2464 \u30de\u30a6\u30b9\u30c9\u30e9\u30c3\u30b0\u4e2d\u306b\u79fb\u52d5\u3057\u305f\u3089\u3001\u5bfe\u8c61\u306e\u8272\u306e\u307f\u5909\u66f4\u3059\u308b<\/h2>\n<p>\u3053\u3053\u304c\u4eca\u56de\u306e\u30e1\u30a4\u30f3\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u3001\u8272\u3092\u5909\u66f4\u3059\u308b\u30a8\u30ea\u30a2\u3067\u3059\u304c\u3055\u3059\u304c\u306b<code>1x1<\/code>\u30d4\u30af\u30bb\u30eb\u3060\u3051\u3067\u306f\u300c<strong>\u30a8\u30b9\u30d1\u30fc\u4f0a\u6771\u3055\u3093\u306e\u30db\u30ef\u30a4\u30c8\u30dc\u30fc\u30c9\u5857\u308a\u3064\u3076\u3057\u30c1\u30e3\u30ec\u30f3\u30b8<\/strong>\u300d\u306e\u3088\u3046\u306b\u3044\u3064\u307e\u3067\u7d4c\u3063\u3066\u3082\u7d42\u308f\u3089\u306a\u3044\u306e\u3067\u3001\u3042\u308b\u7a0b\u5ea6\u7bc4\u56f2\u3092\u5e83\u3052\u3066\u3044\u307e\u3059\u3002\uff08\u77e5\u3089\u306a\u3044\u65b9\u306f\u30b9\u30eb\u30fc\u3057\u3066\u304f\u3060\u3055\u3044\ud83d\ude05\uff09<\/p>\n<p>\u305d\u306e\u7bc4\u56f2\u306e\u9577\u3055\u304c<code>drawingLength<\/code>\u3067\u3059\u3002\uff08\u5b9f\u969b\u306b\u306f\u30af\u30ea\u30c3\u30af\u3057\u305f\u5834\u6240\u304b\u3089<code>\u00b130<\/code>\u30d4\u30af\u30bb\u30eb\u306e\u6b63\u65b9\u5f62\u301060 x 60 \u30d4\u30af\u30bb\u30eb\u3011\u304c\u5857\u308a\u3064\u3076\u3057\u5bfe\u8c61\u30a8\u30ea\u30a2\u306b\u306a\u308a\u307e\u3059\uff09<\/p>\n<p>\u305d\u3057\u3066\u3001\u3053\u306e\u7bc4\u56f2\u306e\u8272\u3092\u3072\u3068\u3064\u305a\u3064<code>isSimilarColor()<\/code>\u3067\u30c1\u30a7\u30c3\u30af\u3057\u3001\u3082\u3057\u4f3c\u3066\u3044\u308b\u306a\u3089\u5225\u306e\u8272\u306b\u5857\u308a\u3064\u3076\u3059\u3001\u3068\u3044\u3046\u6d41\u308c\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>\u2465 16\u9032\u6570 \u2194 RGB \u5909\u63db<\/h2>\n<p>\u4eca\u56de\u306e\u6a5f\u80fd\u3092\u5b9f\u88c5\u3059\u308b\u306b\u5f53\u305f\u3063\u3066\u3001<code>16\u9032\u6570 \u2194 RGB<\/code>\u306e\u5909\u63db\u3092\u3059\u308b\u5fc5\u8981\u304c\u3042\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u6b63\u76f4\u79c1\u306e\u982d\u3067\u306f\u4e00\u751f\u308f\u304b\u3089\u306a\u3044\u306e\u3067<code>stackoverflow<\/code>\u3055\u3093\u306b\u805e\u3044\u3066\u307f\u307e\u3057\u305f\u3002\uff08\u3053\u3046\u3044\u3046\u30b3\u30fc\u30c9\u304c\u3059\u3089\u3059\u3089\u66f8\u3051\u308b\u4eba\u306f\u3069\u3093\u306a\u8133\u306e\u69cb\u9020\u306a\u3093\u3067\u3057\u3087\u3046\u306d\u2026\ud83d\ude02\uff09<\/p>\n<p>\u53c2\u7167\u5143\uff1a <a href=\"https:\/\/stackoverflow.com\/questions\/5623838\/rgb-to-hex-and-hex-to-rgb\" target=\"_blank\" rel=\"noopener\">https:\/\/stackoverflow.com\/questions\/5623838\/rgb-to-hex-and-hex-to-rgb<\/a><\/p>\n<h2>\u2466 \u3069\u3053\u304b\u3089\u3067\u3082Canvas\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u5909\u6570\u3078\u683c\u7d0d\u3059\u308b<\/h2>\n<p>\u3053\u308c\u306f\u30bf\u30a4\u30c8\u30eb\u305d\u306e\u307e\u307e\u3067\u3059\uff01<\/p>\n<h1>\u30c6\u30b9\u30c8\u3057\u3066\u307f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b\u30c6\u30b9\u30c8\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u2757<br \/>\n\u5229\u7528\u3059\u308b\u753b\u50cf\u306f\u4ee5\u4e0b\u3067\u3059\u3002<\/p>\n<p style=\"text-align: right;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9874\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/12\/canvas_replace_color_5.jpg\" alt=\"\" width=\"640\" height=\"426\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/12\/canvas_replace_color_5.jpg 640w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/12\/canvas_replace_color_5-300x200.jpg 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><br \/>\n<small>\u5199\u771f\uff1a<a href=\"https:\/\/pixabay.com\/photos\/man-homeless-homeless-man-poverty-937665\/\" target=\"_blank\" rel=\"noopener\">lannyboy89<\/a><\/small><\/p>\n<p>\u203b <code>Pixabay<\/code>\u3055\u3093\u3044\u3064\u3082\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3059\u3002\u3061\u306a\u307f\u306b\u79c1\u306e\u30d5\u30a1\u30c3\u30b7\u30e7\u30f3\u306f<strong>\u3053\u3093\u306a\u306b\u30ef\u30a4\u30eb\u30c9\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/strong>\u5ff5\u306e\u305f\u3081\ud83d\ude02<\/p>\n<p>\u3067\u306f\u3001\u30d6\u30e9\u30a6\u30b6\u3067\u5148\u307b\u3069\u306e\u30b3\u30fc\u30c9\u3078\u30a2\u30af\u30bb\u30b9\u3057\u307e\u3059\u3002<\/p>\n<p><strong>\u3010\u26a0\u3054\u6ce8\u610f\u3011<\/strong>\u30c1\u30a7\u30c3\u30af\u3057\u3066\u3044\u307e\u305b\u3093\u304c\u3001\u3082\u3057\u304b\u3059\u308b\u3068\u30a6\u30a7\u30d6\u30b5\u30fc\u30d0\u30fc\u7d4c\u7531\uff08<code>http:\/\/<\/code>\u3068\u304b\u306eURL\u3067\u3059\u306d\uff09\u3067\u306a\u3044\u3068\u3046\u307e\u304f\u52d5\u304b\u306a\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u8868\u793a\u306b\u306a\u308a\u307e\u3059\u306e\u3067\u3001\u65e9\u901f\u3055\u304d\u307b\u3069\u306e\u753b\u50cf\u3092\u9078\u629e\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9872\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/12\/canvas_replace_color_3.png\" alt=\"\" width=\"629\" height=\"314\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/12\/canvas_replace_color_3.png 629w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/12\/canvas_replace_color_3-300x150.png 300w\" sizes=\"auto, (max-width: 629px) 100vw, 629px\" \/><\/p>\n<p>\u3059\u308b\u3068\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9871\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/12\/canvas_replace_color_2.png\" alt=\"\" width=\"640\" height=\"451\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/12\/canvas_replace_color_2.png 640w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/12\/canvas_replace_color_2-300x211.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>\u30ef\u30a4\u30eb\u30c9\u306a\u5199\u771f\u304c\u30d7\u30ec\u30d3\u30e5\u30fc\u8868\u793a\u3055\u308c\u307e\u3057\u305f\uff01<\/p>\n<p>\u3067\u306f\u3001\u30dc\u30c8\u30e0\u306e\u8272\u3092\u8d64\u3078\u5909\u66f4\u3057\u305f\u3044\u306e\u3067\u30c0\u30d6\u30eb\u30af\u30ea\u30c3\u30af\u3057\u3066\u8272\u3092\u53d6\u5f97\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u3069\u3046\u306a\u3063\u305f\u3067\u3057\u3087\u3046\u304b\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb\uff1f\uff1f<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9870\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/12\/canvas_replace_color_4.png\" alt=\"\" width=\"350\" height=\"105\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/12\/canvas_replace_color_4.png 350w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/12\/canvas_replace_color_4-300x90.png 300w\" sizes=\"auto, (max-width: 350px) 100vw, 350px\" \/><\/p>\n<p>\u306f\u3044\u2757<br \/>\n\u6700\u521d\u306f\u767d\u3060\u3063\u305f\u306e\u304c\u3001\u30c0\u30fc\u30af\u30b0\u30ec\u30fc\u306b\u5909\u66f4\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u3067\u306f\u3001\u3053\u306e\u72b6\u614b\u3067\u30dc\u30c8\u30e0\u90e8\u5206\u3092\u30de\u30a6\u30b9\u30c9\u30e9\u30c3\u30b0\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u7d50\u679c\u306f\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb\uff1f\uff1f\uff1f<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9873\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/12\/canvas_replace_color_1.png\" alt=\"\" width=\"679\" height=\"477\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/12\/canvas_replace_color_1.png 679w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/12\/canvas_replace_color_1-300x211.png 300w\" sizes=\"auto, (max-width: 679px) 100vw, 679px\" \/><\/p>\n<p>\u306f\u3044\u2757<br \/>\n\u4f55\u5ea6\u304b\u8272\u306e\u53d6\u5f97\uff06\u63cf\u753b\u3092\u7e70\u308a\u8fd4\u3057\u307e\u3057\u305f\u304c\u3001\u30d5\u30a1\u30c3\u30b7\u30e7\u30f3\u306e\u30a4\u30e1\u30fc\u30b8\u3092\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u305d\u3046\u3067\u3059\u3002<\/p>\n<p>\u6210\u529f\u3067\u3059\ud83d\ude04\u2728<\/p>\n<h1>\u30c7\u30e2\u3092\u3064\u304f\u308a\u307e\u3057\u305f<\/h1>\n<p>\u305b\u3063\u304b\u304f\u306a\u306e\u3067\u3001\u30c7\u30e2\u30da\u30fc\u30b8\u3092\u3064\u304f\u308a\u307e\u3057\u305f\u3002<br \/>\n\u305c\u3072\u4ee5\u4e0b\u304b\u3089\u304a\u8a66\u3057\u304f\u3060\u3055\u3044\u3002\uff08\u753b\u50cf\u306f\u4e00\u5207\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3055\u308c\u307e\u305b\u3093\u306e\u3067\u3001\u3054\u81ea\u8eab\u306e\u5199\u771f\u3067\u3082\u5b89\u5fc3\u3057\u3066\u4f7f\u3063\u3066\u3044\u305f\u3060\u3051\u307e\u3059\ud83d\udc4d\uff09<\/p>\n<p><a href=\"https:\/\/demo-laravel8x.capilano-fw.com\/canvas_color\" target=\"_blank\" rel=\"noopener\">\u30c7\u30e2\u30da\u30fc\u30b8<\/a><\/p>\n<h1>\u4f01\u696d\u69d8\u3078\u306e\u3054\u63d0\u6848<\/h1>\n<p>\u4eca\u56de\u306e\u6a5f\u80fd\u3092\u4f7f\u3048\u3070\u3001\u3088\u308a\u304a\u5ba2\u69d8\u306e\u597d\u307f\u306b\u6cbf\u3063\u305f\u30a4\u30e1\u30fc\u30b8\u3092\u3057\u3066\u3082\u3089\u3046\u3053\u3068\u304c\u3067\u304d\u308b\u3068\u8003\u3048\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001\u30aa\u30fc\u30c0\u30fc\u30e1\u30a4\u30c9\u306a\u3069\u3053\u308c\u304b\u3089\u4f5c\u308b\u3082\u306e\u3092\u30d6\u30e9\u30a6\u30b6\u4e0a\u3067\u30b7\u30df\u30e5\u30ec\u30fc\u30c8\u3067\u304d\u308b\u306e\u3082\u8ca9\u58f2\u4fc3\u9032\u306b\u306f\u30d7\u30e9\u30b9\u306b\u306a\u308b\u3093\u3058\u3083\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002\uff08\u3069\u3053\u304b\u306e\u30e1\u30ac\u30cd\u30e1\u30fc\u30ab\u30fc\u3055\u3093\u304c\u30d1\u30bd\u30b3\u30f3\u4e0a\u3067\u3001\u304a\u5ba2\u3055\u3093\u306e\u9854\u5199\u771f\u306b\u3053\u308c\u304b\u3089\u3064\u304f\u308b\u30e1\u30ac\u30cd\u3092\u91cd\u306d\u3066\u8ca9\u58f2\u3057\u3066\u3044\u307e\u3057\u305f\uff09<\/p>\n<p>\u3082\u3057\u305d\u3046\u3044\u3063\u305f\u30b7\u30b9\u30c6\u30e0\u3092\u3054\u5e0c\u671b\u3067\u3057\u305f\u3089\u3001\u304a\u6c17\u8efd\u306b\u304a\u554f\u3044\u5408\u308f\u305b\u304b\u3089\u3054\u9023\u7d61\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u304a\u5f85\u3061\u3057\u3066\u304a\u308a\u307e\u3059\u3002m(_ _)m<\/p>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f<code>JavaScript + Canvas<\/code>\u3067\u7279\u5b9a\u306e\u8272\u3060\u3051\u3092\u5909\u66f4\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u5f53\u521d\u306f\u753b\u50cf\u306e\u4e2d\u306b\u3042\u308b\u7279\u5b9a\u306e\u8272\u3059\u3079\u3066\u3092\u5909\u66f4\u3059\u308b\u4ed5\u69d8\u3060\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u4ed6\u306e\u5834\u6240\u306b\u3082\u4f3c\u305f\u8272\u304c\u5b58\u5728\u3057\u3066\u3044\u308b\u3068\u3001\u305d\u3053\u307e\u3067\u8272\u304c\u5909\u66f4\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u306e\u3067\u3001\u4eca\u56de\u306e\u3088\u3046\u306b\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3057\u307e\u3057\u305f\u3002\uff08\u8272\u304c\u8d64\u306a\u306e\u3067\u3001\u3068\u3042\u308b\u753b\u50cf\u3060\u3068\u300c\u3069\u3046\u898b\u3066\u3082\u4e8b\u4ef6\u6027\u3042\u308a\u3067\u3057\u3087\u2026\u300d\u3068\u3044\u3046\u3088\u3046\u306a\u6d41\u8840\u3057\u3066\u308b\u3063\u307d\u3044\u753b\u50cf\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f\ud83d\ude05\uff09<\/p>\n<p>\u306a\u304a\u3001\u4eca\u56de\u5857\u308a\u3064\u3076\u3059\u8272\u306f\u5168\u3066\u540c\u3058\u8272\u3067\u3057\u305f\u304c\u3001\u9078\u629e\u3057\u305f\u8272\u3068\u5bfe\u8c61\u306e\u8272\u3068\u306e\u5dee\u5206\u304c\u8a08\u7b97\u3059\u308c\u3070\u3088\u308a\u30ea\u30a2\u30eb\u306a\u6620\u50cf\u306e\u307e\u307e\u8272\u5909\u66f4\u3067\u304d\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u306b\u3057\u3066\u3082\u3001\u3053\u3046\u3044\u3046\u4f5c\u696d\u3092\u3059\u308b\u3068\u3084\u3063\u3071\u308a\u6570\u5b66\u304c\u3067\u304d\u308b\u4eba\u3063\u3066\u3059\u3054\u3044\u306a\u3068\u611f\u3058\u307e\u3059\u3002<\/p>\n<p>\u3046\u30fc\u3093\u3001\u3001\u3001\u79c1\u306f\u5225\u306e\u5206\u91ce\u3067\u52dd\u8ca0\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3059\u306d\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u301c\u2757<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9809 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/11\/no_9.png\" alt=\"\" width=\"370\" height=\"220\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/11\/no_9.png 370w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/11\/no_9-300x178.png 300w\" sizes=\"auto, (max-width: 370px) 100vw, 370px\" \/>\u300c\u96fb\u5b50\u30ec\u30f3\u30b8\u5f85\u3063\u3066\u308b\u3068\u304d\u306f\u3001<br \/>\n\u30b8\u30fc\u30af\u30f3\u30c9\u30fc\u306e\u30d1\u30f3\u30c1\u771f\u4f3c\u3057\u3066\u307e\u3059\u300d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u79c1\u306f\u30d5\u30a1\u30c3\u30b7\u30e7\u30f3\u304c\u5f97\u610f\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u304c\u3001\u5c11\u3057\u3067\u3082\u591a\u304f\u306e\u4eba\u306b\u5370\u8c61\u3092\u6b8b\u3057\u305f\u3044\u3068\u3044\u3046\u3053\u3068\u3067\u30dc\u30c8\u30e0\uff08\u30d1\u30f3\u30c4\uff1f\uff09\u306e\u8272\u306f\u8d64\u3067\u56fa\u5b9a\u306b\u3057\u3066\u3044\u307e\u3059\u3002\uff08\u8d64\u306f\u597d\u304d\u3067\u3059\u3057\u3001\u30db &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=9869\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;JavaScript + Canvas \u3067\u7279\u5b9a\u306e\u8272\u3060\u3051\u5909\u66f4\u3059\u308b&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":9877,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-9869","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/9869","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9869"}],"version-history":[{"count":6,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/9869\/revisions"}],"predecessor-version":[{"id":9937,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/9869\/revisions\/9937"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/9877"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9869"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9869"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9869"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}