These changes I made to make the box look like a "SOLID" box
is for ADVANCED users. The example is to show more what you
can do with BITMAPS than what you can do with 3D.
Basically I drew the front half and back half seperately and
then merged them together.
A great animation would be to "close" the box and have the
cover be simulated as a "SOLID" using the same method.
to blacksquare
; Draw a simple black filled square
repeat 4 [fd 247 rt 90]
rt 45
pu
fd 100
setfc [0 0 0]
fill
bk 100
lt 45
pd
end
to colour :f
make "s [[255 0 0][255 255 0][0 255 0][0 0 255][200 100 200]
[200 0 200][255 150 90]]
op item :f :s
end
to fil
pu rt :a fd :size*.7 pd fill pu bk :size*.7 lt :a pd
setfc colour :lev
end
to go
; Draw front of box with a black filled background and save it
go1
pu
rt 90
bk 100
setfc [0 0 0]
fill
pd
wrap
pu
setxy -250 -250
bitcopy 500 500
pd
; Draw a "MASK" for the front of the box and save it.
go2
wrap
pu
setxy -250 -250
setbitindex 1
bitcopy 500 500
setbitindex 0
pd
; Draw back of box.
go3
; Now merge front and back of box
wrap
pu
setxy -250 -250
; Clear a landing site for the front of the box
setbitmode 3
setbitindex 1
bitpaste
; Place front exactly in the landing site
setbitmode 2
setbitindex 0
bitpaste
pd
end
to go1
turnon3d cs lt 90 ht
repeat 3[side pu fd 247 pd] down 90
repeat 2[repeat 3[ pu fd 247 pd] down 90]
repeat 3[side pu fd 247 pd] down 90
end
to go2
turnon3d cs lt 90 ht
setfc [0 0 0]
repeat 3[blacksquare pu fd 247 pd] down 90
repeat 2[repeat 3[ pu fd 247 pd] down 90]
repeat 3[blacksquare pu fd 247 pd] down 90
end
to go3
turnon3d cs lt 90 ht
repeat 3[ pu fd 247 pd] down 90
repeat 2[repeat 3[side pu fd 247 pd] down 90]
repeat 3[ pu fd 247 pd] down 90
rr 90
repeat 3[pu setxyz -247*3 247 -247*(repcount- 1) pd repeat 3[side fd
247]]
end
to poly_star :size :n :lev
if :lev =0 [stop]
repeat :n [fd :size/ 4
poly_star :size/3 :n :lev-1 fd :size/ 2 rt 360/ :n]
setfc colour repcount
fil
end
to side
make "n 5 make "lev 2
make "c 180/ :n make "a 90- :c
square 247 fd 48 poly_star 200 :n :lev bk 48
end
to square :a
repeat 4[fd :a rt 90]
end
to turnon3d
; This can be a library procedure
perspective
setturtle -1
setxyz 1500 1500 1700
setturtle 0
end
--
===============================================================
George Mills (mills@softronix.com)
http://www.softronix.com/
The www page contains some very powerful educational software.
Our single most important investment is our kids.
Global SchoolNet Foundation -
Linking Kids Around the World!
Copyright GSN - All Rights Reserved
- Comments
& Questions
Visit GSN's
Global
Schoolhouse for more exciting learning resources!
Search our Site
-
Home