├── .firebaserc
├── .gitignore
├── .vscode
└── settings.json
├── 404.html
├── app
├── app.js
└── sorting-algorithms.js
├── assets
├── github-logo.svg
├── linkedin.svg
├── style.css
└── style.scss
├── firebase.json
├── index.html
├── package.json
├── preview.png
└── readme.md
/.firebaserc:
--------------------------------------------------------------------------------
1 | {
2 | "projects": {
3 | "default": "sorting-visualizer-js"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | public
3 | package-lock.json
4 | .firebase
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "workbench.colorCustomizations": {
3 | "activityBar.background": "#273023",
4 | "titleBar.activeBackground": "#374332",
5 | "titleBar.activeForeground": "#F8FAF8"
6 | }
7 | }
--------------------------------------------------------------------------------
/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
26 |
404
27 |
Page Not Found
28 |
The specified file was not found on this website. Please check the URL for mistakes and try again.
29 |
Why am I seeing this?
30 |
This page was generated by the Firebase Command-Line Interface. To modify it, edit the 404.html
file in your project's configured public
directory.
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/app/app.js:
--------------------------------------------------------------------------------
1 | import * as sorting from './sorting-algorithms.js';
2 |
3 | console.log(sorting);
4 |
5 | function getElements(elements) {
6 | let obj = {};
7 | elements.forEach(element => {
8 | obj[element] = document.getElementById(element)
9 | });
10 |
11 | return obj;
12 | }
13 |
14 |
15 | var barsData = [];
16 | var barsDataCopy = [];
17 |
18 | const { barsElement, sliderElement, toggleAnimationBtn, stopAnimationBtn, generateArrayBtn, arraySizeSliderElement, animationSpeedSliderElement, sortingAlgorithms } = getElements(['barsElement', 'sliderElement', 'toggleAnimationBtn', 'stopAnimationBtn', 'generateArrayBtn', 'arraySizeSliderElement', 'animationSpeedSliderElement', 'sortingAlgorithms']);
19 |
20 | var ANIMATION_SPEED = 1;
21 | var ARRAY_SIZE = 150;
22 | // var WIDTH = window.visualViewport.width;
23 |
24 | let interval;
25 |
26 | sliderElement.addEventListener('input', (e) => {
27 | // console.log(e.target.value);
28 | renderFrame(e.target.value)
29 | })
30 |
31 | arraySizeSliderElement.addEventListener('input', (e) => {
32 | ARRAY_SIZE = e.target.value;
33 | genArray();
34 | })
35 |
36 | animationSpeedSliderElement.addEventListener('input', (e) => {
37 | ANIMATION_SPEED = e.target.value;
38 | if (isPlaying !== null) {
39 | pauseAnimation();
40 | runAnimation();
41 | }
42 | })
43 |
44 | // /**
45 | // * Draw bards
46 | // * @param {*} data
47 | // * @param {*} compare
48 | // */
49 | // function renderBars(data, compare = []) {
50 |
51 | // barsElement.innerHTML = data.map((item, i) => `
52 | //
33 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
70 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
85 |
86 |
87 |
103 |
104 |
105 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "sorting-visualizer",
3 | "version": "1.0.0",
4 | "description": "Sorting algorithms visualizer in Vanilla JavaScript",
5 | "main": "app.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1",
8 | "cs": "node-sass assets/style.scss assets/style.css -w"
9 | },
10 | "repository": {
11 | "type": "git",
12 | "url": "git+https://github.com/abdulsohailmohd/sorting-visualizer.git"
13 | },
14 | "keywords": [],
15 | "author": "",
16 | "license": "ISC",
17 | "bugs": {
18 | "url": "https://github.com/abdulsohailmohd/sorting-visualizer/issues"
19 | },
20 | "homepage": "https://github.com/abdulsohailmohd/sorting-visualizer#readme",
21 | "devDependencies": {
22 | "node-sass": "^4.14.0"
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sohail-js/sorting-visualizer/cc9114dec5ff438c7730f9f03759bcf7e3c114cd/preview.png
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # Sorting Visualizer :fire:
2 | Sorting algorithms visualizer in Vanilla JavaScript
3 |
4 | 
5 |
6 | ## Live Demo :star:
7 | https://sorting-visualizer-js.firebaseapp.com/
--------------------------------------------------------------------------------