Another cool color animation
MisterX
b.xavier at internet.lu
Sun Feb 20 08:52:24 EST 2005
Here's another cool code taken from the source codes at bits-101
it's definitely cool!
-- Source file was from 040401.fla
-- from bits-101.com
Enjoy
Xavier
Just create a new stack and stick this into the card script
click on the card and behold!
local numpointlist 40 -- this is the complexity - bigger = slower but
nicer!
on mouseup x
if x = 3 then
repeat while there is an image 1
delete image 1
end repeat
else
doit
end if
end mouseup
on doit
put the width of this cd into w
put the height of this cd into h
choose imagetool
choose pencil tool
set the rect of the templateimage to the rect of this cd
create image
set the tool to "line"
put random(256)-1 into r1
put random(256)-1 into g1
put random(129)-1 into b1
put random(129)-1 into r2
put random(256)-1 into g2
put random(256)-1 into b2
put (r2 - r1)/h into dr
put (g2 - g1)/h into dg
put (b2 - b1)/h into db
put w / (numpointlist - 1) into dist
put random(101)-1 + 100 into noise
put random( 11)-1 + 5 into noise2
repeat with i = 0 to numpointlist-1
put i * dist+1, random(noise+1)-1 - noise / 2 into pointlist[i]
end repeat
repeat with i = 0 to numpointlist - 2
put (item 1 of pointlist[i] + item 1 of pointlist[i + 1]) / 2 into item
1 of LineMids[i]
put (item 2 of pointlist[i] + item 2 of pointlist[i + 1]) / 2 into item
2 of LineMids[i]
end repeat
repeat with y = 0 to h
set cursor to busy
repeat with i = 0 to numpointlist-1
add 1 + random(noise2+1)-1 - noise2/2 to item 2 of pointlist[i]
end repeat
repeat with i = 0 to numpointlist - 2
put (item 1 of pointlist[i] + item 1 of pointlist[i + 1]) / 2 into
item 1 of LineMids[i]
put (item 2 of pointlist[i] + item 2 of pointlist[i + 1]) / 2 into
item 2 of LineMids[i]
end repeat
put r1 + dr*y into red
put g1 + dg*y into green
put b1 + db*y into blue
put round(red bitxor 16),round(green bitxor 8),round(blue) into col
set the pencolor to col
repeat with i = 1 to numpointlist - 3
drag from LineMids[i] to pointlist[i+1]
drag from pointlist[i] to LineMids[i]
end repeat
drag from pointlist[i] to pointlist[i + 1]
if the mouse is down then
unlock screen
answer "Uh Oh. Should I stop?" with "cancel" or "Continue"
if it is "Cancel" then exit repeat
lock screen
end if
end repeat
choose browse tool
end doit
More information about the use-livecode
mailing list