INQ241B
Mobile Apps

Activity 5

Actions

  1. Create a new script with the function asterisk() that draws an asterisk. For example, ▹asterisk should produce a drawing like the following:

    asterisk
  2. Add the function asterisk row(length : Number) to the script from the previous excercise to draw a row of asterisks, each touching the neighboring asterisks. For example, ▹asterisk row(5) should produce a drawing like the following:

    asterisk_row
    The distance between the center of neighboring askterisks can be computed with the equation:

    2 * s * cos(0.523598776)

    where s is the size of one of the lines that makes up the asterisk. To compute the cosine, use the math→cos function.

  3. Modify the script from the previous excercise to draw multiple rows of asterisks, each offset, but touching the neighboring row of asterisks. For example:

    asterisk_grid
    The vertical distance between neighboring rows of asterisks can be computed with the equation:

    3 * s * sin(0.523598776)

    where s is the size of one of the lines that makes up the asterisk. Note, you will also need to compute the horizontal offest for each row.

Submission

Please show your source code and run your scripts for the instructor or lab assistant.