Croissant Runtime
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
crsn/examples/screen_trig.csn

35 lines
712 B

(
; mouse over the image to draw circles
(sc-init 800 600)
(sc-opt SCREEN_AUTO_BLIT 0)
(:loop)
(sc-poll)
(sc-mouse r4 r5 (ov? (j :loop)))
(itf r4)
(itf r5)
(ld r0 0.0)
(def RADIUS 50.0)
(:circle)
(fsin r1 r0)
(fcos r2 r0)
(fmul r1 RADIUS)
(fmul r2 RADIUS)
(fadd r1 r4)
(fadd r2 r5)
(fti r1)
(fti r2)
(sc-px r1 r2 #66ff00)
(fadd r0 0.1) ; make lower for a smoother circle
(fcmp r0 TAU
(ge?
(sc-blit)
(j :loop)))
(j :circle)
(j :loop)
)