pi roll
#1
Code:
_TITLE "pi roll.bas QB64/51 trans 2017-11-01 by bplus    For Plasma Injection, press the Spacebar"
' pi roll.bas SmallBASIC 0.12.6 [B+=MGA] 2016-05-21
' The idea of wrapping the number pi in a spiral was suggested
' from a program Menn posted at SmallBASIC.

' Let's try something new with this code translation, copy a font pixel by pixel
' and then blow it up to any size we want and then inject Plasma Coloring.

'==============================================
' PRESS SPACEBAR FOR NEW PLASMA INJECTION
'==============================================

CONST xmax = 800
CONST ymax = 700

SCREEN _NEWIMAGE(xmax, ymax, 32)
_SCREENMOVE 360, 60 'adjust as needed _MIDDLE needs a delay .5 or more for me

DEFINT A-Z
RANDOMIZE TIMER
COMMON SHARED p(), cN, pR!, pG!, pB!
CONST h = 16
digi$ = "0123456789."
PRINT digi$
w = 8 * LEN(digi$)
DIM p(w, h)
black&& = POINT(0, 10)
FOR y = 0 TO h
    FOR x = 0 TO w
        IF POINT(x, y) <> black&& THEN
            p(x, y) = 1
        END IF
    NEXT
NEXT
CLS

pie$ = "3.141592653589793238462643383279502884197169399375105820974944592307816406286"
cx! = xmax / 2: cy! = ymax / 2
resetPlasma
WHILE 1
    pIndex = 0: n = 20: a! = 0
    WHILE pIndex < 55 'the screen scolls when print large fonts near bottom of screen
        IF LEN(INKEY$) THEN resetPlasma
        IF _KEYHIT = 27 THEN END
        n = n + 8
        pIndex = pIndex + 1
        r! = n
        a! = a! + _PI(1 / 7)
        x! = cx! + r! * COS(a!)
        y! = cy! + r! * SIN(a!)
        ds$ = MID$(pie$, pIndex, 1)
        IF ds$ = "." THEN d = 10 ELSE d = VAL(ds$)
        sz = INT(pIndex / 7) + 2
        printDigitAtXYSize d, x!, y!, sz
        _DISPLAY
    WEND
WEND

SUB printDigitAtXYSize (digit, xo!, yo!, size) 'digits 0 - 9, 10th is . for decimal
    xstart = digit * 8: xstop = xstart + 7
    FOR yy = 0 TO 15
        xxx = 0
        FOR xx = xstart TO xstop
            IF p(xx, yy) THEN
                changePlasma
            ELSE
                COLOR 0
            END IF
            LINE (xo! + xxx * size, yo! + yy * size)-STEP(size, size), , BF
            xxx = xxx + 1
        NEXT
    NEXT
END SUB

SUB changePlasma ()
    cN = cN + 1
    COLOR _RGB(127 + 127 * SIN(pR! * cN), 127 + 127 * SIN(pG! * cN), 127 + 127 * SIN(pB! * cN))
END SUB

SUB resetPlasma ()
    pR! = RND ^ 2: pG! = RND ^ 2: pB! = RND ^ 2
END SUB

Another example of Plasma coloring method applied to resizing font.

Resize the font? yep!


Attached Files Thumbnail(s)

B += x
Reply
#2
Bart Simpson, seriously? All right, ya made me do it. Say your prayers, varmint!

Pete Big Grin
Reply
#3
Karma

Bart was once a target for me too, thank goodness it was only my mouth I shot off. (which is why I write this) Big Grin
B += x
Reply
#4
Well at least ya gots me ta port over my av-vee-tar. So thank ya kindly.

Pete Big Grin
Reply