indexing description: "[ Exhibit box showcasing light- and rotator-boxes ]" author: "" date: "$Date$" revision: "$Revision$" class EXHIBIT_CANDY_BOX inherit EXHIBIT_BOX create make feature -- Access title: STRING is "Eye-Candy" -- Title description: STRING is -- Description "Background and border-boxes are not the only decorator boxes. There's also % %light-boxes, which will light it's contents with a simple diffuse, directional % %light source. And then there's rotator boxes, which rotate their contents % %some degrees around an arbitrary 3d axis%N% %The main purpose of these two classes is to make presentations visually appealing. % %Especially boxes with three dimensional content look much better if they are lit, % %because the lighting makes it possible to differentiate between front- and side-faces.%N% %" rotator: EM_VIZ_ROTATOR_BOX [EM_VIZ_BOX] -- Used to rotate box illuminator: EM_VIZ_LIGHT_BOX [EM_VIZ_BOX] -- Light box indicator: EM_VIZ_COLOR_BOX -- Color box with same color as light feature -- Manufacturing create_exhibit is -- local cboxes: EM_VIZ_VERTICAL_BOX [EM_VIZ_COLOR_BOX] cbox: EM_VIZ_COLOR_BOX do create_column_layout (2) -- Color boxes create cboxes.make cboxes.set_horizontal_alignment (Align_center) cboxes.set_depth_alignment (Align_center) create cbox.make ([20.0, 40.0, 80.0], [255, 255, 255, 195]) cboxes.put_last (cbox) create cbox.make ([40.0, 40.0, 60.0], [255, 0, 0, 195]) cboxes.put_last (cbox) create cbox.make ([60.0, 40.0, 40.0], [ 0, 255, 0, 195]) cboxes.put_last (cbox) create cbox.make ([80.0, 40.0, 20.0], [ 0, 0, 255, 195]) cboxes.put_last (cbox) -- Color box 2 create indicator.make ([80.0, 80.0, 0.0], [255, 0, 0]) -- Rotate and illuminate by boxing create rotator.make create illuminator.make illuminator.set_light_color ([255, 0, 0]) -- Assemble rotator.put (cboxes) illuminator.put (rotator) put_column_title ("Colored box with same color as light", 1) put_column_content (indicator, 1) put_column_title ("Rotating boxes (white, red, green, blue) which are illuminated", 2) put_column_content (illuminator, 2) exhibit := column_layout end feature -- Animation go_to_time (a_time: INTEGER) is -- Rotate local r, g, b: INTEGER do r := (128 + 127*cosine (3.0 * a_time / 2000.0)).rounded g := (128 + 127*cosine (4.0 * a_time / 2000.0)).rounded b := (128 + 127*cosine (5.0 * a_time / 2000.0)).rounded illuminator.set_light_color ([r, g, b]) indicator.set_color ([r, g, b]) rotator.set_rotation_axis ([0.3, 0.4, 0.5]) rotator.set_rotation_angle (a_time / 1000.0 * 72.0) end end