Sine Scroller
You'll draw a bitmap font, scroll a line of greetings across the screen and bend it along a wave, the way every cracktro did.
About
The scrolltext is where the scene came from: a line of greetings rolling under a logo on a cracked game. It teaches you to blit glyphs out of a font sheet, to move things a fixed amount every frame so they don't judder, and to offset each column with a sine table. Your own code only; a text library drawing wavy letters doesn't count, and neither does an HTML marquee. Draw the font yourself in a free pixel editor like LibreSprite or Piskel, or use a free 8 by 8 font and credit it.
At a glance
- Per requirement
- 15 XP
- Completion bonus
- 75 XP
- Requirements
- 5
- Takes
- One evening
- Skill level
- Beginner (done it a few times)
- Cost
- Free
- Supplies
- Nothing special
- Where
- At home
- Other people
- On your own
Requirements
-
1
Draw or pick a bitmap font sheet with at least 40 glyphs. You need A to Z, 0 to 9, a space and a few punctuation marks on a grid of 8 by 8 or 16 by 16 pixel cells. Draw it in a free pixel editor, or use a free font sheet and write down who made it. Take a screenshot of the whole sheet. Photo
-
2
Render a line of text by copying glyph rectangles out of the sheet. Each character is an index into the sheet, so the glyph for A is at column 0, B at column 1, and so on. Copy the cell for each letter into your buffer side by side, with no text drawing function from any library. Take a screenshot of a word rendered this way next to the line of code that picks the glyph rectangle. Photo
-
3
Scroll the text right to left, locked to the display refresh. Use requestAnimationFrame or vsync, move the text a fixed one or two pixels every frame, and wrap the string so it never ends. If it stutters, the usual cause is a frame that occasionally takes too long, so draw less or draw smaller. Film ten seconds, close enough to the screen to see the motion. Video
-
4
Bend the text with a per-column sine offset. Draw the scroller one pixel column at a time and offset each column vertically by amplitude times sin(x times frequency plus time). Start with the offset per glyph, which is cheaper and blockier, then switch to per column and see the difference. Film the wave running. Video
-
5
Write a real scrolltext with at least five greetings and record 30 seconds. The tradition is to greet the people and groups who helped you, so name five. Add a title above the scroller, record a 30-second clip, and post it with a link to your source. Video