Here are some sketches without alpha:

And with alpha:

Alpha blending creates lighting effects:

Some more:

Enter the vortex:

Paint or furniture?

Using lines instead of pixels:

And the winner is:

These screen shots were all produced by these two programs, and slight modifications of them:

Code: Select all

`' Spirograph Alpha! v1.0`

' (C) 2008 Innova and Kristopher Windsor

#include "fbgfx.bi"

Const screenx = 800, screeny = 600

Const spin_max = 3, pi = Atn(1) * 4

Type spin_type

As Double angle, size, velocity

End Type

Dim As Double x, y, x2, y2

Dim As spin_type spin(1 To spin_max)

Screenres screenx, screeny, 32,, fb.GFX_ALPHA_PRIMITIVES

Randomize Timer

For a As Integer = 1 To spin_max

With spin(a)

.angle = Rnd * pi * 2

.size = rnd * 500 / a '(spin_max - a + 1) 'rnd * 500 / a

.velocity = Rnd / 400

End With

Next a

Do

x = screenx / 2

y = screeny / 2

x2 = x: y2 = y

For a As Integer = 1 To spin_max

With spin(a)

.angle += .velocity

x += Cos(.angle) * .size

y += Sin(.angle) * .size

x2 -= Cos(.angle) * .size

y2 -= Sin(.angle) * .size

End With

Next a

Pset (x, y), &H0F88FF88

Pset (x2, y2), &H0F8888FF

Loop Until Inkey = Chr(27)

Bsave "art-" & Rnd & ".bmp", 0

Note that this version draws to a buffer, which is larger than the screen:

Code: Select all

`' Spirograph Alpha! v1.0b`

' (C) 2008 Innova and Kristopher Windsor

#include "fbgfx.bi"

Const screenx = 800, screeny = 600

Const canvasx = 1200, canvasy = 900

Const spin_max = 3, pi = Atn(1) * 4

Type spin_type

As Double angle, size, velocity

End Type

Dim As Integer fc

Dim As Double x, y

Dim As spin_type spin(1 To spin_max)

Dim As fb.image Ptr canvas

Screenres screenx, screeny, 32,, fb.GFX_ALPHA_PRIMITIVES

canvas = imagecreate(canvasx, canvasy, &HFF000000)

Randomize Timer

For a As Integer = 1 To spin_max

With spin(a)

.angle = Rnd * pi * 2

.size = canvasy / (a * 5) '(spin_max - a + 1) 'rnd * 500 / a

.velocity = Rnd / 400

End With

Next a

Do

fc += 1

x = canvasx / 2

y = canvasy / 2

For a As Integer = 1 To spin_max - 1

With spin(a)

.angle += .velocity

x += Cos(.angle) * .size

y += Sin(.angle) * .size

End With

Next a

With spin(spin_max)

Line canvas, (x, y) - Step(Cos(.angle) * .size * 2, Sin(.angle) * .size * 2), &H0F8888FF

Line canvas, (x, y) - Step(-Cos(.angle) * .size * 2, -Sin(.angle) * .size * 2), &H0FFF8888

End With

If (fc Mod 10000) = 0 Then Put (0, 0), canvas, Pset

Loop Until Inkey = Chr(27)

Bsave "art-" & Rnd & ".bmp", canvas

imagedestroy(canvas)

I'm sure someone can produce some new effects if they play with the programs. xD

Tags: kristopherwindsor_program_graphics kristopherwindsor_feature_program