惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Securelist
C
CERT Recently Published Vulnerability Notes
Forbes - Security
Forbes - Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
L
LINUX DO - 最新话题
The Hacker News
The Hacker News
Google Online Security Blog
Google Online Security Blog
SecWiki News
SecWiki News
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
The Last Watchdog
The Last Watchdog
S
Schneier on Security
T
Troy Hunt's Blog
N
News | PayPal Newsroom
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Schneier on Security
Schneier on Security
P
Privacy & Cybersecurity Law Blog
T
Tor Project blog
T
Threatpost
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
A
Arctic Wolf
S
Secure Thoughts
P
Proofpoint News Feed
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Security Latest
Security Latest
Scott Helme
Scott Helme
Security Archives - TechRepublic
Security Archives - TechRepublic
Latest news
Latest news
PCI Perspectives
PCI Perspectives
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Hacker News - Newest:
Hacker News - Newest: "LLM"
L
LINUX DO - 热门话题
P
Palo Alto Networks Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
G
GRAHAM CLULEY
V2EX - 技术
V2EX - 技术
Google DeepMind News
Google DeepMind News
Project Zero
Project Zero
V
Vulnerabilities – Threatpost
T
Threat Research - Cisco Blogs
Webroot Blog
Webroot Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
N
News and Events Feed by Topic
TaoSecurity Blog
TaoSecurity Blog
大猫的无限游戏
大猫的无限游戏
T
Tenable Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
V
Visual Studio Blog
H
Hacker News: Front Page
Simon Willison's Weblog
Simon Willison's Weblog
AWS News Blog
AWS News Blog

Echo JS

Desktop apps Introducing mermaid-lint: Stop Shipping Broken Diagrams How We Cut Slow Responses by 80% Migrating to Next.js App Router The quiet problem with unnecessary async - Matt Smith GitHub - ant-design/ant-design-cli: Ant Design on your command line. Query component knowledge, analyze project usage, and guide migrations — fully offline. Uncovering the Magic Behind Playwright React Performance Isn’t About useMemo — It’s About Render Boundaries T2 No Escape Hatches · Prickles GitHub - auto-agent-protocol/auto-agent-protocol: Automotive Agent Protocol GitHub - coactionjs/coaction: Zustand-style state management with built-in render tracking and cached computed state GitHub - williamtroup/Rattribute.js: ❓ A lightweight JavaScript library for automatically changing HTML element attributes based on responsive screen sizes. GitHub - williamtroup/Rink.js: 🔗 A JavaScript library for generating responsive HTML link targets. SVAR Kanban: Interactive Task Board Component for Svelte, React, and Vue Performance Cost of Popular 3rd Party Scripts date-light - Tiny date utilities for JavaScript When React Hooks Stop Scaling: Moving Complex State to Zustand - Oren Farhi GitHub - jskits/loggerjs: A faster, more powerful isomorphic logger Out Loud — Free AI Text to Speech Pocket DB — Embedded single-file NoSQL for Node.js billboard.js 4.0 release: Canvas rendering mode, 94.3% faster! GitHub - thegruber/linkpeek: Secure TypeScript link preview and URL metadata extractor for Open Graph, Twitter Cards, JSON-LD, Node/Bun/Deno/edge. GitHub - evoluteur/healing-frequencies: Play the healing frequencies of various sets of tuning forks: Solfeggio, Organs, Mineral nutrients, Ohm, Chakras, Cosmic octave, Otto, DNA nucleotides... or custom. Framework | Neutralinojs GitHub - AllThingsSmitty/typescript-tips-everyone-should-know: ✅ A curated collection of practical TypeScript patterns that improve safety, readability, maintainability, and developer experience. 🧠 Heat.js : JavaScript Heat Map GitHub - iDev-Games/State-JS: State.js is a CSS‑reactive framework that makes UI state and updates flow through CSS instead of JavaScript logic. GitHub - yankouskia/gameplate: :video_game: Boilerplate for creating game with WebGL & Redux :game_die: GitHub - yankouskia/get-browser: 💻 Lightweight tool to identify the browser (mobile+desktop detection)📱 GitHub - yankouskia/is-incognito-mode: Identify whether browser is in incognito mode 👀
Animated sine waves - 27 lines of pure JavaScript
2026-07-09 · via Echo JS

The animations on this page are generated using the program below. We start with a 20x20 grid and for each point we calculate the height of the wave using the sine and cosine functions of the point coordinates.

<html>
    <body>
        <canvas id="myCanvaswidth="600height="800"></canvas>
        <script>
            function animate() {
                context.clearRect(00canvas.widthcanvas.height);
                for (let x = 0x < sizex++) {
                    for (let y = 0y < sizey++) {
                        dots[x][y] = (y + 5 * Math.sin(counter / 50) * Math.sin((x + y) / (Math.PI * 2))) * scale;
                        if (x > 0 && y > 0) {
                            context.fillStyle = `hsl(${x * y + counter % 360},100%,50%)`;
                            context.beginPath();
                            context.moveTo(x * scale, +(dots[x][y]));
                            context.lineTo((x - 1) * scale, (dots[x - 1][y]));
                            context.lineTo((x - 1) * scale, (dots[x - 1][y - 1]));
                            context.lineTo(x * scale, (dots[x][y - 1]));
                            context.lineTo(x * scale, (dots[x][y]));
                            context.fill();
                            context.stroke();
                        }
                    }
                }
                counter++;
                window.requestAnimationFrame(animate);
            }
 
            let canvas = document.getElementById('myCanvas');
            let context = canvas.getContext('2d');
            let counter = 0;
            const size = 20;
            const scale = 30;
            const dots = new Array(size);
            for (let x = 0x < sizex++) {
                dots[x] = new Array(size);
            }
            animate();
        </script>
    </body>
</html>

Detailed code walkthrough

Lines [5-25]: the main 'animate' function, where all the magic happens.

[6] clear the previous animation frame

[7-8] loop through every dot in the grid

[9] the math formula that converts the x and y grid coordinates into the wave height at that point

[10-19] set the color based on the grid coordinates and the counter and draw a filled quadrilateral from the neighboring grid points to the current

[23] increase the frame counter - this makes the colors cycle in line 11

[24] wait for the next animation frame

[27-35] set up the canvas and declare the variables

[36] kick off the animation!

You can experiment with different formulas in line 9. Here are some examples:

dots[x][y] = (y + 5 * Math.sin(counter / 50) * Math.cos((x * x * y) / Math.PI / 50)) * scale;

dots[x][y] = scale*(y + Math.sin((x*5*y+counter)/Math.PI/10));

Try also:

dots[x][y] = scale * (y + Math.sin((25 * x * x * y + counter) / Math.PI / 10));
dots[x][y] = scale * (y + Math.sin((x * y + counter) / Math.PI / 10));
dots[x][y] = scale * (y + Math.sin(x) * Math.cos(y + counter / Math.PI / 4));

More JS tutorials:

Spinning squares - visual effect (25 lines)

Oldschool fire effect (20 lines)

Fireworks (60 lines)

Animated fractal (32 lines)

Physics engine for beginners

Physics engine - interactive sandbox

Physics engine - silly contraption

Starfield (21 lines)

Yin Yang with a twist (4 circles and 20 lines)

Tile map editor (70 lines)

Sine scroller (30 lines)

Interactive animated sprites

Image transition effect (16 lines)