| Search Results | Total results: 10 |
| 1 |
Tips
/ Re: rainbow function |
on: Today at 2:11pm |
| Started by tsh73 | Post by Welopez |
A very nice transition and rainbow effect, Tsh. Some real thought went into the logic for your program.
|
|
| 2 |
Tips
/ rainbow function |
on: Today at 09:32am |
| Started by tsh73 | Post by tsh73 |
This function return smooth color transition, 0..1 into red-green-blue-red. Actually modified HSL to RGB function. Could be useful - for fractals, color height maps, whatever. Use as you like.
Code:
'demo of a rainbow function
'by tsh73 Nov 2009
nomainwin
open "function" for graphics as #grFunc
print #grFunc, "trapclose [trapclosehLabel]"
print #grFunc, "home ; down ; posxy x y"
w = 2*x: h = 2*y
'linear color spread
for x = 0 to w
#grFunc, "color ";rainbow$(x/w)
#grFunc, "place ";x;" ";y
#grFunc, "box ";x+2;" ";y+20
next
'linear color spread. now from -1 to 2
for x = 0 to w
#grFunc, "color ";rainbow$(x/w*3-1)
#grFunc, "place ";x;" ";y+30
#grFunc, "box ";x+2;" ";y+50
next
pi = acs(-1)
'curcular color spread
#grFunc, "size 10"
for a = 0 to 2*pi step 0.01
x = w/2+w/3*cos(a)
y = h/2+h/3*sin(a)
#grFunc, "color ";rainbow$(a/(2*pi))
#grFunc, "set ";x;" ";y
next
'height map, minimal violet, maximal red
#grFunc, "size 7"
for x = 0 to w
xx = x/w*2*pi
yy = (sin(xx)+1)/2 'function scaled to 0..1
'in rainow$, 0 is red and 5/6 is violet. So we scale it more like this
c=(1-yy)*5/6
y = w/2-w/3*sin(xx) 'y is inverted hence '-'
#grFunc, "color ";rainbow$(c)
#grFunc, "set ";x;" ";y
next
wait
[trapclosehLabel]
close #grFunc
end
'---------------------------------------------
' 0..1 into red-green-blue-red continuous colors
function rainbow$(x)
hi = int((x*6) mod 6)+ 5*(x<0) 'fixed to 0..5
f = (x*6) mod 1 + (x<0) 'frac, 0..1
q = (1-f)
select case hi
case 0
r = 1: g = f: b = 0
case 1
r = q: g = 1: b = 0
case 2
r = 0: g = 1: b = f
case 3
r = 0: g = q: b = 1
case 4
r = f: g = 0: b = 1
case 5
r = 1: g = 0: b = q
end select
R = int(r*255)
G = int(g*255)
B = int(b*255)
rainbow$= R;" ";G;" ";B
end function
|
|
| 3 |
Announcements
/ Re: A new technique to 'see' objects in stereogram |
on: Today at 06:17am |
| Started by colinord | Post by tenochtitlanuk |
Fantastic stuff. While I particularly like the 2D & 3D stuff, which is just the kind of thing I enjoy, the 'Magic Eye' was also interesting. I remember a similar 'twinkling' way some years back to convince the 'unbelievers' that 3D images exist. Never got round to trying it on my own LB stereogram programs. I used to find that about 1 in four sees them easily, and about another 1 in four with help and practice.
|
|
| 4 |
General Board
/ Re: Liberty Basic Free or Purchase? |
on: Yesterday at 11:56pm |
| Started by bill2reg | Post by JohnDavidson |
Quote:| Not necessairly so. After the trial period the nag screen gets longer and longer, something like a minute longer for each additional day. |
|
The idea is that you eventually pay for LB.
Quote:| The LB IDE frequently crashes, so one has to go thru this nag screen ordeal many times when working with code. |
|
The only time I've had LB's IDE crash is when I've mangled an API.
You could use Kristina Edit to develop LB applications. You would still have to deal with the Welcome screen when you run code but KE will remain with your code intact if LB's IDE crashes.
John
|
|
| 5 |
General Board
/ Re: Liberty Basic Free or Purchase? |
on: Yesterday at 11:09pm |
| Started by bill2reg | Post by zoomkat |
on Yesterday at 2:41pm, Welopez wrote:Why haven't you downloaded the trial version of LB? There is no expiration to it. You can use it for the next year or two... unless you simply prefer asking questions to actually doing the work. |
|
Not necessairly so. After the trial period the nag screen gets longer and longer, something like a minute longer for each additional day. You have to use task manager to kill the always on top nag screen on the desk top. The LB IDE frequently crashes, so one has to go thru this nag screen ordeal many times when working with code. I haven't worked with LB in well over a year due to the hassle.
|
|
| 6 |
JB Programs Shared
/ Re: mastermind game |
on: Yesterday at 10:09pm |
| Started by purecardmagic | Post by TyCamden |
Something is not right with it.
First guess I guessed Red-Red-Blue-Blue-Blue and got 0-0 (no hits)
Second guess I guessed Pink-Pink-Black-Black-Black and got 1-2 (three hits, one in exact spot).
Third guess is irrelevant.
Fourth guess I guessed White-White-Red-Red-Red and got 1-2 (three hits, one in exact spot). At this point I know something is wrong since there are no reds, and I only guessed two whites and got three hits. Also, I already know there are three items using pink and black, so there can only be Two hits max using White and Red.
Sixth guess I guessed Black-Red-Red-Red-Red and got 1-1 (two hits, one in exact spot). Should not have two hits.
Seventh guess was frustration - all reds. No hits. This means that the program simply gives the clues to the answer wrong. Like in guess Six. I only guessed one black in a spot. It then tried to tell me - There IS one there, but there is another one elsewhere. Bad clue. It should have only stated 1-0.
My favorite was when I then (for guess nine), I guessed Black-White-Black-Pink-Green and got 2-4 (six hits for five pegs).
I quit.
I think this would be a nice program if the logic behind the clue giving were corrected.
|
|
| 7 |
Announcements
/ A new technique to 'see' objects in stereograms |
on: Yesterday at 8:39pm |
| Started by colinord | Post by colinord |
A proof of concept Stereogram - 3D Object Viewer programmed in 'Justbasic'
Colin Ord, author of the bestselling Magic Moving Images - animated optical illusions book introduces a quick and easy technique for everyone to 'see' the 3D objects in stereogram images without straining, crossing or squinting their eyes.
A fantastic solution to 'prove' something exists in these dotty patterns!
The technique can be produced with Photoshop but I also chose to create a Stereogram - 3D Object Viewer in Justbasic as a proof of concept.
The downloadable Stereogram - 3D Object Viewer (v1.0) application (data.exe) engine was coded in JustBasic (although a tiny VB front end was used to enable loading of JPGS and GIFS.
(The engine loads in a stereogram, images creates 'sprite' masks and duplicate image overlays to achieve the effect, sounds complicated....and it was!!)
Please visit my personal project website for more details or to download the Stereogram - 3D Object Viewer v1.0
www.colinord.com
also view the video tutorial on youtube to see the technique performed in Photoshop: http://www.youtube.com/watch?v=4oqThhzSF4k
Kind Regards Colin Ord
p.s. all the projects on my project site have been conceived using Justbasic. - AutonotesUSB v1.0 - 3D Laser Scanner - 2D motion tracker
Once each idea was finalised and worked fully I re-wrote them in VB6.
|
|
| 8 |
JB Programs Shared
/ Re: JB Color Reading Game |
on: Yesterday at 8:33pm |
| Started by jbfan | Post by jaba |
I think this program is nicely done. I enjoyed playing it. I do have a couple of comments.
I found that if I click the No button quickly through the 30 choices that I get most answers correct. Maybe there is some way that more choices will match, which would make it more difficult to click the right button each time.
Your counter stops at 31 instead of 30. I found that if I make the following change in your code, the counter stops at 30 which is more consistent with your game instructions. Code:[CountNumber]
count=count+1
if count>30 then gosub [stats]
print #main.statictext1, "#";count;"."
return
wait
I like the structure of your game. I was thinking it would make a good basis for a quiz on JustBASIC commands and functions, etc. Flash a command and description and see if they match... It could be good training for new users like myself. What do you think?
jaba
|
|
| 9 |
JB Programs Shared
/ Re: mastermind game |
on: Yesterday at 8:23pm |
| Started by purecardmagic | Post by Gordon R |
BUT..... the game is unbeatable!!!
The program has a bug. The computer will make "" (blank) colors if the RND is 0
Gordon
Hint: guess$(X) = INT(RND(1)*10 +1) to prevent "" guess
|
|
| 10 |
Games and Graphics
/ Re: :/ Not knowin much.. Help me with my zombie ga |
on: Yesterday at 7:31pm |
| Started by Nmb910 | Post by cundo |
Start your game using the resources that came with Just BASIC, there are some simple Sprites and a couple of Backgrounds. Simple GUI to start: Create it with the last freeform-j, put a Graphicbox in it. Something like this Code:
WindowWidth = DisplayWidth
WindowHeight = DisplayHeight
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
graphicbox #main.g, 0, 0, WindowWidth, WindowHeight
open "game.test" for window_nf as #main
print #main.g,"down; fill BROWN; flush"
#main "trapclose [quit.main]"
WAIT
[quit.main]
Close #main
END
|
|
|