Home | Pictures of 3D objects |
With the label object you can display text in a box, and the label always faces forward, even if you rotate the scene (for 3D text, see the text object). Here is a simple example: label( pos=vec(0,0.25,0), text='Hello!' )
pos The point in world space being labeled. pixel_pos If True, pos is the position in terms of pixels, with vec(0,0,0) in the lower left corner. align Specify 'left', 'right', or 'center'. When you specify 'center', which is the default, the center of the topmost line of text is at the location given by pos. When you specify 'left', the start of the topmost line of text is at the location given by pos. When you specify 'right', the right end of the topmost line of text is at the location given by pos. xoffset, yoffset The x and y components of the line, in pixels (see diagram). Unless you specify a value for align, text above or below pos is centered, text to the left of pos is right-adjusted, and text to the right of pos is left-adjusted. text The text to be
displayed, such as 'Earth'.
You can give a number or numerical expression; it will be converted to a string.You can includes the HTML styles for italic (<i> or <em>), bold (<b> or <strong>), superscript (<sup>), or subscript (<sub>). For example, the string font Name of the desired font; 'sans' or 'serif'' or 'monospace' (fixed-width), or a specific font name height Height of the font in pixels; default is 15 pixels color Color of the text; default is white unless scene.background is white, in which case the default is black background Color of the background of the box; default is scene.background opacity Opacity of the background of the box, default 0.66 border Distance in pixels from the text to the surrounding box; default is 5 pixels box True if the box should be drawn (default), else False line true if the line from the box to pos should be drawn (default), else false linecolor Color of the line and box; default is white unless scene.background is white, in which case the default is black; if the label's color is specified, the default linecolor is the same linewidth The width in pixels of the line and box space Radius in real-world coordinates of a sphere surrounding pos, into which the connecting line does not go. visible Label is not displayed if False When you run a program, for convenience GlowScript creates a canvas on the web page and names it scene. canvas.selected. JavaScript See the cylinder documentation for how to create an object in JavaScript. |