Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QBJS Hair mod
#1
Reply
#2
mod 2
Reply
#3
That's a really cool effect. In Mod 2, holding down left mouse button is a riot. Is there a way to erase the left button effect in Mod 2? The mod 2 string should be an additional option to all paint program brush choices. (maybe it is with the modern paint programs, if not, it should be)
Reply
#4
(10-07-2024, 12:44 PM)Dimster Wrote: That's a really cool effect. In Mod 2, holding down left mouse button is a riot. Is there a way to erase the left button effect in Mod 2? The mod 2 string should be an additional option to all paint program brush choices. (maybe it is with the modern paint programs, if not, it should be)

Oh yeah! Smile
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#5
This is very cool
Reply
#6
This is seriously great!


Reply
#7
Wow! Reminds me of old Chinese writing using a brush. Really cool effect.

How do I see the code?
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply
#8
Question 
(10-07-2024, 06:43 PM)TerryRitchie Wrote: Wow! Reminds me of old Chinese writing using a brush. Really cool effect.

How do I see the code?
This is really neat - and I second the question, how do we see the code? Very curious!  Big Grin
Reply
#9
"How do we see the code?"

vince posted the hair code in: Vinces Corner Takeout:
https://qb64phoenix.com/forum/showthread...7#pid28997
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#10
Code: (Select All)
dim shared as integer sw, sh, mx, my, mb, mw

sw = 800
sh = 600

screen _newimage(sw, sh, 32)
img = _newimage(sw, sh, 32)
if _resize then
    sw = _resizewidth - 20
    sh = _resizeheight - 20
    screen _newimage(sw, sh, 32)
    img = _newimage(sw, sh, 32)
end if

_dest img
for y=0 to sh
for x=0 to sw
    c = 100+10*rnd
    pset (x, y), _rgb(c,c,c)
next
next
_dest 0
   
n = 14
dim x(n), y(n)

for i=0 to n-1
    x(i) = sw/2
    y(i) = i*sh/n
next

r = 14
mw = r



do
    _putimage , img

    getmouse
    r = mw

    x(0) = mx
    y(0) = my
    for i=1 to n-1
        if ((x(i - 1) - x(i))^2 + (y(i - 1) - y(i))^2) > r*r then
            a = _atan2(y(i - 1) - y(i), x(i - 1) - x(i)) - pi
            x(i) = x(i - 1) + r*cos(a)
            y(i) = y(i - 1) + r*sin(a)
        end if
    next


    'preset (x(0), y(0))
    'for i=0 to n - 1
    '    line -(x(i), y(i)), _rgb(55,55,0)
    '    circle (x(i), y(i)), 3, _rgb(255,255,0)
    'next

    preset (x(0), y(0))
    ox = x(0)
    oy = y(0)
    dt = 0.001
    for t=0 to 1 step dt
        bx = 0
        by = 0   
       
        'dx = 0
        'dy = 0
       
        for i=0 to n - 1
            bin = 1
            for j=1 to i
                bin = bin*(n - j)/j
            next
       
            p = bin*((1 - t)^(n - 1 - i))*(t^i)
            bx = bx + p*x(i)
            by = by + p*y(i)
                         
            'q = bin*((1 - t)^(n - 2 - i))*(t^(i - 1))*(i - n*t + t)
            'dx = dx + q*x(i)
            'dy = dy + q*y(i)               
        next

        if abs(bx - ox)>1 and abs(by - oy)>1 then
            line -(bx, by), _rgb(255,0,0)

            ox = bx
            oy = by
        end if
       
        'm = sqr(dx*dx + dy*dy)
        'line -step(10*dx/m, 10*dy/m), _rgb(0,255,0)
    next
    line -(bx, by), _rgb(255,0,0)
   
   
    if _mousebutton(1) then
    _dest img
    'do while mb = 1
        'getmouse       
        dt = 0.01
        for t=0 to 1 step dt
            bx = 0
            by = 0   
       
            'dx = 0
            'dy = 0
       
            for i=0 to n - 1
                bin = 1
                for j=1 to i
                    bin = bin*(n - j)/j
                next
       
                p = bin*((1 - t)^(n - 1 - i))*(t^i)
                bx = bx + p*x(i)
                by = by + p*y(i)
                         
                'q = bin*((1 - t)^(n - 2 - i))*(t^(i - 1))*(i - n*t + t)
                'dx = dx + q*x(i)
                'dy = dy + q*y(i)               
            next

            rr = 2*exp(-10*t*t)
            circle (bx, by), rr, _rgba(155,0,35,70)
       
        next
    'loop   
    _dest 0
    end if


    _display
    _limit 60
loop until _keyhit = 27
system


sub getmouse()
    do
        mx = _mousex
        my = _mousey
        mb = _mousebutton(1)
        'mw = mw - _mousewheel
    loop while _mouseinput
end sub
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  mod for B+ vince 4 1,439 09-03-2023, 04:27 PM
Last Post: grymmjack

Forum Jump:


Users browsing this thread: 1 Guest(s)