diff options
Diffstat (limited to 'users/snowe/readme_ocean_dream.md')
| -rw-r--r-- | users/snowe/readme_ocean_dream.md | 258 |
1 files changed, 258 insertions, 0 deletions
diff --git a/users/snowe/readme_ocean_dream.md b/users/snowe/readme_ocean_dream.md new file mode 100644 index 000000000..ca15dd47c --- /dev/null +++ b/users/snowe/readme_ocean_dream.md | |||
| @@ -0,0 +1,258 @@ | |||
| 1 | # Ocean Dream | ||
| 2 | |||
| 3 | Tapping away at your IMX Corne with Box Jades, you feel yourself | ||
| 4 | drifting off, into a soundscape of waves and rustling leaves. | ||
| 5 | You open your eyes only to find yourself in an _Ocean Dream_. | ||
| 6 | |||
| 7 | Introducing, **Ocean Dream**, an animation for keyboards with tall OLED | ||
| 8 | screens. Built for 128x32 screens, this animation should work for 128x64 | ||
| 9 | at least, though it hasn't been tested there. | ||
| 10 | |||
| 11 | Completely customizable, you can change everything about the animation, | ||
| 12 | from the number of falling stars, to how likely a star is to twinkle, and | ||
| 13 | even if the moon has phases or not. | ||
| 14 | |||
| 15 | # Installation | ||
| 16 | |||
| 17 | Installation is easy. | ||
| 18 | |||
| 19 | 1. Add `ocean.h` and `ocean.c` to your keyboard folder or userspace. | ||
| 20 | 2. In your `keymap.c` or wherever you handle your oled code, add | ||
| 21 | ```c | ||
| 22 | # ifdef OCEAN_DREAM_ENABLE | ||
| 23 | render_stars(); | ||
| 24 | # endif | ||
| 25 | ``` | ||
| 26 | to `oled_task_user(void)`, where you would like (see [my keymap](../../keyboards/crkbd/keymaps/snowe/keymap.c) for an example) | ||
| 27 | 3. In your `keymap.c` or wherever you handle your process_record code, | ||
| 28 | add an event that sets `is_calm` when you press `ctrl` | ||
| 29 | ```c | ||
| 30 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 31 | switch (keycode) { | ||
| 32 | case KC_LCTL: | ||
| 33 | case KC_RCTL: | ||
| 34 | #ifdef OCEAN_DREAM_ENABLE | ||
| 35 | is_calm = (record->event.pressed) ? true : false; | ||
| 36 | #endif | ||
| 37 | break; | ||
| 38 | } | ||
| 39 | return true; | ||
| 40 | } | ||
| 41 | ``` | ||
| 42 | 4. In your `rules.mk` to make it easier to turn the animation on/off, add | ||
| 43 | ```makefile | ||
| 44 | ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes) | ||
| 45 | #... your code here... | ||
| 46 | |||
| 47 | ifdef OCEAN_DREAM_ENABLE | ||
| 48 | ifeq ($(strip $(OCEAN_DREAM_ENABLE)), yes) | ||
| 49 | SRC += ocean_dream.c | ||
| 50 | OPT_DEFS += -DOCEAN_DREAM_ENABLE | ||
| 51 | endif | ||
| 52 | endif | ||
| 53 | ifndef OCEAN_DREAM_ENABLE | ||
| 54 | SRC += ocean_dream.c | ||
| 55 | OPT_DEFS += -DOCEAN_DREAM_ENABLE | ||
| 56 | endif | ||
| 57 | endif | ||
| 58 | ``` | ||
| 59 | |||
| 60 | You're done! Now you can enable **Ocean Dream** by simply turning on the OLED feature | ||
| 61 | ```makefile | ||
| 62 | OLED_DRIVER_ENABLE = yes | ||
| 63 | ``` | ||
| 64 | |||
| 65 | And if you want to disable it without turning off the OLED Driver you can simply set | ||
| 66 | ```makefile | ||
| 67 | OCEAN_DREAM_ENABLE = no | ||
| 68 | ``` | ||
| 69 | |||
| 70 | # Settings | ||
| 71 | |||
| 72 | **Ocean Dream** comes with several different animations, all individually configurable: | ||
| 73 | |||
| 74 | * 🌌 Stars that twinkle | ||
| 75 | * 🌠 Meteor showers that get more vibrant the faster you type | ||
| 76 | * 🌊 Waves that get rougher the faster you type | ||
| 77 | * 🏝 An island with a palm tree that blows in the wind the faster you type | ||
| 78 | * 🌗 A moon that goes through the moon phases (or not, your choice!) | ||
| 79 | |||
| 80 | Each feature can be individually turned on and off, with a simple `#define`. | ||
| 81 | |||
| 82 | You can see all the options and more documentation by looking at `ocean_dream.h`. | ||
| 83 | |||
| 84 | All options come enabled by default. | ||
| 85 | |||
| 86 | ## Global Flags: | ||
| 87 | |||
| 88 | ### Toggles: | ||
| 89 | |||
| 90 | You can toggle on/off any features using these flags: | ||
| 91 | |||
| 92 | * `ENABLE_MOON` // Uses 182 bytes | ||
| 93 | * `ENABLE_WAVE` // Uses 844 bytes | ||
| 94 | * `ENABLE_SHOOTING_STARS` // Uses 872 bytes | ||
| 95 | * `ENABLE_ISLAND` | ||
| 96 | * `ENABLE_STARS` // Uses 606 bytes | ||
| 97 | |||
| 98 | ### Global Configuration: | ||
| 99 | |||
| 100 | * `STARRY_NIGHT_ANIM_FRAME_DURATION` - configures how long each frame lasts in ms | ||
| 101 | * `NUMBER_OF_FRAMES` - configures the number of frames that constitute a single 'round trip' of animation. | ||
| 102 | Enables keeping animations in sync/timed with each other. | ||
| 103 | Probably shouldn't touch this, not sure how stuff will work if it's changed. | ||
| 104 | If changed should probably be multiple of 1, 2, 3, 4, and 5 | ||
| 105 | * `WIDTH` - for vertical displays, configures the width (the shortest measurement of your display). defaults to `OLED_DISPLAY_HEIGHT` | ||
| 106 | * `HEIGHT` - for vertical displays, configures the height (the longest measurement of your display). defaults to `OLED_DISPLAY_WIDTH` | ||
| 107 | |||
| 108 | ## Stars | ||
| 109 | |||
| 110 | ### Description | ||
| 111 | |||
| 112 | The 🌌 stars animation is a background of slowly twinkling stars. | ||
| 113 | The stars are built on a grid of sorts, where each cell of the grid | ||
| 114 | is 8x8 pixels with 1 star per cell. There is a probability of any | ||
| 115 | star twinkling on any given frame, decided by the corresponding flags. | ||
| 116 | |||
| 117 | ### Flags | ||
| 118 | |||
| 119 | Enabled with the `#define ENABLE_STARS` directive. | ||
| 120 | |||
| 121 | The stars come with several configuration options: | ||
| 122 | |||
| 123 | * `STARS_PER_LINE` - configures the number of stars per line. Defaulting to 4, this would | ||
| 124 | mean that you have 4 stars across each line (8x32 on a 128x32 display), where each star | ||
| 125 | is in a 8x8 grid | ||
| 126 | * `NUMBER_OF_STAR_LINES` - configures the number of lines to fill up with stars. | ||
| 127 | Defaults to 16, filling the whole display. | ||
| 128 | * `TWINKLE_PROBABILITY` - configures the probability of a star twinkling on a given frame. | ||
| 129 | * `STAR_ANIMATION_SPEED` - configures the number of frames you want to animate the star at. | ||
| 130 | Must be equal to or lower than `NUMBER_OF_FRAMES`. | ||
| 131 | Example: | ||
| 132 | ```c | ||
| 133 | #define NUMBER_OF_FRAMES 20 | ||
| 134 | #define STAR_ANIMATION_SPEED 5 | ||
| 135 | ``` | ||
| 136 | would result in the star animation happening every 4 frames. 20 would result in every frame, | ||
| 137 | 1 would be once every 20 frames. This essentially changes how fast stars will twinkle, but | ||
| 138 | does not change the probability of the stars twinkling. | ||
| 139 | |||
| 140 | ## Moon | ||
| 141 | |||
| 142 | ### Description | ||
| 143 | |||
| 144 | The 🌗 moon animation is an 8x8 animation of a moon, or, if you are running out of program memory, you | ||
| 145 | can set it to just a static crescent moon, with no animation. | ||
| 146 | |||
| 147 | ### Flags | ||
| 148 | |||
| 149 | Enabled with the `#define ENABLE_MOON` directive. | ||
| 150 | |||
| 151 | The moon comes with only a few configuration options: | ||
| 152 | |||
| 153 | * `STATIC_MOON` - include this directive if you want your moon to have no animation. It will simply be a static crescent | ||
| 154 | moon, only taking up 6 bytes of space. If you do not include this directive, then the moon will have an animation. | ||
| 155 | The default is a moon with animation. | ||
| 156 | * `MOON_LINE` - defines the line that the moon sits on. Default is `4`. (see [reference](#reference)) | ||
| 157 | * `MOON_COLUMN` - defines the column that the moon sits at. Default is `4`. (see [reference](#reference)) | ||
| 158 | * `ANIMATE_MOON_EVERY_N_FRAMES` - only enabled when `STATIC_MOON` is disabled, this affects how often the moon changes phases. | ||
| 159 | Example: | ||
| 160 | ```c | ||
| 161 | #define STARRY_NIGHT_ANIM_FRAME_DURATION 30 | ||
| 162 | #ifndef STATIC_MOON | ||
| 163 | # define ANIMATE_MOON_EVERY_N_FRAMES 100 | ||
| 164 | #endif | ||
| 165 | ``` | ||
| 166 | would result in the moon changing phases every 3000ms, or every 3 seconds. | ||
| 167 | |||
| 168 | ## Ocean | ||
| 169 | |||
| 170 | ### Description | ||
| 171 | |||
| 172 | The 🌊 ocean animation is a full width animation of ocean waves, where the waves get rougher the faster you type. | ||
| 173 | You can configure the boundaries for each degree of _wave ferocity_ as well as how fast the ocean/waves move. | ||
| 174 | |||
| 175 | ### Flags | ||
| 176 | |||
| 177 | * `OCEAN_LINE` - where to render the ocean at. Defaults to `14`. (see [reference](#reference)) | ||
| 178 | * `OCEAN_ANIMATION_SPEED` - configures the number of frames you want to animate the ocean at. | ||
| 179 | Must be equal to or lower than `NUMBER_OF_FRAMES`. | ||
| 180 | Example: | ||
| 181 | ```c | ||
| 182 | #define NUMBER_OF_FRAMES 20 | ||
| 183 | #define OCEAN_ANIMATION_SPEED 5 | ||
| 184 | ``` | ||
| 185 | would result in the ocean animation happening every 4 frames. 20 would result in every frame, | ||
| 186 | 1 would be once every 20 frames. This essentially changes how fast the waves will move. | ||
| 187 | * `WAVE_CALM` - Defines the WPM at which the _Wave Ferocity_ kicks up. | ||
| 188 | At any WPM between `WAVE_CALM` and `WAVE_HEAVY_STORM`, the waves will be just tiny ripples. | ||
| 189 | * `WAVE_HEAVY_STORM` - Defines the WPM at which the _Wave Ferocity_ kicks up to medium. | ||
| 190 | At any WPM between `WAVE_HEAVY_STORM` and `WAVE_HURRICANE`, the waves will be medium sized waves. | ||
| 191 | * `WAVE_HURRICANE` - Defines the WPM at which the _Wave Ferocity_ kicks up to the last notch. | ||
| 192 | At any WPM above `WAVE_HURRICANE`, the waves will be torrential. | ||
| 193 | |||
| 194 | ## Shooting Stars | ||
| 195 | |||
| 196 | The 🌠 shooting star animation is a full screen animation that renders a meteor shower based on your typing speed. The | ||
| 197 | faster you type, the more shooting stars there are! | ||
| 198 | |||
| 199 | You can configure many parts of the shooting stars, from shower size, to speed, to length of each trail, to how spaced | ||
| 200 | out they are. | ||
| 201 | |||
| 202 | Note: Each frame of a shooting star is only 2 pixels in length. This is a design decision, and could probably be changed | ||
| 203 | with a decent amount of work, but was chosen for looks and memory constraints. | ||
| 204 | |||
| 205 | ### Flags | ||
| 206 | |||
| 207 | * `SHOOTING_STAR_DELAY` - Decides number of frames to delay, based on modulus, e.g. 12 means 0-11 frames of delay between each shooting star | ||
| 208 | * `SHOOTING_STAR_FRAMES` - how long each shooting star will be. A size of `16` will result in shooting stars that are 32 pixels long | ||
| 209 | * `MAX_NUMBER_OF_SHOOTING_STARS` - maximum number of shooting stars that can be on screen at the same time | ||
| 210 | * `SHOOTING_STAR_WPM_INCREMENT` - every n WPM increase, add an extra star, up to MAX_NUMBER_OF_SHOOTING_STARS | ||
| 211 | Example: an increment of 5 would result in 1 shooting star at 5-9wpm, 2 at 10-14, etc. | ||
| 212 | * `SHOOTING_STAR_ANIMATION_SPEED` - configures the number of frames you want to animate the shooting stars at. | ||
| 213 | Must be equal to or lower than `NUMBER_OF_FRAMES`. | ||
| 214 | Example: | ||
| 215 | ```c | ||
| 216 | #define NUMBER_OF_FRAMES 20 | ||
| 217 | #define SHOOTING_STAR_ANIMATION_SPEED 5 | ||
| 218 | ``` | ||
| 219 | would result in the shooting star animation happening every 4 frames. 20 would result in every frame, | ||
| 220 | 1 would be once every 20 frames. This essentially changes how fast the stars move through the sky. | ||
| 221 | |||
| 222 | |||
| 223 | ## Island | ||
| 224 | |||
| 225 | The 🏝 island animation is a 32w x 16h animation of a small island with a single palm tree blowing in the wind. The faster | ||
| 226 | you type the harder the palm tree blows in the wind! | ||
| 227 | |||
| 228 | Since this animation has significant black space to the left side of the tree, certain design decisions were made to allow the | ||
| 229 | shooting stars to still show up in the sky there. This animation should work on any size screen >=32 pixels wide, and you | ||
| 230 | can place it anywhere on the screen, but above the ocean is recommended. | ||
| 231 | |||
| 232 | ### Flags | ||
| 233 | |||
| 234 | * `ISLAND_LINE` - where to render the island at. Defaults to `12`. The island is 2 lines tall. (see [reference](#reference)) | ||
| 235 | * `ISLAND_COLUMN` - where to render the island at. Defaults to `0`. The island is 32 pixels wide. (see [reference](#reference)) | ||
| 236 | * `ISLAND_CALM` - Defines the WPM at which the _Storm Ferocity_ kicks up. | ||
| 237 | At any WPM between `ISLAND_CALM` and `ISLAND_HEAVY_STORM`, the palm tree will just calmly blow in the wind. | ||
| 238 | * `ISLAND_HEAVY_STORM` - Defines the WPM at which the _Storm Ferocity_ kicks up. | ||
| 239 | At any WPM between `ISLAND_HEAVY_STORM` and `ISLAND_HURRICANE`, the palm tree will be blowing hard in the wind | ||
| 240 | * `ISLAND_HURRICANE` - Defines the WPM at which the _Storm Ferocity_ kicks up. | ||
| 241 | At any WPM above `ISLAND_HURRICANE`, the palm tree will almost be torn from its roots! | ||
| 242 | |||
| 243 | |||
| 244 | # Reference | ||
| 245 | |||
| 246 | Any reference to `_LINE` or `COLUMN` refers to setting a cursor position using `oled_set_cursor()`, which uses | ||
| 247 | `OLED_FONT_WIDTH` and `OLED_FONT_HEIGHT` internally. | ||
| 248 | This will be the top-leftmost pixel of the image, so `_LINE 1` would start at the 9th pixel down and `_COLUMN 1` | ||
| 249 | would be the 7th pixel to the right, starting from the topleftmost pixel on the screen. | ||
| 250 | |||
| 251 | This code has been untested with different font heights/widths, so you might have to adjust a bit to make it work if you | ||
| 252 | have modified those values. | ||
| 253 | |||
| 254 | # ToDo | ||
| 255 | |||
| 256 | - [ ] don't require `is_calm` as a keyboard event. Not sure if the code will work without it currently. | ||
| 257 | - [ ] make all the stars twinkle brightly based on keypresses rather than timed. Not just a movement twinkle, but a larger | ||
| 258 | 'full' twinkle, where the star actually gets bigger. This will be quite difficult, thus is left out of the v1. | ||
