Canvas snippets: Difference between revisions

Jump to navigation Jump to search
(→‎Adding GUI Buttons: Added 2 minimal examples)
(→‎Adding Text Elements: Adding a text.)
Line 67: Line 67:
== Adding Vector Images ==
== Adding Vector Images ==
== Adding Text Elements ==
== Adding Text Elements ==
{| class="wikitable"
|-
! Screenshot !! Code !!
|-
| please upload ...||
|
{{Note|This assumes that you already have a top-level root group set up, and named it '''root'''.}}
<syntaxhighlight lang="nasal" enclose="div">
    var myText = root.createChild("text")
      .setText("Hello world!")
      .setFontSize(80, 0.9)          # font size (in texels) and font aspect ratio
      .setColor(1,1,1,1)            # white, fully opaque
      .setAlignment("center-center") # how the text is aligned to where you place it
      .setTranslation(250, 250);    # where to place the text
</syntaxhighlight>
|-
|}


== Adding GUI Labels ==
== Adding GUI Labels ==
579

edits

Navigation menu