// Simple bouncing ball -effect made with CoolBasic
 
SCREEN 320, 240, 24, cbsizable
Dim texture(320, 240)
Dim cc(150) As Float
For dd = 0 To 150
	cc(dd) = CurveValue(25, dd, 3) / 25
Next dd
textture = MakeImage(320, 240)
MaskImage textture, 255, 0, 255
Lock Image(textture)
For x = 0 To 319
	For y = 0 To 239
		p = 0
		For i = 0 To 9
			p = p + ((((x Shr i) Mod 2) Xor ((y Shr i) Mod 2)) And ((31 Shr i) Mod 2)) Shl i
		Next i
		texture(x, y) = p Shl 3
		PutPixel2 x, y, p Shl 5 + 10485760, Image(textture)
	Next y
Next x
Unlock Image(textture)
start = Timer()
Repeat
	tm = Timer() - start
	an# = Timer() / 3000.0
	x = tm / 28
	y = 60 + Sin(x * 7) * 35
	For yy = -25 To 25
		For xx = -25 To 25
			dd = Distance(0, 0, xx, yy)
			If dd < 25 And xx + x > 0 Then
				cs# = cc(dd)
				sx = xx * cs + x
				sy = yy * cs + y
				Color texture((sx + 320) Mod 320, (sy + 240) Mod 240), 0, 0
				Box ((x + xx) Shl 1) Mod 320, (y + yy) Shl 1, 2, 2
			EndIf
		Next xx
	Next yy
	SetWindow Str(FPS()), 3
	DrawScreen
Forever