Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can _MOUSEMOVEMENTX & Y be used for something like this?
#3
Does this do what you want?

Code: (Select All)

Screen _NewImage(800, 600, 32)

cx = 400: cy = 400

Do

    Cls , _RGB(32, 0, 0)

    Locate 1, 1: Print "Click on and drag curves to shape...";

    While _MouseInput

        'grabbed screen
        If _MouseButton(1) Then

            '=====================================================
            'Can _MOUSEMOVEMENTX/Y be used instead of below?

            Cls , _RGB(32, 0, 0)

            newcx = cx + _MouseMovementX
            newcy = cy + _MouseMovementY

            For c = -300 To 300 Step 20
                Curve 400, 100, 400, 500, newcx + c, newcy, _RGB(255, 0, 0)
            Next
            _Limit _Width * 10000
            _Display
            cx = newcx: cy = newcy
            '=====================================================

        End If
    Wend
    For c = -300 To 300 Step 20
        Curve 400, 100, 400, 500, cx + c, cy, _RGB(255, 0, 0)
    Next

    _Limit 30
    _Display
Loop Until InKey$ = Chr$(27)

Sub Curve (x1, y1, x2, y2, cx, cy, clr&)
    'Draws a curved line using a quadratic bezier curve formula
    'x1/y1 = start point
    'x2/y2 = end point
    'cx.cy = control point
    Do While t <= 1
        x = (1 - t) ^ 2 * x1 + 2 * (1 - t) * t * cx + t ^ 2 * x2
        y = (1 - t) ^ 2 * y1 + 2 * (1 - t) * t * cy + t ^ 2 * y2
        PSet (x, y), clr&
        t = t + .001
    Loop
End Sub
Reply


Messages In This Thread
RE: Can _MOUSEMOVEMENTX & Y be used for something like this? - by James D Jarvis - 10-15-2023, 11:35 PM



Users browsing this thread: 1 Guest(s)