Mandelbrot set: Difference between revisions
Content deleted Content added
Basicgames (talk | contribs) |
zoom in and out |
||
Line 5,118:
<syntaxhighlight lang="easylang">
center_x = 220
for y0 = 0 to 299▼
scale = 150
background 000
cx = (x0 - 220) / 120▼
textsize 2
x = 0 ; y = 0 ; iter = 0▼
#
proc draw . .
h = x * x - y * y + cx▼
clear
y = 2 * x * y + cy▼
for scr_y =
.▼
if iter = 64▼
x = 0 ; y = 0 ; iter = 0
until xx + yy >= 4 or iter = 128
rect 0.4 0.4▼
.▼
▲ y = 2 * x * y + cy
x = h
.
color3 iter / 32 iter / 128 0
move scr_x / 3 scr_y / 3
▲ rect 0.4 0.4
.
.
color 990
move 1 1
text "Short press to zoom in, long to zoom out"
.
on mouse_down
time0 = systime
.
on mouse_up
center_x += 150 - mouse_x * 3
center_y += 150 - mouse_y * 3
if systime - time0 < 0.3
center_x -= 150 - center_x
center_y -= 150 - center_y
scale *= 2
else
center_x += (150 - center_x) / 2
center_y += (150 - center_y) / 2
scale /= 2
▲ .
call draw
.
call draw
</syntaxhighlight>
|