Skip to content

Commit

Permalink
Added example Gifs for database migration & binary tree rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
Yair Morgenstern authored and Yair Morgenstern committed Sep 12, 2024
1 parent 9c4fc22 commit 7fca037
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 45 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,13 @@ Made with:
- [Mermaid](https://github.com/mermaid-js/mermaid) for graph rendering
- [html2canvas](https://github.com/niklasvh/html2canvas) and [gif.js](https://github.com/jnordberg/gif.js) for creating the GIF
- [simple.css](https://github.com/kevquirk/simple.css) for the styling

### Examples

Database migration

![Database migration](examples/database-migration.gif)

Binary tree rotation

![Binary tree rotation](examples/binary-tree-rotation.gif)
Binary file added examples/binary-tree-rotation.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/database-migration.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
129 changes: 84 additions & 45 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,51 +154,90 @@
editor.setValue(initialGraphText)
}

const frames = [
"graph TD\n" +
"Source-->OldDB\n" +
"Source~~~NewDB:::invisible\n" +
"OldDB-->Destination\n" +
"NewDB~~~Destination\n" +
"classDef invisible fill-opacity:0, stroke-opacity:0, color:#0000; \n",

"graph TD\n" +
"Source-->OldDB\n" +
"Source-->NewDB\n" +
"OldDB-->Destination\n" +
"NewDB~~~Destination\n" +
"classDef invisible fill-opacity:0, stroke-opacity:0, color:#0000; \n",

"graph TD\n" +
"Source-->OldDB\n" +
"Source-->NewDB\n" +
"OldDB-->Destination\n" +
"NewDB-.->Destination\n" +
"classDef invisible fill-opacity:0, stroke-opacity:0, color:#0000; \n",

"graph TD\n" +
"Source-->OldDB\n" +
"Source-->NewDB\n" +
"OldDB-.->Destination\n" +
"NewDB-->Destination\n" +
"classDef invisible fill-opacity:0, stroke-opacity:0, color:#0000; \n",

"graph TD\n" +
"Source-->OldDB\n" +
"Source-->NewDB\n" +
"OldDB~~~Destination\n" +
"NewDB-->Destination\n" +
"classDef invisible fill-opacity:0, stroke-opacity:0, color:#0000; \n",

"graph TD\n" +
"Source~~~OldDB:::invisible\n" +
"Source-->NewDB\n" +
"OldDB~~~Destination\n" +
"NewDB-->Destination\n" +
"classDef invisible fill-opacity:0, stroke-opacity:0, color:#0000; \n",
]

frames.forEach(frame => {
const examples = {
"Migration": [
"graph TD\n" +
"Source-->OldDB\n" +
"Source~~~NewDB:::invisible\n" +
"OldDB-->Destination\n" +
"NewDB~~~Destination\n" +
"classDef invisible fill-opacity:0, stroke-opacity:0, color:#0000; \n",

"graph TD\n" +
"Source-->OldDB\n" +
"Source-->NewDB\n" +
"OldDB-->Destination\n" +
"NewDB~~~Destination\n" +
"classDef invisible fill-opacity:0, stroke-opacity:0, color:#0000; \n",

"graph TD\n" +
"Source-->OldDB\n" +
"Source-->NewDB\n" +
"OldDB-->Destination\n" +
"NewDB-.->Destination\n" +
"classDef invisible fill-opacity:0, stroke-opacity:0, color:#0000; \n",

"graph TD\n" +
"Source-->OldDB\n" +
"Source-->NewDB\n" +
"OldDB-.->Destination\n" +
"NewDB-->Destination\n" +
"classDef invisible fill-opacity:0, stroke-opacity:0, color:#0000; \n",

"graph TD\n" +
"Source-->OldDB\n" +
"Source-->NewDB\n" +
"OldDB~~~Destination\n" +
"NewDB-->Destination\n" +
"classDef invisible fill-opacity:0, stroke-opacity:0, color:#0000; \n",

"graph TD\n" +
"Source~~~OldDB:::invisible\n" +
"Source-->NewDB\n" +
"OldDB~~~Destination\n" +
"NewDB-->Destination\n" +
"classDef invisible fill-opacity:0, stroke-opacity:0, color:#0000; \n",
],
"Binary tree": [
"graph TD\n" +
"Root[1]~~~L:::invisible\n" +
"L~~~LL:::invisible\n" +
"L~~~LR:::invisible\n" +
"Root~~~R:::invisible\n" +
"R~~~RL:::invisible\n" +
"R~~~RR:::invisible\n" +
"classDef invisible fill-opacity:0, stroke-opacity:0, color:#0000; \n",

"graph TD\n" +
"Root[1]~~~L:::invisible\n" +
"L~~~LL:::invisible\n" +
"L~~~LR:::invisible\n" +
"Root-->R[2]\n" +
"R~~~RL:::invisible\n" +
"R~~~RR:::invisible\n" +
"classDef invisible fill-opacity:0, stroke-opacity:0, color:#0000; \n",

"graph TD\n" +
"Root[1]~~~L:::invisible\n" +
"L~~~LL:::invisible\n" +
"L~~~LR:::invisible\n" +
"Root-->R[2]\n" +
"R~~~RL:::invisible\n" +
"R-->RR[3]\n" +
"classDef invisible fill-opacity:0, stroke-opacity:0, color:#0000; \n",

"graph TD\n" +
"Root[2]-->L[1]\n" +
"L~~~LL:::invisible\n" +
"L~~~LR:::invisible\n" +
"Root-->R[3]\n" +
"R~~~RL:::invisible\n" +
"R~~~RR:::invisible\n" +
"classDef invisible fill-opacity:0, stroke-opacity:0, color:#0000; \n",
]
}

examples["Migration"].forEach(frame => {
window.addEditor(frame)
})
});
Expand Down

0 comments on commit 7fca037

Please sign in to comment.