├── LICENSE ├── README.md ├── glitcher └── .github ├── dem2.svg ├── logo.svg ├── dem3.svg ├── log3.svg ├── log1.svg ├── log2.svg └── dem1.svg /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 metaory 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 |

generate animated pseudo random glitch SVG from ASCII characters

4 |
5 | 6 | --- 7 | 8 |
9 |

10 | 11 | Glitcher Web App is now live! 🎉 12 |
13 | metaory.github.io/glitcher-app 14 |

15 |
16 | 17 |
18 | 19 | 20 |
21 |
22 | 23 |
24 |
25 | 26 | 27 | 28 |
29 | 30 | --- 31 | 32 | > [!TIP] 33 | > The following attributes are random 34 | > 35 | > - number of slices 36 | > - height of slices 37 | > - color channel shifts 38 | > - duration of animations 39 | > - keyTime of animations 40 | > - values of frames 41 | 42 | --- 43 | 44 | INSTALLATION 45 | ------------ 46 | 47 | - clone repo 48 | - give execution permissions 49 | - place it in your path 50 | 51 | ```sh 52 | # Clone 53 | git clone git@github.com:metaory/glitcher-cli.git 54 | 55 | # Navigate 56 | cd glitcher-cli 57 | ``` 58 | 59 | > [!TIP] 60 | > Temporary usage 61 | > `bash glitcher out.svg hello world` 62 | 63 | ```sh 64 | # Give execution permissions 65 | chmod +x glitcher 66 | 67 | # Link it somewhere in your $PATH 68 | ln -svf $PWD/glitcher /usr/bin/glitcher 69 | 70 | # Use it anywhere 71 | # Create out.svg with 'hello world' content 72 | glitcher out.svg hello world 73 | ``` 74 | 75 | --- 76 | 77 | SYNOPSIS 78 | -------- 79 | 80 | glitcher FILE TEXT... 81 | 82 | --- 83 | 84 | REQUIREMENTS 85 | ------------ 86 | 87 | - GNU Bash v5+ 88 | - GNU bc 89 | - GNU coreutils 90 | - sort 91 | - uniq 92 | 93 | --- 94 | 95 | TODO 96 | ---- 97 | 98 | - [ ] noise arg 99 | - [ ] density arg 100 | - [ ] color arg 101 | - [ ] font arg 102 | - [ ] help 103 | 104 | --- 105 | 106 | > [!CAUTION] 107 | > Only tested on Linux 108 | 109 | 110 | --- 111 | 112 | LICENSE 113 | ------- 114 | 115 | [MIT](LICENSE) 116 | -------------------------------------------------------------------------------- /glitcher: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | OUT="${1}" 4 | TXT="${*:2}" 5 | GLITCHER_DEBUG="${GLITCHER_DEBUG:-0}" 6 | 7 | [ ! -t 0 ] && { read -r TXT; } 8 | 9 | function print_help { 10 | cat <.5?1:-1) 44 | }' 45 | } 46 | 47 | function rnd_seq { 48 | local upper="${1:?BAD}" 49 | local keys=() 50 | local vals='' 51 | local steps="$(((RANDOM % 8) + 8))" 52 | for ((i = 0; i < steps - 2; i++)); do keys+=("$(rnd 0.08 1)"); done 53 | mapfile -t keys < <( 54 | printf '0;\n' 55 | printf '%s;\n' "${keys[@]}" | sort -g | uniq 56 | ) 57 | for _ in "${keys[@]}"; do vals+="$(rnd 0.001 "$upper" 1); "; done 58 | local ks="${keys[*]}" 59 | printf '%s\n%s' "${ks::(-1)}" "${vals::(-2)}" 60 | } 61 | 62 | mapfile -t B_SHIFT < <(rnd_seq 0.01) 63 | mapfile -t R_SHIFT < <(rnd_seq 0.01) 64 | read -r B_DUR < <(rnd 10 20) 65 | read -r R_DUR < <(rnd 15 20) 66 | read -r WIDTH < <(bc <<<"${#TXT} * 12") 67 | 68 | ((GLITCHER_DEBUG)) && RECT='' 69 | 70 | cat <"$OUT" 71 | 73 | 77 | 78 | ${RECT} 79 | ${TXT} 90 | 91 | 96 | 100 | 104 | 108 | 112 | 120 | 121 | 125 | 133 | 134 | 138 | 142 | EOF 143 | 144 | I=0 145 | NW=0 146 | SLICES=() 147 | 148 | function put_slice { 149 | ((I++)) 150 | read -r S1 < <(rnd 10 24) 151 | read -r S2 < <(rnd 10 16) 152 | read -r DR < <(rnd 10 24) 153 | read -r NX < <(bc <<<"$NW + $S1") 154 | 155 | mapfile -t SEQ < <(rnd_seq 0.01) 156 | 157 | SA="slice_${I}a" 158 | SB="slice_${I}b" 159 | SLICES+=("$SA" "$SB") 160 | 161 | cat <>"$OUT" 162 | 168 | 174 | 182 | 183 | EOF 184 | read -r NW < <(bc <<<"($NX + $S2)*1/1") 185 | } 186 | 187 | while ((NW <= 100)); do put_slice; done 188 | 189 | cat <<<' ' >>"$OUT" 190 | 191 | for S in "${SLICES[@]}"; do cat <<<" " >>"$OUT"; done 192 | 193 | cat <>"$OUT" 194 | 195 | 196 | 197 | 198 | EOF 199 | 200 | echo "created $OUT successfully." 201 | 202 | # vim: ft=bash 203 | -------------------------------------------------------------------------------- /.github/dem2.svg: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | glitcher 20 | 21 | 26 | 30 | 34 | 38 | 42 | 50 | 51 | 55 | 63 | 64 | 68 | 72 | 78 | 84 | 92 | 93 | 99 | 105 | 113 | 114 | 120 | 126 | 134 | 135 | 141 | 147 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /.github/logo.svg: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | ḠĿ𐪌𐌕ꛕ𖩘꠵ⵤ 20 | 21 | 26 | 30 | 34 | 38 | 42 | 50 | 51 | 55 | 63 | 64 | 68 | 72 | 78 | 84 | 92 | 93 | 99 | 105 | 113 | 114 | 120 | 126 | 134 | 135 | 141 | 147 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /.github/dem3.svg: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | glitcher 20 | 21 | 26 | 30 | 34 | 38 | 42 | 50 | 51 | 55 | 63 | 64 | 68 | 72 | 78 | 84 | 92 | 93 | 99 | 105 | 113 | 114 | 120 | 126 | 134 | 135 | 141 | 147 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /.github/log3.svg: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | ḠĿ𐪌𐌕ꛕ𖩘꠵ⵤ 20 | 21 | 26 | 30 | 34 | 38 | 42 | 50 | 51 | 55 | 63 | 64 | 68 | 72 | 78 | 84 | 92 | 93 | 99 | 105 | 113 | 114 | 120 | 126 | 134 | 135 | 141 | 147 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /.github/log1.svg: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | ḠĿ𐪌𐌕ꛕ𖩘꠵ⵤ 20 | 21 | 26 | 30 | 34 | 38 | 42 | 50 | 51 | 55 | 63 | 64 | 68 | 72 | 78 | 84 | 92 | 93 | 99 | 105 | 113 | 114 | 120 | 126 | 134 | 135 | 141 | 147 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /.github/log2.svg: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | ḠĿ𐪌𐌕ꛕ𖩘꠵ⵤ 20 | 21 | 26 | 30 | 34 | 38 | 42 | 50 | 51 | 55 | 63 | 64 | 68 | 72 | 78 | 84 | 92 | 93 | 99 | 105 | 113 | 114 | 120 | 126 | 134 | 135 | 141 | 147 | 155 | 156 | 162 | 168 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | -------------------------------------------------------------------------------- /.github/dem1.svg: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | glitcher 20 | 21 | 26 | 30 | 34 | 38 | 42 | 50 | 51 | 55 | 63 | 64 | 68 | 72 | 78 | 84 | 92 | 93 | 99 | 105 | 113 | 114 | 120 | 126 | 134 | 135 | 141 | 147 | 155 | 156 | 162 | 168 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | --------------------------------------------------------------------------------