Effects: BarTwister
This is some weird 2D/3D effect I wrote a long time after seeing it in some demo. Basically, it's a textured 2D bar that spins. But different parts of the bar can spin in different speeds. Various shadings and other things can be applied freely. The bar can be either horizontal or vertical. The demo here works horizontally, but can be changed easily.
How it is done? Simple: split the visible area to slices in X direction (assuming horizontal here). Then, for each slice, treat it as a four 3D vertices and rotate them (each slice gets its rotation angle from some "twisting equation"). Figure out which of the four sides are visible and draw them by interpolating the texture between two Y coordinates. Yes, like so many other things, it is faked 3D.
This actual effect code is somewhat old, I dug it up some time ago. I cleaned it up and even commented it. It was written for Allegro 4.x (or even 3.x?) originally, but I ported it to SDL. The effect itself is, of course, operating/windowing system agnostic. I quickly made a new texture (ugly) for it because the original has been long lost.
The demo has five equations, change them by pressing 1-5. If you come up with some creative equations, send them to me and I might add them to the program. Other obvious improvements would be texture filtering and anti-aliasing.
BarTwister source | |
---|---|
File | bartwister.zip |
Size | 24 KiB (24832 bytes) |
Released | Jul 5. 2011 |
SHA-256 | 3c797715d68e067f |
Precompiled x86 Windows executable | |
---|---|
File | bartwister_win.zip |
Size | 56 KiB (56896 bytes) |
Released | Jul 5. 2011 |
SHA-256 | 03aebb9f15202733 |