1 / 11

Fun with shapes

Fun with shapes. Information processing 10 Mr. mellesmoen. Using what we’ve learned. We’re going to have some fun in this chapter with whatever we’ve learned so far. 

Download Presentation

Fun with shapes

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Fun with shapes Information processing 10 Mr. mellesmoen

  2. Using what we’ve learned We’re going to have some fun in this chapter with whatever we’ve learned so far.  This lesson contains samples that show some interesting ways of combining all that you’ve learned so far to create some cool looking programs. 

  3. Rectanglor! The following program will draw a series of rectangles increasing in size with each loop of the program. GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.PenColor = "LightBlue" GraphicsWindow.Width = 200 GraphicsWindow.Height = 200 For i = 1 To 100 Step 5 GraphicsWindow.DrawRectangle(100 - i, 100 - i, i * 2, i * 2) EndFor

  4. Result… It should look like this:

  5. Circtacular! GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.PenColor = "LightGreen" GraphicsWindow.Width = 200 GraphicsWindow.Height = 200 For i = 1 To 100 Step 5 GraphicsWindow.DrawEllipse(100 - i, 100 - i, i * 2, i * 2) EndFor A variant of the previous program, draws circles instead of squares.

  6. Randomize! I’m not even going to tell you what this creates, however if entered correctly it should be pretty cool. GraphicsWindow.BackgroundColor = "Black" For i = 1 To 1000 GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() x = Math.GetRandomNumber(640) y = Math.GetRandomNumber(480) GraphicsWindow.FillEllipse(x, y, 10, 10) EndFor

  7. Play with the numbers In your randomize program, play with some of the numbers to see what happens.

  8. fractals The program I will hand out draws a simple triangle fractal using random numbers. A fractal is a geometric shape that can be subdivided into parts, each of which resembles the parent shape accurately.

  9. Play with this program Insert the following line Program.delay(2) between GraphicsWindow.SetPixel(x, y, "LightGreen") EndFor Program.delay(2)

  10. LAST CHANGE In your program you have the line: GraphicsWindow.SetPixel(x, y, "LightGreen") as your second last line of code. Replace that line with these lines: color = GraphicsWindow.GetRandomColor() GraphicsWindow.SetPixel(x, y, color)

  11. Done! Make sure you save your work 

More Related