๐Ÿ˜€๐Ÿ˜ฌ๐Ÿ˜๐Ÿ˜‚๐Ÿ˜ƒ๐Ÿ˜„๐Ÿ˜…๐Ÿ˜†๐Ÿ˜‡๐Ÿ˜‰๐Ÿ˜Š๐Ÿ™‚โ˜บ๏ธ๐Ÿ˜‹๐Ÿ˜Œ๐Ÿ˜๐Ÿ˜˜๐Ÿ˜—๐Ÿ˜™๐Ÿ˜š๐Ÿ˜œ๐Ÿ˜๐Ÿ˜›๐Ÿ˜Ž๐Ÿ˜๐Ÿ˜ถ๐Ÿ˜๐Ÿ˜‘๐Ÿ˜’๐Ÿ˜ณ๐Ÿ˜ž๐Ÿ˜Ÿ๐Ÿ˜ ๐Ÿ˜ก๐Ÿ˜”๐Ÿ˜•๐Ÿ™โ˜น๏ธ๐Ÿ˜ฃ๐Ÿ˜–๐Ÿ˜ซ๐Ÿ˜ฉ๐Ÿ˜ค๐Ÿ˜ฎ๐Ÿ˜ฑ๐Ÿ˜จ๐Ÿ˜ฐ๐Ÿ˜ฏ๐Ÿ˜ฆ๐Ÿ˜ง๐Ÿ˜ข๐Ÿ˜ฅ๐Ÿ˜ช๐Ÿ˜“๐Ÿ˜ญ๐Ÿ˜ต๐Ÿ˜ฒ๐Ÿ˜ท๐Ÿ˜ด๐Ÿ’ค๐Ÿ’ฉ๐Ÿ˜ˆ๐Ÿ‘ฟ๐Ÿ‘น๐Ÿ‘บ๐Ÿ’€๐Ÿ‘ป

ใƒใ‚จใƒ  JavaScript canvas
0 Comments
Tweet

็ฎก็†็”จใƒชใƒณใ‚ฏ: mzyy94 1ใ‚ณใƒก(ๆฅญๅ‹™้€ฃ็ตก) mzyy94 2ใ‚ณใƒก(ๆฅญๅ‹™้€ฃ็ตก) mzyy94 3ใ‚ณใƒก mzyy94 ใ‚นใ‚ฏใƒชใƒ—ใƒˆใ‚’่ฆ‹ใ‚‹

๐Ÿ˜Žyokunaine ใ‚ˆใใชใ„ใญ ๐Ÿ˜Žyokunaine ใ‚ˆใใชใ„ใญ ๐Ÿ˜Žyokunaine ใ‚ˆใใชใ„ใญ

๐Ÿ‘Žใ‚ˆใใชใ„ใญๆ–ฐใƒใƒผใ‚ธใƒงใƒณ้–‹็™บไธญ๏ผ ๐Ÿ‘Žใ‚ˆใใชใ„ใญ้›†่จˆ

โœ‰ๆ–ฐ็€ใƒกใƒƒใ‚ปใƒผใ‚ธ(ๅ…จใฆ่ฆ‹ใ‚‹)โœ‰

2017/04/26 ใ‚ฟใ‚คใƒˆใƒซใฎๅ‰ๅพŒใง้–ข้€ฃๆ€งใŒใชใ„ใจใ„ใ†็ทจ้›†ใƒชใ‚ฏใ‚จใ‚นใƒˆใŒใŸใใ•ใ‚“้ฃ›ใ‚“ใงใใŸใฎใงๆœ€ๅˆใฎ็Šถๆ…‹ใซใ‚‚ใฉใ—ใพใ—ใŸ๏ผ

2017/04/26 ๆŠ€่ก“็ณปใฎใ‚ฟใ‚ฐใ‚’ใคใ‘ใŸใฎใฏใƒ—ใƒญใ‚ฐใƒฉใƒŸใƒณใ‚ฐใฎ่ฉฑใ ใ‹ใ‚‰ใญ๏ผๆ–‡ๅฅใฏ้‹ๅ–ถใซ่จ€ใฃใฆใญ๏ผ

2017/04/26
ใ‚นใ‚ฏใƒชใƒผใƒณใ‚ทใƒงใƒƒใƒˆ 2017-04-26 8.53.07.png

2017/04/25ใ‚ณใƒผใƒ‰ใ ใ‚ˆ

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link href="https://fonts.googleapis.com/css?family=Bangers" rel="stylesheet">
    <title>@JAVASCRIPT</title>
</head>
<body>
    <canvas width="360" height="60">
        <span style="
            font: 68px 'Bangers';
            color: #24f;
            text-shadow: 1px 0.5px 0 #888, 2px 1px 0 #888, 3px 1.5px 0 #888;
            font-weight: 100;
        ">@JAVASCRIPT</span>
    </canvas>
    <script>
        var span = 8
        var x = 10
        var y = 56
        var text = document.querySelector('span')

        var canvas = document.querySelector('canvas')
        var ctx = canvas.getContext('2d')
        ctx.font = text.style.font

        var canvas2 = document.createElement('canvas')
        canvas2.width = canvas.width
        canvas2.height = canvas.height
        ctx2 = canvas2.getContext('2d')
        ctx2.font = text.style.font
        ctx2.fillStyle = ctx2.shadowColor = "white"
        ctx2.shadowBlur = 1

        var offset = span
        function draw() {
            ctx.clearRect(0, 0, canvas.width, canvas.height)
            ctx.fillStyle = "#888"
            for (var i = 1; i <= 3; i++) {
                ctx.fillText(text.innerText, x + i, y + (i/2))
            }
            ctx.fillStyle = text.style.color
            ctx.fillText(text.innerText, x, y)

            ctx2.clearRect(0, 0, canvas2.width, canvas2.height)
            for (var i = 0; i < 7 * span; i+=span) {
                for (var j = 36; j < 36 + 22 * span*2; j += span*2) {
                    ctx2.fillRect(j - i, i, 1.6, 1.6)
                }
            }
            ctx2.globalCompositeOperation = "destination-in"
            ctx2.fillText(text.innerText, x-offset, y-offset)
            ctx2.globalCompositeOperation = "source-over"
            ctx2.drawImage(canvas2, 0, 0)

            ctx.drawImage(canvas2, offset, offset)
            offset = --offset || span 
        }
        draw()
        setInterval(draw, 100)
    </script>
