## madelbort zoom movie maker try

General FreeBASIC programming questions.
bluatigro
Posts: 627
Joined: Apr 25, 2012 10:35
Location: netherlands

### madelbort zoom movie maker try

error :
if i go deep in the fractel
my black does not lessen if i choise '='

Code: Select all

`type complex  dim i as double  dim r as double  declare constructor()  declare constructor( a as double , bj as double )  declare sub fill( a as double , bj as double )  declare function lenght() as doubleend typeconstructor complex( )  this.r = 0  this.i = 0end constructor constructor complex( a as double , bj as double )  this.r = a  this.i = bjend constructor sub complex.fill( a as double , bj as double )  this.r = a  this.i = bjend subfunction complex.lenght() as double  return sqr( this.i ^ 2 + this.r ^ 2 )end functionoperator + ( a as complex , b as complex ) as complex  return type( a.r + b.r , a.i + b.i )end operatoroperator * ( a as complex , b as complex ) as complex  return type( a.r * b.r - a.i * b.i , a.r * b.i + a.i * b.r )end operatorconst as double pi = atn( 1 ) * 4declare function rad( deg as double ) as doubledeclare function rainbow( deg as double ) as integerdim as double x , y dim as integer tel , dept = 16dim as complex nu , puntdim as string indim as double mx = 0 , my = 0 , diam = 2screen 20 , 32while in <> "q" and in <> "t"  cls  for x = 0 to 1024    for y = 0 to 768      tel = 0      nu.fill ( x - 1024 / 2 ) / 1024 * diam - mx , ( y - 768 / 2 ) / 768 * diam - my      punt.fill ( x - 1024 / 2 ) / 1024 * diam - mx , ( y - 768 / 2 ) / 768 * diam - my      while nu.lenght < 50 and tel < dept        tel += 1        nu = nu * nu + punt      wend      if tel < 50 then        pset( x , y ) , rainbow( tel * 36 / 5 )      end if    next y  next x  print mx , my , log( diam ) / log( 10 ) , dept  input "[ 0 ... 9 or q or t ] = " ; in  select case in    case "0"       diam *= 2    case "1"      mx += diam / 2      my -= diam / 2    case "2"      my -= diam / 2    case "3"      mx -= diam / 2      my -= diam / 2    case "4"      mx += diam / 2    case "5"      diam /= 2    case "6"      mx -= diam / 2    case "7"      mx += diam / 2      my += diam / 2    case "8"      my += diam / 2    case "9"      mx -= diam / 2      my += diam / 2    case "="      dept *= 2    case "-"      dept /= 2    case else  end selectwendif in = "t" then   print "[ end test ]"  sleep   endend ifinput "path + filename [ -.bmp ] = " ; indiam = 2dim as integer framewhile diam > 10e-14  cls  for x = 0 to 1024    for y = 0 to 768      tel = 0      nu.fill ( x - 1024 / 2 ) / 1024 * diam - mx , ( y - 768 / 2 ) / 768 * diam - my      punt.fill ( x - 1024 / 2 ) / 1024 * diam - mx , ( y - 768 / 2 ) / 768 * diam - my      while nu.lenght < 50 and tel < dept        tel += 1        nu = nu * nu + punt      wend      if tel < 50 then        pset( x , y ) , rainbow( tel * 36 / 5 )      end if    next y  next x  bsave in + right( "000000" + str( frame ) , 5 ) + ".bmp" , 0  diam /= 10 ^ 0.1  frame += 1wendprint "[ game over ]"endfunction rad( deg as double ) as double  return  deg * pi / 180end functionfunction rainbow( deg as double ) as integer  return rgb( sin( rad( deg ) ) * 127 + 128 _            , sin( rad( deg + 120 ) ) * 127 + 128 _            , sin( rad( deg - 120 ) ) * 127 + 128 )end function`
jj2007
Posts: 1336
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

### Re: madelbort zoom movie maker try

With the q option, it created 80+ fat bmp files until I could stop it with Ctrl C. Otherwise it works fine.