Below is the custom BitmapCylinder class in action. The cylinder effect is accomplished in a way that is almost identical as in the case of the coil. The only thing that changes are the parametric equations of the cylinder.
Download
- Download all 'as' and 'fla' files corresponding to this tutorial: rolls.zip
The files corresponding to the applet above are 'roll_2.fla', 'MainAppTwo.as' as well as the BitmapCylinder.as contained in the nested sequence of folders com --> flashandmath --> bitmaps. The files and the 'com' folder have to be in the same directory for the 'fla' file to compile.
The case of the cylinder is, in a sense, easier than the coil as the parametric equations for the cylider in 3D are simpler:
x(t,s)=radius*cos(t), y(t,s)=radius*sin(t), z(t,s)=s,
where t is between 0 and 2*Pi, s is between -picHeight/2 and picHeight/2.
'picHeight' is the height of the image. 'radius' is determined automatically by the class based on the image's width. Of course, the perimeter of the cylinder has to be equal to the width of the image.
As you can see in the code for the BitmapRoll class, we use the following eqauations for the coil:
x(t,s)=(radius/4+radius/(4*Pi))*t*cos(t+Pi),
y(t,s)=(radius/4+radius/(4*Pi))*t*sin(t), z(t,s)=s,
where t is between 0 and 3*Pi, s is between -picHeight/2 and picHeight/2.
Again, 'radius' (the outer radius of the coil) is determined automatically by the class based on the width of the image.
On the next page, we show how to customize the applets.










