Download presentation

Presentation is loading. Please wait.

Published byJairo Allmand Modified over 2 years ago

1
FUN WITH SHAPES INFORMATION PROCESSING 10 MR. MELLESMOEN

2
USING WHAT WEVE LEARNED Were going to have some fun in this chapter with whatever weve learned so far. This lesson contains samples that show some interesting ways of combining all that youve 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! A variant of the previous program, draws circles instead of squares. 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

6
RANDOMIZE! Im 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

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google