Proggies
#82
Wouldn't that look great for an Easter Egg!

Happy Easter!
Code: (Select All)
_Title "Easter Egg Clock" 'B+ 2022-04-01

' to do - draw the whole face and then save to image then just show time with hands!!!
Randomize Timer
Const xmax = 594, ymax = 706
Const sq = 640 '<<<<<<<<<<<<<< everything is scaled to this
Const xy0 = sq / 2, dr = .6 * xy0, br = .1 * xy0, hh = .52 * xy0, mh = .6 * xy0, sh = .6 * xy0, thk = .01 * xy0
Const pi = 3.141592653589793, pm2 = 2 * pi, pd2 = pi / 2, pm2d12 = 2 * pi / 12, pm2d60 = 2 * pi / 60 ' pi stuff
Const xc = xmax / 2, yc = ymax / 2
Screen _NewImage(xmax, ymax, 32)
_ScreenMove (1200 - sq) / 2, 10
be& = _LoadImage("Brown Egg.png")
Dim Shared pr(12), pg(12), pb(12)
For i = 0 To 12
    pr(i) = Rnd: pg(i) = Rnd: pb(i) = Rnd
Next
Do
    _PutImage , be&, 0
    t# = Timer(.001)
    hour% = Int(t# / 3600)
    If hour% > 12 Then showHr# = t# / 3600 - 12 Else showHr# = t# / 3600
    min# = t# / 60 - hour% * 60
    sec# = t# - hour% * 3600 - Int(min#) * 60
    For r = dr - dr / 11 To dr + dr / 11 Step .25 ' main circle
        Circle (xc, yc), r, &HFFFFFFFF
    Next
    lyne xc, yc - dr, 2 * dr, pd2, dr / 5.5, &HFFFFFFFF
    lyne xc, yc, dr, pi * .25, dr / 5.5, &HFFFFFFFF
    lyne xc, yc, dr, pi * .75, dr / 5.5, &HFFFFFFFF
    For i = 0 To 59
        If i Mod 5 = 0 Then
            x = xc + (dr + 30) * Cos(i * pm2d60): y = yc + (dr + 30) * Sin(i * pm2d60)
            drawEasterEgg x, y, 30, _Atan2(yc - y, xc - x)
        Else
            r = 1
            Circle (xc + dr * Cos(i * pm2d60), yc + dr * Sin(i * pm2d60)), r * .5 * thk, &HFFBF0A30
        End If
    Next
    lyne xc, yc, hh, pm2d12 * showHr# - pd2, 8 * thk, &HFF000AFF
    lyne xc, yc, mh, pm2d60 * min# - pd2, 6 * thk, &HFFBF0A30
    lyne xc, yc, sh, pm2d60 * sec# - pd2, 2 * thk, &HFFFFFF00
    Circle (xc, yc), 3, &HFF000000
    '_Limit 120
    _Display
Loop Until _KeyDown(27)

Sub lyne (x0, y0, lngth, ra, thic, c As _Unsigned Long)
    Dim x As Integer, y As Integer, l As Integer
    While l < lngth
        l = l + 1: x = x0 + l * Cos(ra): y = y0 + l * Sin(ra)
        For radius = 0 To thic / 2
            Circle (x, y), radius, c, BF
        Next
    Wend
End Sub

Sub drawEasterEgg (xc, yc, scale, radianAngle)
    Static index
    index = (index + 1) Mod 12
    Dim r, g, b, x, y, c, a, d
    r = pr(index): g = pg(index): b = pb(index)
    For x = -1 To 1 Step .01
        For y = -1 To 1 Step .01
            If x < 0 Then c = c + .0005 Else c = c - .0005
            If (x * x + (1.4 ^ x * 1.6 * y) ^ 2 - 1) <= .01 Then
                If y > 0 Then
                    Color _RGB32(128 * (1 - y) + 128 * (1 - y) * Sin(c * r), 128 * (1 - y) + 128 * (1 - y) * Sin(c * g), 127 * (1 - y) + 127 * (1 - y) * Sin(c * b))
                Else
                    Color _RGB32(128 + 128 * Sin(c * r), 128 + 128 * Sin(c * g), 127 + 127 * Sin(c * b))
                End If
                a = _Atan2(y, x)
                d = scale * Sqr(x * x + y * y)
                Line (xc + d * Cos(a + radianAngle), yc + d * Sin(a + radianAngle))-Step(1, 1)
            End If
        Next
    Next
End Sub

   

Zip has egg image


Attached Files
.zip   EE clock wo exe.zip (Size: 148.33 KB / Downloads: 20)
b = b + ...
Reply


Messages In This Thread
Proggies - by bplus - 04-24-2022, 04:02 PM
RE: Proggies - by bplus - 04-26-2022, 03:23 PM
RE: Proggies - by bplus - 04-26-2022, 04:24 PM
RE: Proggies - by bplus - 05-01-2022, 12:10 AM
RE: Proggies - by dcromley - 05-01-2022, 04:00 AM
RE: Proggies - by bplus - 05-01-2022, 02:52 PM
RE: Proggies - by bplus - 05-01-2022, 02:56 PM
RE: Proggies - by bplus - 05-01-2022, 08:05 PM
RE: Proggies - by bplus - 05-03-2022, 01:43 AM
RE: Proggies - by vince - 05-03-2022, 02:13 AM
RE: Proggies - by bplus - 05-03-2022, 02:16 AM
RE: Proggies - by bplus - 05-08-2022, 02:13 AM
RE: Proggies - by OldMoses - 05-08-2022, 12:40 PM
RE: Proggies - by bplus - 05-08-2022, 03:16 PM
RE: Proggies - by bplus - 05-16-2022, 12:21 AM
RE: Proggies - by bplus - 05-16-2022, 12:58 AM
RE: Proggies - by PhilOfPerth - 05-16-2022, 01:40 AM
RE: Proggies - by bplus - 05-16-2022, 01:28 AM
RE: Proggies - by SMcNeill - 05-16-2022, 12:49 PM
RE: Proggies - by bplus - 05-16-2022, 02:44 PM
RE: Proggies - by bplus - 05-17-2022, 11:16 PM
RE: Proggies - by vince - 05-25-2022, 05:08 AM
RE: Proggies - by bplus - 05-17-2022, 11:23 PM
RE: Proggies - by bplus - 05-17-2022, 11:42 PM
RE: Proggies - by bplus - 05-18-2022, 01:14 AM
RE: Proggies - by bplus - 05-19-2022, 06:43 PM
RE: Proggies - by bplus - 05-20-2022, 01:52 AM
RE: Proggies - by SierraKen - 05-20-2022, 03:44 AM
RE: Proggies - by bplus - 05-20-2022, 07:59 PM
RE: Proggies - by bplus - 05-20-2022, 08:34 PM
RE: Proggies - by Dav - 05-21-2022, 12:48 AM
RE: Proggies - by bplus - 05-25-2022, 12:47 AM
RE: Proggies - by bplus - 05-29-2022, 11:32 PM
RE: Proggies - by bplus - 05-30-2022, 01:41 PM
RE: Proggies - by bplus - 06-04-2022, 10:01 PM
RE: Proggies - by triggered - 06-05-2022, 03:44 AM
RE: Proggies - by bplus - 06-05-2022, 03:03 PM
RE: Proggies - by bplus - 06-06-2022, 08:04 PM
RE: Proggies - by bplus - 06-07-2022, 02:18 AM
RE: Proggies - by dbox - 03-03-2023, 09:14 PM
RE: Proggies - by bplus - 06-07-2022, 10:51 AM
RE: Proggies - by SierraKen - 06-09-2022, 07:04 PM
RE: Proggies - by bplus - 06-09-2022, 10:40 PM
RE: Proggies - by bplus - 06-22-2022, 02:59 PM
RE: Proggies - by vince - 06-23-2022, 08:04 PM
RE: Proggies - by SierraKen - 06-24-2022, 06:28 PM
RE: Proggies - by bplus - 07-13-2022, 06:19 PM
RE: Proggies - by bplus - 07-17-2022, 11:38 PM
RE: Proggies - by bplus - 07-19-2022, 07:16 PM
RE: Proggies - by vince - 07-22-2022, 10:40 PM
RE: Proggies - by dbox - 07-23-2022, 12:47 AM
RE: Proggies - by SierraKen - 07-23-2022, 05:16 PM
RE: Proggies - by bplus - 07-24-2022, 04:16 PM
RE: Proggies - by dbox - 07-24-2022, 11:33 PM
RE: Proggies - by SierraKen - 07-24-2022, 11:38 PM
RE: Proggies - by bplus - 09-19-2022, 07:16 PM
RE: Proggies - by bplus - 09-20-2022, 03:42 PM
RE: Proggies - by James D Jarvis - 09-21-2022, 12:22 PM
RE: Proggies - by bplus - 09-21-2022, 02:39 PM
RE: Proggies - by mnrvovrfc - 09-24-2022, 03:25 AM
RE: Proggies - by James D Jarvis - 09-21-2022, 02:55 PM
RE: Proggies - by bplus - 09-21-2022, 03:46 PM
RE: Proggies - by James D Jarvis - 09-21-2022, 05:46 PM
RE: Proggies - by bplus - 09-21-2022, 06:29 PM
RE: Proggies - by bplus - 10-09-2022, 08:17 PM
RE: Proggies - by vince - 10-09-2022, 09:20 PM
RE: Proggies - by bplus - 10-10-2022, 01:52 PM
RE: Proggies - by vince - 10-10-2022, 04:20 PM
RE: Proggies - by bplus - 10-18-2022, 02:54 PM
RE: Proggies - by bplus - 01-16-2023, 03:53 PM
RE: Proggies - by bplus - 01-16-2023, 03:59 PM
RE: Proggies - by bplus - 01-16-2023, 04:05 PM
RE: Proggies - by bplus - 01-16-2023, 04:09 PM
RE: Proggies - by bplus - 01-16-2023, 04:13 PM
RE: Proggies - by bplus - 01-17-2023, 08:18 PM
RE: Proggies - by bplus - 03-06-2023, 07:04 PM
RE: Proggies - by bplus - 03-24-2023, 02:41 AM
RE: Proggies - by vince - 03-24-2023, 05:22 AM
RE: Proggies - by bplus - 03-24-2023, 05:32 AM
RE: Proggies - by mnrvovrfc - 03-24-2023, 05:54 AM
RE: Proggies - by vince - 04-09-2023, 06:49 AM
RE: Proggies - by bplus - 04-09-2023, 03:05 PM
RE: Proggies - by bplus - 07-23-2023, 12:16 PM
RE: Proggies - by GareBear - 07-23-2023, 05:47 PM
RE: Proggies - by bplus - 07-23-2023, 07:35 PM
RE: Proggies - by bplus - 07-24-2023, 07:04 PM
RE: Proggies - by bplus - 07-24-2023, 07:09 PM
RE: Proggies - by bplus - 08-17-2023, 07:17 AM
RE: Proggies - by johnno56 - 08-17-2023, 10:32 AM
RE: Proggies - by bplus - 08-28-2023, 03:24 PM
RE: Proggies - by Dav - 08-28-2023, 05:28 PM
RE: Proggies - by PhilOfPerth - 08-28-2023, 11:47 PM
RE: Proggies - by johnno56 - 08-29-2023, 07:11 AM
RE: Proggies - by bplus - 08-29-2023, 12:39 PM



Users browsing this thread: 28 Guest(s)