Mesin Pencarian

Custom Search

Monday, December 1, 2008

membuat Program Animasi Bulan dan Bintang

Sekarang kita akan membuat sebuah Form dengan Bulan yang berjalan dan bintang berkelip sebagai latar belakang, seperti contoh hasil program Gbr. 3.1 dikanan.

Untuk prakteknya, langkahnya sebagai berikut…!

1. Pada Form1 yang sudah ada di <Proyek Grafis> anda, Pasanglah objek Picture, dan dua buah Timer seperti rancangan Gbr. 3.2 dikanan.

2. Kemudian…, aturlah propertinya dengan mengikuti properti pada Tbl.3.1 dibawah ini ; klik pada gambar untuk pembesaran image...!!









3. Setelah selesai mengatur properti diatas, Ketik kode-kode program dihalaman belakang berikut ini ;

a. General Prosedur Declarations

Dim x(100), y(100), z(100) As Integer

Dim tmpx(100), tmpy(100), tmpz(100) As Integer

Dim k As Integer

Dim zoom As Integer

Dim kecepatan As Integer

b. Objek Timer2 Prosedur Timer

Private Sub Timer2_Timer( )

If Picture1.Left > 5 Then

Picture1.Move Picture1.Left-100, Picture1.Top-10

End If

End Sub

c. Objek Form Prosedur Activate

Private Sub Form_Activate( )

BackColor = &H0&

kecepatan = -1

k = 2038

zoom = 256

Timer1.Interval = 1

For i = 0 To 100

x(i) = Int(Rnd * 1024) - 512

y(i) = Int(Rnd * 1024) - 512

z(i) = Int(Rnd * 512) - 256

Next i

End Sub

d. Objek Timer1 Prosedur Timer

Private Sub Timer1_Timer( )

For i = 0 To 100

Circle (tmpx(i), tmpy(i)), 5, BackColor

z(i) = z(i) + kecepatan

If z(i) > 255 Then z(i) = -255

If z(i) < -255 Then z(i) = 255

tmpz(i) = z(i) + zoom

tmpx(i) = (x(i) * k / tmpz(i)) + (Form1.Width / 2)

tmpy(i) = (y(i) * k / tmpz(i)) + (Form1.Height / 2)

radius = 1

bintang = 256 - z(i)

Circle (tmpx(i), tmpy(i)), 5, RGB(bintang, bintang, bintang)

Next i

End Sub

Personal Computer

A personal computer (PC) is any computer whose original sales price, size, and capabilities make it useful for individuals, and which is intended to be operated directly by an end user, with no intervening computer operator.

Today a PC may be a desktop, a laptop computer or a tablet computer. The most common operating system are microsoft Windows, Mac OS X and Linux, while the most common microprocessors are x-86 -compatible CPUs, ARM architecture CPUs and Power PC CPUs. Software applications for personal computers include word Processing, spreadsheets, databases, games, and a myriad of personal productivity and special-purpose software. Modern personal computers often have high-speed or dial-up connections to the Internet, allowing access to the Word Wide Web and a wide range of other resources.

A PC may be a home computer, or may be found in an office, often connected to a local area network. The distinguishing characteristics are that the computer is primarily used, interactively, by one person at a time. This is in contrast to the batch processing or time-sharing models which allowed large expensive systems to be used by many people, usually at the same time, or large data processing systems which required a full-time staff to operate efficiently.