VB icon

A Colorful Ball of Light Function

Email
Submitted on: 1/15/2015 6:10:00 PM
By: SethMicah (from psc cd)  
Level: Beginner
User Rating: By 3 Users
Compatibility: VB 6.0
Views: 719
 
     This code will allow you to make a ball of light of any size and color, ready to go in a module! Please vote.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: A Colorful Ball of Light Function
' Description:This code will allow you to make a ball of light of any size and color, ready to go in a module! Please vote.
' By: SethMicah (from psc cd)
'
' Inputs:frm As Form, originx As Integer, originy As Integer, radius As Integer, red As Integer, green As Integer, blue As Integer
'
' Returns:Returns a filled ball of light on your form that displays a white center that ascends to any color of your choice.
'
' Side Effects:Somewhat slow.. the bigger/more balls of light the slower it will get.
'**************************************

Public Function MakeLight(frm As Form, originx As Integer, originy As Integer, radius As Integer, red As Integer, green As Integer, blue As Integer)
For tiltx = -0.5 To 0.5 Step 0.5 ' offset it a tad to get the pixels not colored
For tilty = -0.5 To 0.5 Step 0.5 ' offset it a tad to get the pixels not colored
For tempradius = 0 To radius Step 1 ' colors multiple circles with origins from the origin to origin + radius
Randomize
circlecolor = Int(Rnd * (1 * (radius / 255))) + (tempradius / (radius / 255)) + 1 ' gets a random color in a specific range, give it the light effect
circlecolor = Abs(circlecolor - 255) ' inverts the colors from white outside to white inside
frm.Circle (originx + tiltx, originy + tilty), tempradius, RGB(circlecolor + red, circlecolor + green, circlecolor + blue) ' makes the circle
Next tempradius
Next tilty
Next tiltx
End Function


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.