☰ Contents · Computing

Graphics, animation and the final test

Lessons 65–67 · 3 lessons · N. I. Taylaqov (general editor), A. B. Akhmedov, M. D. Pardayeva, A. A. Abdug‘aniyev, U. M. Mirsanov. Informatics and Information Technologies, Grade 10, 1st edition. “Extremum-Press”, Tashkent, 2017
66

Practical lesson

Textbook: p. 153
GoalBuilds a graphic and animation project independently: a colour picture, a moving shape and a loading bar; calculates speed and time in advance.
New words
project plan: the list of objects, properties, events and formulas before coding · loyiha rejasiloading bar: a rectangle that grows with time · yuklanish chizig‘iframe: one drawing of the picture in an animation · kadrtesting: running with simple values to compare with a hand calculation · sinov
Explanation

In this practical lesson do one or several of three small projects. 1) “Colour picture”: try the fades RGB(0, i, 255 - i) and RGB(i, i, 0), write down the colours of the left edge, the middle and the right edge in advance and compare them with the picture. 2) “Loading bar”: Interval = 100, global w: Integer; in the Timer w := w + 5; Rectangle(10, 10, 10 + w, 30); when w reaches 200 stop the Timer and show ShowMessage('Tayyor'); the bar fills in 200/5 = 40 steps, 40·100 ms = 4 s. 3) “A car”: a small shape moves from left to right with the step dx = 6 and stops when it reaches the right edge. Before starting write a project plan in your notebook: objects, properties, events and formulas. When showing applications to others avoid fast flashing colours on the screen, and share an application only as a trusted file that you made yourself: do not open unknown .exe files.

Worked examples
Loading bar: w = 5, 10, 15, … 200; the width of Rectangle(10, 10, 10 + w, 30) equals w; 200 pixels and 40 steps. After 10 steps w = 50 and the time passed is 10·100 ms = 1 s; filling takes 4 s, that is 25% every second.
A car: the starting x = 0, dx = 6, the right limit is 300 – width 40 = 260. 260/6 ≈ 43.3: at step 44 x = 264 > 260, so after the check it is stopped (if x >= 260 then Timer1.Enabled := False;). At step 43, x = 258.
Class activity

“The project demo”: each student shows the plan of the chosen project, the calculated expected result and the application in 2 minutes.

Practice
1
w grows by 5 every 100 ms. What are w and the elapsed time after 6 steps?
2
In how many steps does the bar reach 200 pixels with a step of 5?
3
The car has dx = 6 and starts from x = 0. What is x after 20 steps?
4
Why should an unknown .exe file not be opened?