prog8/compiler/examples/swirl.p8

32 lines
634 B
Plaintext
Raw Normal View History

%import c64utils
%import c64flt
2018-09-30 23:01:39 +00:00
~ main {
2018-10-10 07:21:20 +00:00
const uword width = 320
const uword height = 200
2018-09-30 23:01:39 +00:00
sub start() {
vm_gfx_clearscr(0)
2018-09-30 23:01:39 +00:00
float t
2018-10-10 07:21:20 +00:00
ubyte color
2018-09-30 23:01:39 +00:00
while true {
float x = sin(t*1.01) + cos(t*1.1234)
float y = cos(t) + sin(t*0.03456)
vm_gfx_pixel(screenx(x), screeny(y), color//16)
2018-09-30 23:01:39 +00:00
t += 0.01
color++
}
}
sub screenx(float x) -> word {
return (x/4.1* (width as float)) as word + width // 2
}
sub screeny(float y) -> word {
return (y/4.1 * (height as float)) as word + height // 2
}
2018-09-30 23:01:39 +00:00
}