</body>
</html>

2017/04/25ใƒ‡ใƒข่ฟฝๅŠ โค๏ธ

https://jsfiddle.net/7p4wrhfr/

2017/04/26 ๆ•ฐใ‚ใ‚‹ใ‚ดใƒŸ่จ˜ไบ‹ใ‚’ๅทฎใ—็ฝฎใ„ใฆใ“ใฎ่จ˜ไบ‹ใ‚’้™ๅฎšๅ…ฌ้–‹ใซใ™ใ‚‹ใจใฏใ•ใ™ใŒ๏ผ๏ผๆŠ€่ก“็š„ๅ†…ๅฎนใŒ็š†็„กใช่จ˜ไบ‹ใ‚ˆใ‚Šใฏใ‚ณใƒผใƒ‰่ฒผใฃใฆใ‚ใฃใŸใ‚Šใ—ใฆใ€Œใทใ‚ใใ‚‰ใฟใ‚“ใใจ้–ขไฟ‚ใฎใ‚ใ‚‹ๆŠ•็จฟใ€ใงใฏใ‚ใ‚‹ใ‚“ใ ใ‘ใฉใชใƒผ๏ผŸ

ๆผขใฏใ‚ณใƒผใƒ‰ใง่ชžใ‚Œใจ่จ€ใ‚ใ‚ŒใฆใใŸ2020ๅนดไปฃใฎไปŠใ‚‚่ชฌๆ˜Žๆ–‡ใ‚’ๆ›ธใ‹ใชใใ‚ƒใ„ใ‘ใชใ„ใฎใณใฃใใ‚Šใ ใ‘ใฉใ€ใ‚ใ–ใ‚ใ–่ชฌๆ˜Žใ—ใฆใ‚ใ’ใ‚‹ใญ๏ผ


ใƒˆใƒƒใƒ—ใฎ็”ปๅƒใซใ‚ใ‚‹ใ‚ˆใ†ใช่‹ฅๅนฒ็ซ‹ไฝ“็š„ใชๆ–‡ๅญ—ใฎ่กจ้ขใซใƒ‰ใƒƒใƒˆๆจกๆง˜ใŒๅ‹•ใ„ใฆใ‚‹ใƒญใ‚ดใ‚’canvasใงไฝœใ‚ใ†ใจๆ€ใฃใŸๆ™‚ใ€ใฉใ†ใ‚„ใฃใฆ่กจ็พใ™ใ‚‹ใ‹ใฎใŠ่ฉฑใ€‚

  1. ็ซ‹ไฝ“ใฃใฝใ่ฆ‹ใ›ใ‚‹ใŸใ‚ใซๆ–œใ‚ใซใšใ‚‰ใ—ใŸ็ฐ่‰ฒใฎๆ–‡ๅญ—ใ‚’๏ผ“ๅ›žๆ็”ปใ—ใพใ™ใ€‚

     for (var i = 1; i <= 3; i++) {
         ctx.fillText(text.innerText, x + i, y + (i/2))
     }
    
  2. ่กจ้ขใฎๆ–‡ๅญ—ใ‚’ๆ็”ปใ—ใพใ™ใ€‚

     ctx.fillText(text.innerText, x, y)
    
  3. ๅˆฅใฎใ‚ญใƒฃใƒใ‚นใซใƒ‰ใƒƒใƒˆๆจกๆง˜ใ‚’ๆใใพใ™ใ€‚

     for (var i = 0; i < 7 * span; i+=span) {
         for (var j = 36; j < 36 + 22 * span*2; j += span*2) {
             ctx2.fillRect(j - i, i, 1.6, 1.6)
         }
     }
    
  4. ๆ–‡ๅญ—ใฎๅž‹ใงใƒ‰ใƒƒใƒˆๆจกๆง˜ใ‚’ๅˆ‡ใ‚ŠๆŠœใใพใ™ใ€‚

     ctx2.globalCompositeOperation = "destination-in"
     ctx2.fillText(text.innerText, x-offset, y-offset)
    
  5. ใƒ‰ใƒƒใƒˆๆจกๆง˜ใ‚’ๆฟƒใใ—ใพใ™ใ€‚

     ctx2.globalCompositeOperation = "source-over"
     ctx2.drawImage(canvas2, 0, 0)
    
  6. ใƒ‰ใƒƒใƒˆๆจกๆง˜ใ‚’ๆใ„ใŸใ‚ญใƒฃใƒณใƒใ‚นใ‚’ๆ–‡ๅญ—ใฎๆ›ธใ„ใฆใ‚ใ‚‹ใ‚ญใƒฃใƒณใƒใ‚นใซ่ผ‰ใ›ใพใ™ใ€‚

     ctx.drawImage(canvas2, offset, offset)
    

offsetใ‚’ใšใ‚‰ใ—ใฆๅ‹•ใ„ใฆใ„ใ‚‹ใ‚ˆใ†ใซ่ฆ‹ใ›ใฆใ‚‹ใ‚ˆ๏ผ