Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
37
Task/Plasma-effect/FreeBASIC/plasma-effect.basic
Normal file
37
Task/Plasma-effect/FreeBASIC/plasma-effect.basic
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
' version 12-04-2017
|
||||
' compile with: fbc -s gui
|
||||
' Computer Graphics Tutorial (lodev.org), last example
|
||||
|
||||
#Define dist(a, b, c, d) Sqr(((a - c) * (a - c) + (b - d) * (b - d)))
|
||||
|
||||
Const As ULong w = 256
|
||||
Const As ULong h = 256
|
||||
ScreenRes w, h, 24
|
||||
WindowTitle ("Plasma effect")
|
||||
|
||||
Dim As ULong x, y
|
||||
Dim As UByte c
|
||||
Dim As Double time_, value
|
||||
|
||||
Do
|
||||
time_ += .99
|
||||
ScreenLock
|
||||
For x = 0 To w -1
|
||||
For y = 0 To h -1
|
||||
value = Sin(dist(x + time_, y, 128, 128) / 8) _
|
||||
+ Sin(dist(x, y, 64, 64) / 8) _
|
||||
+ Sin(dist(x, y + time_ / 7, 192, 64) / 7) _
|
||||
+ Sin(dist(x, y, 192, 100) / 8) + 4
|
||||
' c = Int(value) * 32
|
||||
c = int(value * 32)
|
||||
PSet(x, y), RGB(c, c * 2, 255 - c)
|
||||
Next
|
||||
Next
|
||||
ScreenUnLock
|
||||
Sleep 1
|
||||
|
||||
If Inkey <> "" Or Inkey = Chr(255) + "k" Then
|
||||
End
|
||||
End If
|
||||
|
||||
Loop
|
||||
Loading…
Add table
Add a link
Reference in a new issue