Page 1 of 1 1
Topic Options
#84744 - 2001-12-28 12:55 AM KixForms - Unlease your artistic flare using just your left mouse button
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
This is a brutally mutilated little KIXBGI script that CJ did quite some time ago ... CJ, sorry for the hack job on this one ... but it's one of my favorites ... please, feel free to setting the record straight by reposting as desired ...

Run this script and use your left mouse button to control the color rendering ... it starts off in erase mode (no color) - click the mouse once to get into random color mode, then click again into solid color mode, then click again and it takes you back to erase mode ... kinda fun ...


break on


;
; KIXTART 4.01
; KIXFORMS BUILD 4 - http://kixtart.tripod.ca/kixforms.zip
;
; Written by cj, multilated by shawn
;


srnd(@ticks)

$form = createobject("kixtart.form")
$width = $form.clientwidth
$height = $form.clientheight
$form.caption = "Shawn"
$form.backcolor = 0


$label1 = $form.label(175,0,300,40,"KiXtart Version 4.01")
$label1.visible=0
$label1.top=0
$label1.forecolor = $form.rgb(0,191,255)
$label1.fontsize = 24
$label1.fontname = "Times Roman New"


$label2 = $form.label(0,175,300,40,"KiXforms Build 4")
$label2.visible=0
$label2.left=0
$label2.forecolor = $form.rgb(127,255,212)
$label2.fontsize = 24
$label2.fontname = "Times Roman New"


$label3 = $form.label(0,250,300,40,"The Bouncing Line")
$label3.visible=0
$label3.forecolor = $form.rgb(250,250,10)
$label3.fontsize = 24
$label3.fontname = "Times Roman New"


$form.visible=1


$label1.visible=1
for $top=0 to 100 step 2
$label1.top=$top
next

$label2.visible=1
for $left=-100 to 190 step 2
$label2.left=$left
next

$label3.visible=1
for $left=$form.clientwidth to 180 step -2
$label3.left=$left
next

$start = $form.commandbutton(255,350,100,40,"START")


while $form.getevent
if $start.click
bounce()
endif
loop

exit 1


function bounce()

$label1 = 0
$label2 = 0
$label3 = 0
$start = 0

$x1=20
$y1=40
$x2=150
$y2=180

$s=3 ; max speed

$x1d=1
$y1d=2
$x2d=-1
$y2d=-2

$ol=0 ; start with mode 0, left click to change mode...
$lc = $form.rgb(255,255,255) ; line colour, cycle with right click, used in OL mode 2 only

do

; old line

select

case $ol=0 ; erase old line mode

$form.forecolor = 0 ; black

case $ol=1 ; multicoloured trail mode

$form.forecolor = $form.rgb(rnd(255),rnd(255),rnd(255))

case $ol=2 ; single coloured trail

$red=$red+1;rnd(10)
if $red > 255
$red=rnd(255)
endif
$blue=$blue+1;rnd(10)
if $blue > 255
$blue=rnd(255)
endif
$green=$green+1;rnd(10)
if $green > 255
$green=rnd(255)
endif

$form.forecolor = $form.rgb($red,$green,$blue)

endselect

$form.line($x1, $y1, $x2, $y2) ; draw old line

; new location

$x1=$x1+$x1d

if $x1 > $width
$x1d=0-(rnd($s)+1)
endif

if $x1<0
$x1d=rnd(2)+1
endif

$y1=$y1+$y1d

if $y1>$height
$y1d=0-(rnd($s)+1)
endif

if $y1<0
$y1d=rnd(2)+1
endif

$x2=$x2+$x2d

if $x2>$width
$x2d=0-(rnd($s)+1)
endif

if $x2<0;
$x2d=rnd(2)+1
endif

$y2=$y2+$y2d

if $y2>$height
$y2d=0-(rnd($s)+1)
endif

if $y2<0;
$y2d=rnd(2)+1
endif

; draw live line

$form.forecolor = $form.rgb(255,255,255)

$form.line($x1, $y1, $x2, $y2)

if $form.peekevent

if $form.visible = 0
return
endif

if $form.mousedown

if $form.mousebutton = 1

select

case $ol = 0

$form.caption = "Random-Color Mode"
$ol = 1

case $ol = 1

$form.caption = "Cycle-Color Mode"
$red=rnd(255)
$green=rnd(255)
$blue=rnd(255)
$ol=2

case $ol = 2
$form.caption = "Erase Mode"
$ol = 0

endselect

endif

endif
endif
$form.delay(3)
until 1=0
endfunction

-Shawn

[ 28 December 2001: Message edited by: Shawn ]

Top
#84745 - 2001-12-29 04:47 AM Re: KixForms - Unlease your artistic flare using just your left mouse button
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
You have done well. I won't bother posting the original as I think you have captured it nicely

Go crazy with any other BGI script you like.

cj

Top
#84746 - 2001-12-29 11:07 AM Re: KixForms - Unlease your artistic flare using just your left mouse button
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
... agreed ,

only one style question came up since dl'd :

infinite loops in order to get conservative mathematicians in panic are ending with :

code:

...
until 1 = 0 / 0

_________________________



Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2312 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.052 seconds in which 0.026 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org