Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
2年かけて Deno に DOMMatrix を実装した話 / How I implement...
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
petamoriken / 森建
July 24, 2026
Programming
270
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
2年かけて Deno に DOMMatrix を実装した話 / How I implemented DOMMatrix in Deno over two years
FE Yatai Talks vol.2
https://fe-yatai.connpass.com/event/396289/
petamoriken / 森建
July 24, 2026
More Decks by petamoriken / 森建
See All by petamoriken / 森建
Security issues being discussed on Web Platforms
petamoriken
0
1.5k
WebAssembly を読み込むベストプラクティス 2026年春版 / Best Practices for Loading WebAssembly (Spring 2026)
petamoriken
5
1.3k
コントリビューターによるDenoのすゝめ / Deno Recommendations by a Contributor
petamoriken
0
300
Module Harmony
petamoriken
3
1.2k
Denoでフロントエンド開発 2025年春版 / Frontend Development with Deno (Spring 2025)
petamoriken
1
1.7k
非ブラウザランタイムとWeb標準 / Non-Browser Runtimes and Web Standards
petamoriken
0
700
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
370
フロントエンドの標準仕様をどう追っているか / How I follow the frontend standards specs
petamoriken
4
2.9k
ECMAScript、Web標準の型はどう管理されているか / How ECMAScript and Web standards types are maintained
petamoriken
3
710
Other Decks in Programming
See All in Programming
Seven New Principles of Software Engineering
yegor256
0
470
AI時代のIaC入門 〜なぜインフラをコードで管理したいのか?〜 / Introduction to IaC in the AI Era
akihisaikeda
6
1.4k
Python Lambdaにおけるテストしやすい設計とAI支援の活用 / Designing Testable Python Lambda Functions with AI
kitano_yuichi
1
310
Getting Started with Vibe Coding
miccheng
0
190
まずはコードより業務と向き合う:テーブル解体のためにPdMを呼んだ話
sakawe_ee
0
190
ChromeでローカルLLM
ryu1013
0
200
Secure Your Coding Agent Like It’s Malware (v1.5) 🇬🇧 @Code.talks 2026
richargh
0
110
SODA - FACT BOOK(JP)
sodainc
1
40k
エージェントを使い続けるためのメタワーク / Meta-work for keeping using the agent
rkaga
6
2.2k
学びを記事・スライド・Xへ高速展開する― AI-assisted Learning Loopで回すコンテンツ生成術
ochtum
0
200
AI駆動開発4年目の現在地(『あなたはFDEになるべきか?』イベント資料)
kumaiu
0
490
Будущее локальных LLM – Алексей Голобурдин, PythoNN
sobolevn
0
110
Featured
See All Featured
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
68
60k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
70
68k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Why Our Code Smells
bkeepers
PRO
340
58k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
480
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
930
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
970
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
330
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.9k
How to Ace a Technical Interview
jacobian
280
24k
Transcript
2年かけて Deno に DOMMatrix を実装した話 FE Yatai Talks vol.2 pixiv
Inc. 森内建太 @petamoriken 2026.7.24
自己紹介 petamoriken WebDev in Fukuoka 2 • Web エンジニア •
Deno / ECMAScript コントリビューター • FEC Fukuoka 2026 ゲストスピーカー
https://scrapbox.io/petamoriken/ 3
唯一型チェック機能を持つランタイム Deno • TypeScript (tsc) 同梱 ◦ tsgo (TS v7)
をデフォルトにする作業中 ◦ JSX サポート • Linter, Formatter, LSP 内蔵 ◦ deno lint で Oxlint を使う変更が議論中 ▪ Oxlint に Type-Aware Linting が来ましたね 4
5
今日は Web 標準 API のニッチな話 6
DOMMatrix • 4x4 の行列で回転、平行移動などの線形変換を扱う ◦ 2D の場合は 2x3 のアフィン行列として扱われる const
matrix = new DOMMatrix() .rotateSelf(0, 0, 90) .translateSelf(20, 30); console.log(matrix.toString()); // "matrix(0, 1, -1, 0, -30, 20)" 7
何故 Deno に DOMMatrix を入れるのか • SSR で CSS Transforms
生成に使える(かも) • WebGPU で GPU に変換行列を送るのに使える • OffscreenCanvas で Canvas 2D を実装したい ◦ Canvas 2D 実装には DOMMatrix が必要 ◦ コンテンツに合わせて OGP の画像生成が出来る ◦ deno desktop の Raw モードでゲームを作りたい 8
コンテンツに合わせて OGP 画像生成 • Cloud Functions で node-canvas を使ったことがある ◦
導入や設定が大変 ◦ 読み込みでよくタイムアウトしてしまっていた • 今なら Satori や skia-canvas を採用するのがよさそう ◦ 絵文字対応とか大変そう • Deno でネイティブサポートしてもろもろ解決! 9
deno desktop • Deno 2.9 で入ったデスクトップアプリを作る機能 • Next.js などのフレームワークからアプリが作れる •
色々なモードがある ◦ WebView モード: OS のブラウザ使用(Tauri 相当) ◦ CFE モード: Chromium 埋め込み(Electron 相当) ◦ Raw モード: ブラウザなし(現状 WebGPU のみ) 10
DOMMatrix(再掲) • 4x4 の行列で回転、平行移動などの線形変換を扱う ◦ 2D の場合は 2x3 のアフィン行列として扱われる const
matrix = new DOMMatrix() .rotateSelf(0, 0, 90) .translateSelf(20, 30); console.log(matrix.toString()); // "matrix(0, 1, -1, 0, -30, 20)" 11
DOMMatrix は CSS Transforms をパースする • CSS Transfroms には関数が 20
個定義されている • パーサーを実装するのに CSS 仕様を読み必要がある const matrix = new DOMMatrix( "rotate(90deg) translate(20px, 30px)" ); console.log(matrix.toString()); // "matrix(0, 1, -1, 0, -30, 20)" 12
CSS Transforms は Values and Units に依存 • 引数内で CSS
Values and Units の関数が使える ◦ Values and Units には関数が 21 個定義されている ◦ 四則演算が使える • 全部頑張って実装する const matrix = new DOMMatrix( "translateX(calc(1px + 2px)) rotate(atan2(3, 2))" ); 13
14
CSS 4 から異なる次元の掛け算・割り算可能に • 四則演算の途中では物理量が基本次元でなくてもよい • が、頑張る…… 15
16
なんやかんや実装し、マージされた • 詳細は Zenn の記事へ! 17
まとめ • Deno は便利なのでみんな使ってね ◦ TypeScript を同梱している ◦ Deno 2.9
で入った deno desktop が面白そう • Web 標準 API に行列を扱う DOMMatrix がある ◦ 2年かけて Deno に実装した ◦ CSS Functions のパーサーを作るのは結構大変 18
Deno に Canvas 2D 実装中 • vello + wgpu と
vello_cpu を使っている 19