hlxldb

LED光立方制作全过程(三十七)

0
阅读(2690)

 Step 58Software: Effect 2, plane boing Software: Effect 2, plane boing

 

Software: Effect 2, plane boing

 
 
i
 
i
 

Software: Effect 2, plane boing

Software: Effect 2, plane boing

 
i
 
 
i
i
Another simple effect, effect_planboing(int plane, int speed).

This effect draws a plane along the specified axis then moves it from position 0 to 7 on the axis and back again. This is very simple, but it really brings out the depth of the 3d LED cube :)

This function doesn't have an iteration loop. Instead it is called twice for each axis in launch_effect().

Here is what it does:

1) For()-loop i from 0 to 7.

2) Clear the cube with fill(0x00);

3) Call setplane() to draw a plane along the desired axis at position i. The plane isn't actually drawn on the axis specified, it is drawn on the other two axis. If you specify AXIS_Z, a plane is drawn on axis X and Y. It's just easier to think of it that way. Instead of having constants named PLANE_XY, PLANE_YZ etc.

4) Delay for a while.

5) Repeat the same loop with i going from 7 to 0.

Very simple, but a very cool effect!