Animation with Slider Controls in GUIDE
The two sliders allow you to change light direction during animation and function
independently, but they query one another's value because both parameters are needed
to specify a view.
The Show grid check box toggles the Visible property of the graticule surface object.
The axes1_CreateFcn initializes the graticule and then hides it until you select this
option.
The Spin button's callback reads the Make movie check box value to accumulate movie
frames and saves the movie to a MAT-file when rotation is stopped or after one full
revolution, whichever comes first. (You must select Make movie before spinning the
globe.)
The Property Inspector was used to customize the uicontrols and text by:
- Setting the figure Color to black, as well as the BackgroundColor,
ForegroundColor, and ShadowColor of the three uipanels. (They are used as
containers only, so they do not need to be visible.) - Coloring all static text yellow and uicontrol backgrounds either black or yellow-gray.
- Giving all uicontrols mnemonic names in their Tag string.
- Setting the FontSize for uicontrols to 9 points.
- Specifying nondefault Min and Max values for the sliders.
- Adding tooltip strings for some controls.
The following sections describe the interactive techniques used in the UI.
Alternate the Label of a Push Button
The top right button, initially labeled Spin, changes to Stop when clicked, and back to
Spin clicked a second time. It does this by comparing its String property to a pair of
strings stored in the handles structure as a cell array. Insert this data into the handles
structure in spinstopbutton_CreateFcn, as follows:
function spinstopbutton_CreateFcn(hObject, eventdata, handles)
handles.Strings = {'Spin';'Stop'};
guidata(hObject, handles);
The call to guidata saves the updated handles structure for the figure containing
hObject, which is the spinstopbutton push button object. GUIDE named this object
pushbutton1. It was renamed by changing its Tag property in the Property Inspector.
As a result, GUIDE changed all references to the component in the UI' code file when the