# BASIC 256 - Language Documentation

galleryjmreneau

## Gallery of Images and Programs from Jim Reneau

Animated mobius strip (July 2010)

See Code Here

    # mobius.kbs
    # rotation mobius strip - j.m.reneau
    fastgraphics
    dim p(8)
    dim c(3)
    c = {red, green, blue}
    w = .20 # width of strip
    dr = 2 * pi / 100 # size of rotation in frame
    speed = .01 # pause between frames
    r = 0
    while true
       clg
       for t = 0 to 2
          x = sin((t - w) * pi * 2 / 3 + r)*graphwidth/2 + graphwidth/2
          y = cos((t - w) * pi * 2 / 3 + r)*graphheight/2 + graphheight/2
          x1 = sin((t + w) * pi * 2 / 3 + r)*graphwidth/2 + graphwidth/2
          y1 = cos((t + w) * pi * 2 / 3 + r)*graphheight/2 + graphheight/2
          x2 = sin((t+1 - w) * pi * 2 / 3 + r)*graphwidth/2 + graphwidth/2
          y2 = cos((t+1 - w) * pi * 2 / 3 + r)*graphheight/2 + graphheight/2
          x3 = sin((t+1 + w) * pi * 2 / 3 + r)*graphwidth/2 + graphwidth/2
          y3 = cos((t+1 + w) * pi * 2 / 3+ r)*graphheight/2 + graphheight/2
          p = {x,y,x3,y3,x2,y2,x1,y1}
          color c[t]
          poly p
       next t
       refresh
       r = r + dr
       pause speed
    end while

Morie Pattern (July 27, 2010)

See Code Here

    # morie pattern - j.m.reneau 2010-07-27

    # height of pattern
    h = 500
    # width of pattern
    w = 500
    # distance between lines ((w or h)/s) on edge
    s = .005

    fastgraphics
    graphsize w,h

    # background
    color black
    rect 0,0,w,h

    x0 = w/2
    y0 = h/2
    for t = 0 to 1  step s
       x1 = 0
       y1 = t*h
       gosub drawline
       x1 = w
       y1 = h-t*h
       gosub drawline
       x1 = w-t*w
       y1 = 0
       gosub drawline
       x1 = t*w
       y1 = h
       gosub drawline
    next t
    end

    drawline:
    dx = x0 - x1
    dy = y0 - y1
    # distance along length of line between points (as % of line length)
    sl = 3  / ((dx ^ 2 + dy ^ 2 ) ^ .5)
    for d = 0 to 1 step sl
       # color of pixel along line
       color 255*d, 255*d, 255*d
       plot x0 + dx * d, y0 + dy * d
    next d
    refresh
    return

galleryjmreneau.txt · Last modified: 2011/03/29 11:56 (external edit)