Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Anemometer Wind Gauge
#1
Today I decided to work more with 3D animation. Smile 

Code: (Select All)
_Title "Anemometer Wind Gauge by SierraKen"
Screen _NewImage(800, 600, 32)
t = 900
t2 = 1350
t3 = 1800
cc = 200

Do
    _Limit 30
    If t < 90 Then t = 900
    If t2 < 135 Then t2 = 1350
    If t3 < 180 Then t3 = 1800
    x = (Sin(t) * 20) * (_Pi * 2) + 400
    y = (Cos(t) * 10) * (_Pi / 2) + 200
    r = (Cos(t) * 180) / _Pi / 1.5 + 50
    t = t - .25
    x2 = (Sin(t2) * 20) * (_Pi * 2) + 400
    y2 = (Cos(t2) * 10) * (_Pi / 2) + 200
    r2 = (Cos(t2) * 180) / _Pi / 1.5 + 50
    t2 = t2 - .25
    x3 = (Sin(t3) * 20) * (_Pi * 2) + 400
    y3 = (Cos(t3) * 10) * (_Pi / 2) + 200
    r3 = (Cos(t3) * 180) / _Pi / 1.5 + 50
    t3 = t3 - .25
    For S = .25 To r Step .1
        cc = cc - .25
        Circle (x, y), S, _RGB32(cc, cc, 100 + cc)
    Next S
    cc = 200
    For S = .25 To r2 Step .1
        cc = cc - .25
        Circle (x2, y2), S, _RGB32(cc, 100 + cc, cc)
    Next S
    cc = 200
    For S = .25 To r3 Step .1
        cc = cc - .25
        Circle (x3, y3), S, _RGB32(100 + cc, cc, cc)
    Next S
    cc = 200
    Line (400, 200)-(x, y), _RGB32(255, 255, 255)
    Line (400, 200)-(x2, y2), _RGB32(255, 255, 255)
    Line (400, 200)-(x3, y3), _RGB32(255, 255, 255)
    cc2 = 100
    For sz = .1 To 100 Step .25
        cc2 = cc2 - .25
        Circle (400, 450), sz, _RGB32(100 + cc2, 100 + cc2, cc2), , , .5
    Next sz
    Line (400, 200)-(400, 450), _RGB32(255, 255, 255)
    _Display
    Cls
Loop
Reply
#2
I just added 2 needed lines and reposted above.
Reply
#3
I added mouse wheel support so you can spin it both ways and speed it up and slow it down. 

Code: (Select All)
_Title "Anemometer Wind Gauge by SierraKen - Use Mouse Wheel"
Screen _NewImage(800, 600, 32)
t = 900
t2 = 1350
t3 = 1800
cc = 200

Do
    _Limit 30
    While _MouseInput: wheel = wheel + _MouseWheel: Wend
    If wheel > 10 Then wheel = 10
    If wheel < -10 Then wheel = -10
    If t < 90 Then t = 900
    If t2 < 135 Then t2 = 1350
    If t3 < 180 Then t3 = 1800
    x = (Sin(t) * 20) * (_Pi * 2) + 400
    y = (Cos(t) * 10) * (_Pi / 2) + 200
    r = (Cos(t) * 180) / _Pi / 1.5 + 50
    t = t - (.25 + wheel / 10)
    x2 = (Sin(t2) * 20) * (_Pi * 2) + 400
    y2 = (Cos(t2) * 10) * (_Pi / 2) + 200
    r2 = (Cos(t2) * 180) / _Pi / 1.5 + 50
    t2 = t2 - (.25 + wheel / 10)
    x3 = (Sin(t3) * 20) * (_Pi * 2) + 400
    y3 = (Cos(t3) * 10) * (_Pi / 2) + 200
    r3 = (Cos(t3) * 180) / _Pi / 1.5 + 50
    t3 = t3 - (.25 + wheel / 10)
    For S = .25 To r Step .1
        cc = cc - .25
        Circle (x, y), S, _RGB32(cc, cc, 100 + cc)
    Next S
    cc = 200
    For S = .25 To r2 Step .1
        cc = cc - .25
        Circle (x2, y2), S, _RGB32(cc, 100 + cc, cc)
    Next S
    cc = 200
    For S = .25 To r3 Step .1
        cc = cc - .25
        Circle (x3, y3), S, _RGB32(100 + cc, cc, cc)
    Next S
    cc = 200
    Line (400, 200)-(x, y), _RGB32(255, 255, 255)
    Line (400, 200)-(x2, y2), _RGB32(255, 255, 255)
    Line (400, 200)-(x3, y3), _RGB32(255, 255, 255)
    cc2 = 100
    For sz = .1 To 100 Step .25
        cc2 = cc2 - .25
        Circle (400, 450), sz, _RGB32(100 + cc2, 100 + cc2, cc2), , , .5
    Next sz
    Line (400, 200)-(400, 450), _RGB32(255, 255, 255)
    _Display
    Cls
