QB64 Phoenix Edition
Heart Beat - Printable Version

+- QB64 Phoenix Edition (https://staging.qb64phoenix.com)
+-- Forum: QB64 Rising (https://staging.qb64phoenix.com/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://staging.qb64phoenix.com/forumdisplay.php?fid=3)
+---- Forum: Programs (https://staging.qb64phoenix.com/forumdisplay.php?fid=7)
+---- Thread: Heart Beat (/showthread.php?tid=835)



Heart Beat - bplus - 09-01-2022

Code: (Select All)
_Title "Heart Beat" 'b+ 2022-09-01  playing with Heart graphic code at JB
'    https://justbasiccom.proboards.com/thread/883/heart-shapes
Screen _NewImage(600, 350, 32)
Color &HFFFF0000, &HFFEEEEEE
M = 313
P = 100
J = 1
Dim h(1 To 4) As Long
For stepper = .0005 To .0005004 Step .0000001
    k = k + 1
    Cls
    For I = 0 To 1.567 Step stepper
        J = 0 - J
        Circle (Abs(P * (J * I + 3)), P * (2 + (I ^ .01 * (Abs(Cos(I)) ^ .5 * Cos(M * I)) - I ^ .3))), 1
    Next
    h(k) = _NewImage(600, 350, 32)
    _PutImage , 0, h(k)
Next
k = 0: dk = 1
While 1
    k = k + dk
    If k > 4 Then k = 1
    _PutImage , h(k), 0
    toggle = 1 - toggle
    If toggle Then _Delay .8 Else _Delay .08
Wend

https://www.youtube.com/watch?v=xos2MnVxe-c


RE: Heart Beat - SierraKen - 09-01-2022

Good job B+! It's always fun to find new graphical equations. Smile


RE: Heart Beat - bplus - 09-01-2022

Yes that is one heck of a formula for y!


RE: Heart Beat - bplus - 09-03-2022

Ah! Here is the animation we were trying to duplicate at JB:
Code: (Select All)
_Title "Heart Code Animation by tsh73" 'b+ 2022-09-03 playing with Heart graphic code at JB
'    https://justbasiccom.proboards.com/thread/883/heart-shapes
Screen _NewImage(600, 350, 32)
Color &HFFFF0000, &HFFEEEEEE
M = 313
P = 100
J = 1
Dim h(1 To 10) As Long
For k = 0 To 9
    Cls
    J = 1
    For I = 0 To 1.567 Step 0.0005 '.5/(P*5+k/60)
        x = Int(Abs(P * (J * I + 3)))
        J = 0 - J
        Circle (x, Int(P * (2 + (I ^ .01 * (Abs(Cos(I)) ^ .5 * Cos(M * I + k / 30)) - I ^ .3)))), 1, &HFF990000
    Next
    h(k + 1) = _NewImage(600, 350, 32)
    _PutImage , 0, h(k + 1)
Next
k = 0: dk = 1
While 1
    k = (k + 1) Mod 10 + 1
    _PutImage , h(k), 0
    _Limit 10
Wend

Much smoother!


RE: Heart Beat - bplus - 09-03-2022

Here you don't even have to copy and paste, QBJS will run it for you!
https://qbjs.org/?code=X1RpdGxlICJIZWFydCBDb2RlIEFuaW1hdGlvbiBieSB0c2g3MyIgJ2IrIDIwMjItMDktMDMgcGxheWluZyB3aXRoIMY7Z3JhcGhpYyBjxENhdCBKQgonICAgIGh0dHBzOi8vanVzdGJhc2ljY29tLnByb2JvYXJkcy5jb20vdGhyZWFkLzg4My9oxEwtc2hhcGVzClNjcmVlbiBfTmV3SW1hZ2UoNjAwLCAzNcQFMikKQ29sb3IgJkhGRkZGMDDEG8QMRcUBCk0gPSAzMTMKUCA9IDEwMApKxAgKRGltIGgoMSBUbyAxMCkgQXMgTG9uZwpGb3IgayA9IDDEGTkK5AC3Q2xzxQjGOMQKxCVJyCUxLjU2NyBTdGVwIDAuMDAwNSAnLjUvKFAqNStrLzYwKcUyxAF4ID0gSW50KEFicyhQICogKEogKiBJICsgMykpyibEZjAgLSBKyRJDaXJjbGUgKHgsxT/FOzIgKyAoSSBeIC4wMcQQxFRDb3MoSSkpxBU1ICogxA9Nx2JrIC8gMzApKSAtIMU1xHIpLCAx5gEoOTnkATTFcE5leHTFCWgoayArIDEpID35AXXEJ19QdXTFHCAsIDAsyTYKxUjlAUg6IGTECDEKV2hpbGXnAUHEEshhTW9kIDEwxAzRUmgoayksIOYAml9MaW1pdCAxMApXZW5k

   


RE: Heart Beat - dbox - 09-03-2022

Nice!