Friday, June 20, 2008

Fractal Art in Mobile Marketing

Fractals provide useful video art for mobile marketing. Large and amorphous patterns crystallize into smaller, distinct shapes. Or the logistic equation can be graphed in reverse from chaos to tipping point to order. The advantage of these as dynamic logos is that a small code module can be downloaded to create them rather than the download of a large video. The downside would be security concerns.

An example is the Focusing Triangles Fractal with code included in this post.




'******************************************************************************************
' This program creates a diffuse pattern and focuses it to a crisp, smaller triangle.
' Author: George Ray
'******************************************************************************************
Option Explicit
Dim iGMR, RandNum As Integer
Dim gmrDenom As Double
Dim gmrAx, gmrAy, gmrBx, gmrBy, gmrCx, gmrCy, gmrPx, gmrPy As Double
Sub Main()
gmrDisplay.BackColor = QBColor(0)
gmrDisplay.Show
Call gmrLogo
End Sub

Sub gmrLogo()
gmrAx = 5000 / 4
gmrAy = 3000 / 4
gmrBx = 4000 / 4
gmrBy = 5000 / 4
gmrCx = 6000 / 4
gmrCy = 5000 / 4
gmrPx = 5000 / 4
gmrPy = 4000 / 4

gmrDisplay.PSet (gmrAx, gmrAy), RGB(255, 0, 0)
gmrDisplay.PSet (gmrBx, gmrBy), RGB(255, 0, 0)
gmrDisplay.PSet (gmrCx, gmrCy), RGB(255, 0, 0)

gmrDenom = 1.5
Randomize
For gmrDenom = 1.2 To 2.2 Step 0.4
For iGMR = 1 To 10000
RandNum = Int(3 * Rnd + 1)
If RandNum = 1 Then
gmrPx = (gmrAx + gmrPx) / gmrDenom
gmrPy = (gmrAy + gmrPy) / gmrDenom
gmrDisplay.PSet (gmrPx, gmrPy), RGB(255, 0, 0)
ElseIf RandNum = 2 Then
gmrPx = (gmrBx + gmrPx) / gmrDenom
gmrPy = (gmrBy + gmrPy) / gmrDenom
gmrDisplay.PSet (gmrPx, gmrPy), RGB(0, 255, 0)
ElseIf RandNum = 3 Then
gmrPx = (gmrCx + gmrPx) / gmrDenom
gmrPy = (gmrCy + gmrPy) / gmrDenom
gmrDisplay.PSet (gmrPx, gmrPy), RGB(0, 0, 255)
End If
Next iGMR
Next gmrDenom
End Sub

If you have difficulty with the code, please post a comment and I will try to help.

No comments: