Post by tsh73 on Apr 13, 2022 14:16:40 GMT
it all started from piece of math...
libertybasiccom.proboards.com/thread/1986/broken-hearted-programmer
ended up like this - collaborated effort
(may be not even ended)
(and I did not put it on raytracing yet! - just kidding)
libertybasiccom.proboards.com/thread/1986/broken-hearted-programmer
ended up like this - collaborated effort
(may be not even ended)
(and I did not put it on raytracing yet! - just kidding)
nomainwin
global pi: pi =3.141526535
global hdc, targetcolor, col$
graphicbox #w.g, 10, 10, 400, 400 ' , after #w.g for LB5
WindowHeight = 454
WindowWidth = 430
open "Love Hearts --O-- Love Hurts" for graphics_nsb as #w
#w "trapclose quit"
#w.g "fill 50 50 50"
#w.g "down"
#w.g "size 2"
for i =1 to 70 step 1
p =int( 100 +156 *rnd( 1))
re =int( 150 +106 *rnd( 1)): gr =int( 100*rnd( 1)): bl = gr
C$ =str$( re) +" " +str$( gr) +" "+ str$( bl) ' eg rC$ ="50 255 255"
call drawHeart 4 +int( i *20 /80), 3 +int( 390 *rnd( 1)), 4 +int( 390 *rnd( 1)), int( rnd(1) *60 -30), C$
next i
#w.g "getbmp scr 0 0 400 400": bmpsave "scr", "TiltingHurtingHearts.bmp"
wait ' _____________________________________________________
sub drawHeart size, xOrigin, yOrigin, angle, c$
cl$ =c$
re$ =word$( cl$, 1, " "): gr$ =word$( cl$, 2, " "): bl$ =word$( cl$, 3, " ")
fillCol$ =c$ ' re$ +" " +gr$ +" " +bl$
targetcolor =val( bl$) *2^16 +val( gr$) *2^8 +val( re$)
' this is colour to fill WITH and TO.
' this is also the colour of the outline to fill out TO.
#w.g "color "; fillCol$
#w.g "backcolor "; fillCol$
#w.g "size 2"
for theta =0 to 360 step 1
t =( theta +angle) *pi /180
r =size *( sin( t) *( abs( cos( t )))^0.5 /( sin( t) +7/5 ) -2 *sin( t) +2)
x =r *cosRad( theta): y =r *sinRad( theta)': print x y
#w.g "line "; int( xOrigin); " "; int( yOrigin);" "; int( xOrigin +x); " "; int( yOrigin -y)
scan
next theta
#w.g "color 50 50 50"
#w.g "place "; int( xOrigin); " "; int( yOrigin)
x=xOrigin
y=yOrigin
#w.g "north; turn ";angle+180
#w.g "go ";0-size/3
#w.g "turn ";0-25
a=50
for i = 4 to 1 step -1
#w.g "turn ";a
a=0-a
#w.g "size ";int(i*size/10)+1
#w.g "go ";size
next
end sub
function sinRad( t): sinRad =sin( t *pi /180): end function
function cosRad( t): cosRad =cos( t *pi /180): end function
sub quit h$
close #h$
end
end sub