VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Paints a fern

by jjo (5 Submissions)
Category: Graphics
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Originally Published: Wed 23rd March 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Paints a fern

Rate Paints a fern




Private Sub Form_Load()

  Caption = ""
  Icon = LoadPicture("")
  Scale (0, 0)-(2000, 2000)

End Sub

Private Sub Form_Paint()

  Dim n As Long, t As Single
  Dim x As Single, y As Single, k As Integer
  Dim newx As Single, newy As Single
  Dim xmag As Integer: xmag = 200
  Dim ymag As Integer: ymag = 250

  Cls
  
  ReDim a(4), b(4), c(4), d(4), e(4), f(4)
  
  Dim numits As Long
  
  numits = 150000
  
  a(1) = 0: b(1) = 0: c(1) = 0: d(1) = 0.16: e(1) = 0: f(1) = 0
  a(2) = 0.85: b(2) = 0.04: c(2) = -0.04: d(2) = 0.85: e(2) = 0: f(2) = 1.6
  a(3) = 0.2: b(3) = -0.26: c(3) = 0.23: d(3) = 0.22: e(3) = 0: f(3) = 1.6
  a(4) = -0.15: b(4) = 0.28: c(4) = 0.26: d(4) = 0.24: e(4) = 0: f(4) = 0.44
 
  For n = 1 To numits
  
    t = Rnd
    
    If t < 0.01 Then
      k = 1
    ElseIf t >= 0.01 And t < 0.85 Then
      k = 2
    ElseIf t >= 0.85 And t < 0.92 Then
      k = 3
    Else
      k = 4
    End If
    
    newx = a(k) * x + b(k) * y + e(k)
    newy = c(k) * x + d(k) * y + f(k)
    
    x = newx: y = newy
    
    PSet (y * xmag, x * ymag + 1000), QBColor(3)

  Next n

End Sub

Private Sub Form_Resize()

  Form_Paint

End Sub


Download this snippet    Add to My Saved Code

Paints a fern Comments

No comments have been posted about Paints a fern. Why not be the first to post a comment about Paints a fern.

Post your comment

Subject:
Message:
0/1000 characters