Loop Until InKey$ = Chr$(27)
Reply
#4
I just spiffed it up by using the exact radians needed to make each one exactly even with each other rather than guessing like I was before. I like to Google "radians photos" to get a good chart to look at. Smile 

[Image: Ken-s-Anemometer-App.jpg]



Code: (Select All)
_Title "Anemometer Wind Gauge by SierraKen - Use Mouse Wheel"
Screen _NewImage(800, 600, 32)
start:
t = (_Pi / 2) * 100
t2 = ((11 * _Pi) / 6) * 100
t3 = ((7 * _Pi) / 6) * 100
cc = 200

Do
    _Limit 30
    While _MouseInput: wheel = wheel + _MouseWheel: Wend
    If wheel > 10 Then wheel = 10
    If wheel < -10 Then wheel = -10
    If t2 < 0 Then GoTo start:
    x = (Sin(t) * 20) * (_Pi * 2) + 400
    y = (Cos(t) * 10) * (_Pi / 2) + 200
    r = (Cos(t) * 180) / _Pi / 1.5 + 50
    t = t - (.25 + wheel / 10)
    x2 = (Sin(t2) * 20) * (_Pi * 2) + 400
    y2 = (Cos(t2) * 10) * (_Pi / 2) + 200
    r2 = (Cos(t2) * 180) / _Pi / 1.5 + 50
    t2 = t2 - (.25 + wheel / 10)
    x3 = (Sin(t3) * 20) * (_Pi * 2) + 400
    y3 = (Cos(t3) * 10) * (_Pi / 2) + 200
    r3 = (Cos(t3) * 180) / _Pi / 1.5 + 50
    t3 = t3 - (.25 + wheel / 10)
    For S = .25 To r Step .1
        cc = cc - .25
        Circle (x, y), S, _RGB32(cc, cc, 100 + cc)
    Next S
    cc = 200
    For S = .25 To r2 Step .1
        cc = cc - .25
        Circle (x2, y2), S, _RGB32(cc, 100 + cc, cc)
    Next S
    cc = 200
    For S = .25 To r3 Step .1
        cc = cc - .25
        Circle (x3, y3), S, _RGB32(100 + cc, cc, cc)
    Next S
    cc = 200
    Line (400, 200)-(x, y), _RGB32(255, 255, 255)
    Line (400, 200)-(x2, y2), _RGB32(255, 255, 255)
    Line (400, 200)-(x3, y3), _RGB32(255, 255, 255)
    cc2 = 100
    For sz = .1 To 100 Step .25
        cc2 = cc2 - .25
        Circle (400, 450), sz, _RGB32(100 + cc2, 100 + cc2, cc2), , , .5
    Next sz
    Line (400, 200)-(400, 450), _RGB32(255, 255, 255)
    _Display
    Cls
Loop Until InKey$ = Chr$(27)
Reply




Users browsing this thread: 2 Guest(s)