Sinisterly
[VB.Net] 2D Graphics - color-changing, fading loading - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: Visual Basic & .NET Framework (https://sinister.ly/Forum-Visual-Basic-NET-Framework)
+--- Thread: [VB.Net] 2D Graphics - color-changing, fading loading (/Thread-VB-Net-2D-Graphics-color-changing-fading-loading)



[VB.Net] 2D Graphics - color-changing, fading loading - Coder-san - 04-29-2011

[Image: zTSHa.gif]

I was a bit bored yesterday, so I made this. Smile
No image has been used. Everything is rendered.

Spoiler: Source
Code:
Dim intRender As Integer = 0
    Dim ArrOpacity As Integer() = {240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240}
    Dim ArrLocation As Point() = {New Point(175, 0), New Point(235, 18), New Point(285, 50), New Point(325, 95), New Point(350, 160), _
                                  New Point(325, 225), New Point(285, 275), New Point(240, 310), New Point(175, 325), New Point(120, 305), _
                                  New Point(75, 275), New Point(35, 225), New Point(10, 160), New Point(35, 95), New Point(75, 50), New Point(120, 20)}
    Dim g As Graphics, bmp As Bitmap, theColor As Color = Color.FromArgb(50, 255, 255)
    Dim ThreadRunning As Boolean = True

    Private Sub LoadingThread()
        CheckForIllegalCrossThreadCalls = False
        Try
            Do While ThreadRunning = True
                Me.BackgroundImage = New Bitmap(Me.Width, Me.Height)
                For intI = 0 To ArrLocation.GetUpperBound(0)
                    ArrOpacity(intI) -= 15
                    theColor = Color.FromArgb(theColor.R, 255 - ArrOpacity(intI), ArrOpacity(intI))
                    RenderCircle(ArrOpacity(intI), theColor, ArrLocation(intI))
                Next

                RenderCircle(255, theColor, ArrLocation(intRender))
                ArrOpacity(intRender) = 255
                If intRender < 15 Then intRender += 1 Else intRender = 0
                Me.BackgroundImage = bmp
                Threading.Thread.Sleep(150)
                If ThreadRunning = False Then Exit Do
            Loop
        Catch ex As Exception

        End Try
    End Sub

    Private Sub RenderCircle(ByVal Opacity As Byte, ByVal Color As Color, ByVal Location As Point)
        g.FillEllipse(New SolidBrush(Color.FromArgb(Opacity, Color)), New Rectangle(Location, New Size(30, 30)))
    End Sub

    Private Sub frmMain_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        ThreadRunning = False
    End Sub

    Private Sub frmMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        bmp = New Bitmap(Me.Width, Me.Height)
        g = Graphics.FromImage(bmp)
        Dim t As New Threading.Thread(AddressOf LoadingThread)
        t.IsBackground = True
        t.Start()
    End Sub



RE: [VB.Net] 2D Graphics - color-changing, fading loading - 1234hotmaster - 04-29-2011

wowwwwwww this is so awesome!! :O

you need to post some more System.Drawing cause i wanna do stuff like this Biggrin


RE: [VB.Net] 2D Graphics - color-changing, fading loading - Coder-san - 04-29-2011

Some more things I need to try is 2d waves and shockwave.
But it's tough to figure them out. ; /


RE: [VB.Net] 2D Graphics - color-changing, fading loading - DeffoN - 05-02-2011

Nice no image used Smile
really nice !!


RE: [VB.Net] 2D Graphics - color-changing, fading loading - Psycho_Coder - 04-10-2013

This is awesome , thank you this will help me a lot


RE: [VB.Net] 2D Graphics - color-changing, fading loading - nookienuk - 10-20-2013

I LOVE seeing new stuff like this Smile Great job bro, great job! Smile