not really known
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

622 lines
22 KiB

  1. Using Turtle Art JS
  2. ===================
  3. Turtle Blocks Javascript is designed to run in a browser. Most of the
  4. development has been done in Chrome, but it should also work in
  5. Firefox. You can run it directly from index.html, from a [server
  6. maintained by Sugar Labs](http://turtle.sugarlabs.org), from the
  7. [github
  8. repo](http://rawgit.com/walterbender/turtleblocksjs/master/index.html),
  9. or by setting up a [local
  10. server](https://github.com/walterbender/turtleblocksjs/blob/master/server.md).
  11. Once you've launched it in your browser, start by clicking on (or
  12. dragging) blocks from the Turtle palette. Use multiple blocks to
  13. create drawings; as the turtle moves under your control, colorful
  14. lines are drawn.
  15. You add blocks to your program by clicking on or dragging them from
  16. the palette to the main area. You can delete a block by dragging it
  17. back onto the palette. Click anywhere on a "stack" of blocks to start
  18. executing that stack or by clicking on the rabbit (fast) or snail
  19. (slow) on the Main Toolbar. To maximize screen real estate, Turtle
  20. Blocks overlays the program elements (stacks of blocks) on top of the
  21. canvas. These blocks can be hidden at any time will running the program.
  22. Toolbars
  23. --------
  24. There are three toolbars: (1) the main toolbar across the top of the
  25. screen; (2) the secondary toolbar on the right side of the screen; and
  26. (3) the palette toolbar on the right side of the screen. An additional
  27. menu appears when a "long press" is applied to a stack of
  28. blocks. There is also a utility panel with additional controls.
  29. Main toolbar
  30. ------------
  31. The Main toolbar is used to run programs, erase the screen, and hide
  32. the palettes and blocks.
  33. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/fast-button.png'</img>
  34. Run the blocks fast.
  35. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/slow-button.png'</img>
  36. Run the blocks slowly. When running slowly, the values of parameter
  37. boxes are shown as an additional debugging aid.
  38. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/step-button.png'</img>
  39. Run the blocks step by step (one block is executed per turtle per click).
  40. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/stop-turtle-button.png'</img>
  41. Stop running the current project.
  42. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/clear-button.png'</img>
  43. Clear the screen and return the turtles to their initial positions in
  44. the center of the screen.
  45. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/palette-button.png'</img>
  46. Hide or show the block palettes.
  47. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/hide-blocks-button.png'</img>
  48. Hide or show the blocks and the block palettes.
  49. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/collapse-blocks-button.png'</img>
  50. Expand or collapse stacks of blocks (start and action stacks).
  51. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/help-button.png'</img>
  52. Show the help messages.
  53. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/menu-button.png'</img>
  54. Expand or collapse the auxillary toolbar.
  55. Auxillary toolbar
  56. -----------------
  57. The Auxillary toolbar, displayed on the right side of the screen, has
  58. buttons for various utilities such as accessing the planet for saving
  59. programs, overlaying grids, and accessing the utility panel. The
  60. Auxillary toolbar button on the Main toolbar (top right) is used to
  61. show/hide the Auxillary toolbar.
  62. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/planet-button.png'</img>
  63. Open a viewer for loading example projects.
  64. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/copy-button.png'</img>
  65. Copy blocks onto the clipboard. (This button appears at the top of a
  66. stack after a "long press".)
  67. Also shown on after a long press is the Save Action-stack button. This
  68. will save an action stack on the custom palette for use in other
  69. projects.
  70. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/paste-button.png'</img>
  71. Paste blocks from the clipboard. (This button is highlighted only when
  72. there are blocks available on the clipboard to paste.)
  73. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/Cartesian-button.png'</img>
  74. Show or hide a Cartesian-coordinate grid.
  75. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/polar-button.png'</img>
  76. Show or hide a polar-coordinate grid.
  77. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/utility-button.svg'</img>
  78. Open utility panel to access controls for changing block size, loading
  79. plugins, looking at project statistics, and enabling/disabling
  80. scrolling.
  81. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/empty-trash-button.png'</img>
  82. Remove all blocks.
  83. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/restore-trash-button.png'</img>
  84. Restore blocks from the trash.
  85. Utility panel
  86. -------------
  87. The utility panel has some useful but seldom used controls.
  88. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/smaller-button.svg'</img>
  89. Decrease the size of the blocks.
  90. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/bigger-button.svg'</img>
  91. Increase the size of the blocks.
  92. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/stats-button.svg'</img>
  93. Show project statistics.
  94. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/plugin-button.png'</img>
  95. Load new blocks from plugins (previously downloaded to the file system).
  96. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/scrolllock-button.svg'</img>
  97. Enable/disable scrolling.
  98. Block Palettes
  99. --------------
  100. The block palettes are displayed on the left side of the screen. The
  101. palette button on the Main toolbar show and hide the block
  102. palettes. These palettes contain the blocks used to create
  103. programs. See the [Programming Guide]
  104. (http://github.com/walterbender/turtleblocksjs/tree/master/guide) for
  105. more details on how to use the blocks.
  106. Turtle Palette
  107. --------------
  108. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/clear.svg'</img>
  109. Clear the screen and reset the turtle.
  110. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/forward.svg'</img>
  111. Move turtle forward.
  112. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/right.svg'</img>
  113. Turn turtle clockwise (angle in degrees).
  114. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/back.svg'</img>
  115. Move turtle backward.
  116. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/left.svg'</img>
  117. Turn turtle counterclockwise (angle in degrees).
  118. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/arc.svg'</img>
  119. Move turtle along an arc.
  120. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/set_heading.svg'</img>
  121. Set the heading of the turtle (0 is towards the top of the screen).
  122. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/heading.svg'</img>
  123. The current heading of the turtle (can be used in place of a number block)
  124. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/setxy.svg'</img>
  125. Move turtle to position xcor, ycor; (0, 0) is in the center of the screen.
  126. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/x.svg'</img>
  127. Current x-coordinate value of the turtle (can be used in place of a number block)
  128. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/y.svg'</img>
  129. Current y-coordinate value of the turtle (can be used in place of a number block)
  130. Pen Palette
  131. -----------
  132. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/set_color.svg'</img>
  133. Set color of the line drawn by the turtle (hue, shade, and grey).
  134. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/color.svg'</img>
  135. Current pen color (can be used in place of a number block)
  136. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/set_hue.svg'</img>
  137. Set hue of the line drawn by the turtle (hue is the spectral color, e.g., red, orange, yellow, green, blue, purple, etc.).
  138. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/set_shade.svg'</img>
  139. Set shade of the line drawn by the turtle (shade is lightness, e.g., black, grey, white).
  140. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/shade.svg'</img>
  141. Current pen shade (can be used in place of a number block)
  142. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/set_grey.svg'</img>
  143. Set grey level of the line drawn by the turtle (grey is vividness or saturation).
  144. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/grey.svg'</img>
  145. Current grey level (can be used in place of a number block)
  146. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/set_pen_size.svg'</img>
  147. Set size of the line drawn by the turtle.
  148. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/pen_size.svg'</img>
  149. Current pen size (can be used in place of a number block)
  150. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/pen_up.svg'</img>
  151. Turtle will not draw when moved.
  152. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/pen_down.svg'</img>
  153. Turtle will draw when moved.
  154. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/fill.svg'</img>
  155. Draw filled polygon.
  156. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/hollow.svg'</img>
  157. Set pen attribute to hollow line mode (useful for working with 3D printers).
  158. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/set_font.svg'</img>
  159. Set the font of the text drawn with Show Block.
  160. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/background.svg'</img>
  161. Set the background color.
  162. Number Palette
  163. --------------
  164. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/number.svg'</img>
  165. Use as numeric input in mathematic operators (click to change the value).
  166. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/random.svg'</img>
  167. Returns random number between minimum (top) and maximum (bottom) values
  168. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/one-of.svg'</img>
  169. Returns one of two inputs as determined by a coin toss (random selection)
  170. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/plus.svg'</img>
  171. Adds two numeric inputs (also can be used to concatenate two strings)
  172. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/subtract.svg'</img>
  173. Subtracts bottom numeric input from top numeric input
  174. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/multiply.svg'</img>
  175. Multiplies two numeric inputs
  176. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/divide.svg'</img>
  177. Divides top numeric input (numerator) by bottom numeric input (denominator)
  178. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/sqrt.svg'</img>
  179. Calculates square root
  180. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/int.svg'</img>
  181. Converts real numbers to integers
  182. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/mod.svg'</img>
  183. Returns top input modular (remainder) bottom input.
  184. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/eval.svg'</img>
  185. A programmable block used to add advanced single-variable math equations, e.g., sin(x).
  186. Boolean Palette
  187. ---------------
  188. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/greater_than.svg'</img>
  189. Logical greater-than operator
  190. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/less_than.svg'</img>
  191. Logical less-than operator
  192. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/equal.svg'</img>
  193. Logical equal-to operator
  194. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/and.svg'</img>
  195. Logical AND operator
  196. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/or.svg'</img>
  197. Logical OR operator
  198. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/not.svg'</img>
  199. Logical NOT operator
  200. Flow Palette
  201. ------------
  202. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/repeat.svg'</img>
  203. Loops specified number of times through enclosed blocks
  204. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/forever.svg'</img>
  205. Loops forever through enclosed blocks
  206. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/stop.svg'</img>
  207. Stops current loop or action
  208. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/if.svg'</img>
  209. If-then operator that uses boolean operators to determine whether or not to run encloded "flow"
  210. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/until.svg'</img>
  211. Do-until-True operator that uses boolean operators to determine how long to run enclosed "flow"
  212. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/wait_for.svg'</img>
  213. Waits for condition
  214. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/while.svg'</img>
  215. Do-while-True operator that uses boolean operators to determine how long to run enclosed "flow"
  216. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/if_else.svg'</img>
  217. If-then-else operator that uses boolean operators to determine which encloded "flow" to run
  218. Boxes Palette
  219. -------------
  220. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/storein.svg'</img>
  221. Stores value in named variable.
  222. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/box_value.svg'</img>
  223. Named variable
  224. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/add_1_to.svg'</img>
  225. Adds 1 to named variable
  226. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/add_to.svg'</img>
  227. Adds numeric value to named variable
  228. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/box.svg'</img>
  229. Named variable (name is passed as input)
  230. Action Palette
  231. --------------
  232. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/action_flow.svg'</img>
  233. Top of nameable action stack
  234. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/action.svg'</img>
  235. Invokes named action stack
  236. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/do_arg.svg'</img>
  237. Invokes an action stack with arguments (To add more arguments, drag them into the clamp.)
  238. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/calc.svg'</img>
  239. Invokes an action stack that returns a value
  240. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/calc_arg.svg'</img>
  241. Invokes an action stack with arguments that returns a value
  242. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/return.svg'</img>
  243. Returns a value from an action stack
  244. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/arg.svg'</img>
  245. An argument passed to an action stack
  246. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/arg1.svg'</img>
  247. The first argument passed to an action stack
  248. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/start.svg'</img>
  249. Connects action to toolbar run buttons (each Start Block invokes its own turtle)
  250. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/do.svg'</img>
  251. Invokes named action stack (name is passed as input)
  252. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/event_on_do.svg'</img>
  253. Connects an action with an event
  254. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/broadcast.svg'</img>
  255. Broadcasts an event (event name is given as input)
  256. Media Palette
  257. -------------
  258. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/speak.svg'</img>
  259. Speaks text
  260. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/show.svg'</img>
  261. Draws text or shows media (from the camera, the Web, or the file system).
  262. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/size_shell_image.svg'</img>
  263. Puts a custom "shell" on the turtle (used to turn a turtle into a "sprite")
  264. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/text.svg'</img>
  265. Text (string) value
  266. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/load-media.svg'</img>
  267. Opens a file-open dialog to load an image (used with Show Block)
  268. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/camera.svg'</img>
  269. Accesses webcam (used with Show Block)
  270. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/video.svg'</img>
  271. Opens a file-open dialog to load a video (used with Show Block)
  272. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/open_file.svg'</img>
  273. Returns the selected file (used with Show Block)
  274. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/stop_media.svg'</img>
  275. Stops the media being played
  276. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/tone.svg'</img>
  277. Plays a tone at frequency (Hz) and duration (in seconds)
  278. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/note_to_frequency.svg'</img>
  279. Converts notes to frequency, e.g., A4 --> 440 Hz.
  280. Sensor Palette
  281. --------------
  282. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/time.svg'</img>
  283. Elapsed time (in seconds) since program started
  284. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/mouse_x.svg'</img>
  285. Returns mouse X coordinate
  286. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/mouse_y.svg'</img>
  287. Returns mouse Y coordinate
  288. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/mouse_button.svg'</img>
  289. Returns True if mouse button is pressed
  290. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/keyboard.svg'</img>
  291. Holds results of query-keyboard block as ASCII
  292. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/pixel_color.svg'</img>
  293. Returns pixel color under turtle
  294. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/loudness.svg'</img>
  295. Microphone input volume
  296. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/click.svg'</img>
  297. The "click" event associated with a turtle (used with Do Block)
  298. Heap Palette
  299. ------------
  300. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/push.svg'</img>
  301. Push a value onto the heap.
  302. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/pop.svg'</img>
  303. Pop a value off of the heap.
  304. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/index_heap.svg'</img>
  305. Reference an entry in the heap.
  306. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/set_heap_entry.svg'</img>
  307. Change an entry in the heap.
  308. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/show_heap.svg'</img>
  309. Display the contents of the heap.
  310. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/heap_length.svg'</img>
  311. The length of the heap.
  312. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/empty_heap.svg'</img>
  313. Empty the heap.
  314. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/heap_empty.svg'</img>
  315. True is the heap is empty.
  316. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/save_heap.svg'</img>
  317. Save the heap to a file (JSON-encoded).
  318. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/load_heap.svg'</img>
  319. Load the heap from a file (JSON-encoded).
  320. Extras Palette
  321. --------------
  322. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/vspace.svg'</img>
  323. Used to layout blocks vertically
  324. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/hspace.svg'</img>
  325. Used to layout blocks horizontally
  326. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/wait.svg'</img>
  327. Pauses turtle a specified number of seconds
  328. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/print.svg'</img>
  329. Prints value
  330. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/save_svg.svg'</img>
  331. Saves turtle graphics as an SVG file
  332. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/show_blocks.svg'</img>
  333. Shows blocks and runs slowly (used to isolate code during debugging)
  334. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/hide_blocks.svg'</img>
  335. Hides blocks and runs at full speed (used to isolate code during debugging)
  336. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/play_back.svg'</img>
  337. Plays media
  338. <img src='https://rawgithub.com/walterbender/turtleblocksjs/master/documentation/stop_play.svg'</img>
  339. Stops playing media