Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Starfish
#1
Hold your mouse still for a moment and you'll find out why the program has this name.

This is a modified version, the original intent is different. It will be published soon as part of another source code.

Code: (Select All)


Screen _NewImage(1024, 768, 32)

Type Manim
    As _Unsigned _Byte R, G, B, A, Radius, Sze
    As Single Angle, Speed, SAngle
    As _Unsigned Integer Cx, Cy
End Type
Dim Shared MoAn(5000) As Manim



'Cls
Do Until _KeyDown(27)
    Cls
    DrawStars
    _Display
    _Limit 200
Loop

Sub DrawStars
    Do Until i = UBound(MoAn)
        J = MoAn(i).SAngle
        While _MouseInput
        Wend
        MX = _MouseX
        MY = _MouseY
        CenterX = MX + Cos(MoAn(i).Angle) * MoAn(i).Radius
        CenterY = MY + Sin(MoAn(i).Angle) * MoAn(i).Radius
        If MoAn(i).A <= 0 Then
            MoAn(i).Cx = CenterX: MoAn(i).Cy = CenterY
        Else
            PSet (MoAn(i).Cx, MoAn(i).Cy), _RGBA32(MoAn(i).R, MoAn(i).G, MoAn(i).B, MoAn(i).A)
        End If

        add = _Pi(2) / 6
        Do Until J > MoAn(i).SAngle + _Pi(2)
            Line -Step(Cos(J + MoAn(i).SAngle) * MoAn(i).Sze, Sin(J + MoAn(i).SAngle) * MoAn(i).Sze), _RGBA32(MoAn(i).R, MoAn(i).G, MoAn(i).B, MoAn(i).A)
            J = J + add
        Loop

        If MoAn(i).Radius > _Pi(4) Or MoAn(i).A <= 10 Then
            MoAn(i).R = 1 + 254 * Rnd
            MoAn(i).G = 127 + 128 * Rnd
            MoAn(i).B = 255 - 254 * Rnd
            MoAn(i).A = 10 + 200 * Rnd
            MoAn(i).Cx = CenterX: MoAn(i).Cy = CenterY
            MoAn(i).Radius = 1 + Rnd
            MoAn(i).Sze = .1 + Rnd * 3
            MoAn(i).Angle = _Pi(2) / 11 * i + MoAn(i).SAngle
            MoAn(i).Speed = (1 + Rnd * 110) / 300
            MoAn(i).SAngle = .01 ' + Rnd
        End If
        MoAn(i).A = MoAn(i).A + .01

        MoAn(i).Radius = MoAn(i).Radius + MoAn(i).Speed
        MoAn(i).SAngle = MoAn(i).SAngle + _Pi / 40 ' .2
        MoAn(i).Sze = MoAn(i).Sze * .75
        MoAn(i).A = MoAn(i).A - 2

        MoAn(i).Cx = MoAn(i).Cx + Cos(MoAn(i).Angle) * MoAn(i).Radius
        MoAn(i).Cy = MoAn(i).Cy + Sin(MoAn(i).Angle) * MoAn(i).Radius

        i = i + 1
    Loop
End Sub


Reply
#2
Very cool, Petr! Fun effect!
Reply
#3
Thank You, NakedApe. Here is one small modification. Now it look something different...

Code: (Select All)


Screen _NewImage(1024, 768, 32)

Type Manim
    As _Unsigned _Byte R, G, B, A, Radius, Sze
    As Single Angle, Speed, SAngle
    As _Unsigned Integer Cx, Cy
End Type
Dim Shared MoAn(5000) As Manim




Do Until _KeyDown(27)
    Cls
    DrawStars
    _Display
    _Limit 200
Loop

Sub DrawStars
    Do Until i = UBound(MoAn)
        J = MoAn(i).SAngle
        While _MouseInput
        Wend
        MX = _MouseX
        MY = _MouseY
        CenterX = MX + Cos(MoAn(i).Angle) * MoAn(i).Radius
        CenterY = MY + Sin(MoAn(i).Angle) * MoAn(i).Radius
        If MoAn(i).A <= 0 Then
            MoAn(i).Cx = CenterX: MoAn(i).Cy = CenterY
        Else
            PSet (MoAn(i).Cx, MoAn(i).Cy), _RGBA32(MoAn(i).R, MoAn(i).G, MoAn(i).B, MoAn(i).A)
        End If

        add = _Pi(2) / 6
        Do Until J > MoAn(i).SAngle + _Pi(2)
            Line -Step(Cos(J + MoAn(i).SAngle) * MoAn(i).Sze, Sin(J + MoAn(i).SAngle) * MoAn(i).Sze), _RGBA32(MoAn(i).R, MoAn(i).G, MoAn(i).B, MoAn(i).A)
            J = J + add
        Loop


        If MoAn(i).Radius > _Pi(4) Or MoAn(i).A <= 10 Then
            Randomize Timer
            MoAn(i).R = 255 - 40 * Rnd
            MoAn(i).G = 155 * Rnd
            MoAn(i).B = 54 * Rnd
            MoAn(i).A = 10 + 200 * Rnd
            MoAn(i).Cx = CenterX: MoAn(i).Cy = CenterY
            MoAn(i).Radius = 1 + Rnd
            MoAn(i).Sze = 1
            MoAn(i).Angle = _Pi(2) / 11 * i + MoAn(i).SAngle + 1
            MoAn(i).Speed = (1 + Rnd * 110) / 300
            MoAn(i).SAngle = 1
        End If
        MoAn(i).A = MoAn(i).A + .01

        MoAn(i).Radius = MoAn(i).Radius + MoAn(i).Speed
        MoAn(i).SAngle = MoAn(i).SAngle + _Pi / 10
        MoAn(i).Sze = MoAn(i).Sze * .75
        MoAn(i).A = MoAn(i).A - 2
        MoAn(i).Angle = MoAn(i).Angle + .1
        MoAn(i).Cx = MoAn(i).Cx + Cos(MoAn(i).Angle) * MoAn(i).Radius
        MoAn(i).Cy = MoAn(i).Cy + Sin(MoAn(i).Angle) * MoAn(i).Radius

        i = i + 1
    Loop
End Sub


Reply




Users browsing this thread: 1 Guest(s)