Here is the script from a button titled appropriately enough "Draw Colorful Lines at Random":
global varX, varY, varXprev, varYprev, varRGB1, varRGB2, varRGB3
on mouseUp
choose brush tool
set the brush to 32
set the dragSpeed to 0
put 250 into varXprev
put 250 into varYprev
repeat until the mouseclick
hide button "Draw Random Colorful Lines"
hide button "Erase"
put round(random(500)) into varX
put round(random(500)) into varY
put round(random(255)) into varRGB1
put round(random(255)) into varRGB2
put round(random(255)) into varRGB3
set the brushColor to varRGB1, varRGB2, varRGB3
drag from varXprev, varYprev to varX, varY
put varX into varXprev
put varY into varYprev
end repeat
choose browse tool
show button "Erase"
end mouseUp
I hope you can quickly see that it is nothing more than a quickly revised script of the button "Draw Lines" from my previous post.
Here is a screenshot of the program after running for 60 seconds:
And, this static image, "avant-garde" as it is, is nothing compared to being mesmerized by watching the program run.
There, I feel better.
Hi,
ReplyDeleteI Think you need to add in code that sets the Erase button to the top layer before you show it. Otherwise it is hidden by all the line.
--set the layer of button "Erase" to top
-- show button "Erase"
I also added code to show the draw button after erasing. So, in the "Erase" button mouseUp
<>
choose select tool
drag from 0,0 to 500,500
cut
choose browse tool
show button "Draw Random Colorful Lines"
<>
You can also change the code in the Draw button to say "hide me" rather than having to explicitly reference the calling object.