z0b's realm

Effects: BarTwister

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
Filebartwister.zip
Size24 KiB (24832 bytes)
ReleasedJul 5. 2011
SHA-2563c797715d68e067f3166afd43dc799ac5edfb01c28b9f2bab47516451b4c4557

Precompiled x86 Windows executable
Filebartwister_win.zip
Size56 KiB (56896 bytes)
ReleasedJul 5. 2011
SHA-25603aebb9f152027339bd66f39394e78d9851b7805ebc741244ccd02de30da1f77