Text
Represents an arbitrary text label placed as a Graphics3D object
Text["String", {0,0,0}]
Supports styling such as Style
and Directive
, i.e.
Graphics3D[{
Sphere[],
Text[Style["Hello World", FontSize->24], {0,2, 0}]
}]
Or using Directive
Graphics3D[{
Directive[Red, FontSize->20], Text["Hey", {2,0}],
Sphere[]
}]
Styling options
The following options can be provided to Style
wrapper
FontSize->Number
- 10, 12, 14...FontFamily->String
- this is basically an SVG attribute, please see here. If you have imported any font using CSS, you can also use it.
Dynamic updates
For both the position and text content dynamic updates are supported
txt = RandomWord[];
pos = {0,0, 1};
Graphics3D[{
Red, Sphere[], Text[txt // Offload, pos // Offload]
}]
task = SetInterval[With[{},
txt = RandomWord[];
pos = RandomReal[{-1,1}, 3];
], 500];
SetTimeout[TaskRemove[task], 5000];
use TaskRemove[task];
to stop an animation