Active Forums > QB64 Discussion
Small graphics programming challenge
(1/1)
Richard Frost:
' Small programming challenge contained at:
'
' It's a boring hour and a half of some guy creating CSS code for a simple animation to:
' 1) Have 8 icons/pictures rotating in a circle, while pulsing
' 2) when one selected, stop all rotation, the pulsing of the selected item, and
' identify the selected item
' Use any 8 pix you've got handy, or the flags I've attached here.
--- Code: QB64: ---Data albania,britain,canada,eu,us,japan,israel,chinaScreen _NewImage(800, 600, 32)For i = 1 To 8 Read name$(i) pix(i) = _LoadImage("f_" + name$(i) + ".png")Next itd = 1 ' throb directionDo: _Limit 10 While _MouseInput mx = _MouseX my = _MouseY mb = _MouseButton(1) Wend Cls hl = 0 ' highlight For i = 1 To 8 r = _D2R(i * 45 + aa) ' angle in radians x = 400 + 200 * Cos(r) y = 300 + 200 * Sin(r) tt = th ' temporary throb = current If mb And (Abs(x - mx) < 30) And (Abs(y - my) < 30) Then ' selected tt = 0 ' temporary throb off hl = 1 ' highlight on _PrintString (x - 26, y - 50), name$(i) End If _PutImage (x - 30 + tt, y - 30 + tt)-(x + 30 - tt, y + 30 - tt), pix(i), 0 Next i _Display ' optional, eliminates flickering aa = (aa - (hl = 0)) Mod 360 ' angle advance th = th + td ' throb If Abs(th) = 3 Then td = -td ' throb directionLoop Until Len(InKey$)
SMcNeill:
He stopped halfway... I've got this on here somewhere, except my version lets you click on the circles and use them as a pop-up menu. :P
bplus:
Hi @Richard Frost
There is naming problem with the Flag files see attached snap
[ You are not allowed to view this attachment ]
Richard Frost:
Attachment fixed. Sorry for posting the message twice. Mornings......
bplus:
--- Quote from: Richard Frost on April 14, 2022, 11:14:57 am ---Attachment fixed. Sorry for posting the message twice. Mornings......
--- End quote ---
Yeah mornings, flag file names are the same.
Navigation
[0] Message Index
Go to full version