Fade effect?
Author |
Message |
Thuged_Out_G
|
Posted: Fri Dec 12, 2003 4:51 pm Post subject: Fade effect? |
|
|
i wanted to make a sonar like thing
here is what i have so far, its not much lol
code: |
View.Set ("graphics")
for decreasing i : maxint .. 1
Draw.FillArc (100, 100, 100, 100, 0, 360, black)
Draw.FillArc (100, 100, 100, 100, i - 1, i, 10)
delay(15)
end for
|
i was wondering how i could add like a fade effect to the green bar
any ideas anyone? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Mazer
|
Posted: Fri Dec 12, 2003 5:33 pm Post subject: (No subject) |
|
|
with turing, you start off with a pretty crappy (for most things) palette of 256 colours. if you plan on drawing with any other colours you're either loading pictures, or making your own colours. luckily there's a way to make your own colours in turing: RGB.SetColour(). it takes 4 parameters: colour number, red component, green component, and blue component. using this you can mix your own colours by using various values of red green and blue (between 0.0 and 1.0, see link for (a little) more information)
code: |
var angle := 0
for i : 0 .. 255
RGB.SetColour (i, 0, (i - 150) / 150 * i / 255, 0)
end for
RGB.SetColour (255, 0, .8, 0)
RGB.SetColour (0, 0, 0, 0)
cls
View.Set ("offscreenonly")
loop
angle += 5
for decreasing c : 255 .. 170
Draw.FillArc (100, 100, 100, 100, angle + c, angle + c + 1, c)
drawfillarc (100, 100, 100, 100, angle + 255, angle + 257, 255)
end for
View.Update
delay (20)
drawfilloval (100, 100, 100, 100, 170)
end loop
|
|
|
|
|
|
|
DanShadow
|
Posted: Fri Dec 12, 2003 5:41 pm Post subject: (No subject) |
|
|
Ah! RGB is the answer to not using the 256 colors...ive been secretly wondering about that for a couple weeks, tx!
Also, that sonar looks great. |
|
|
|
|
|
Homer_simpson
|
Posted: Fri Dec 12, 2003 6:44 pm Post subject: (No subject) |
|
|
mazer yer effect is pretty creative i like it... + bits |
|
|
|
|
|
Thuged_Out_G
|
Posted: Fri Dec 12, 2003 7:38 pm Post subject: (No subject) |
|
|
thanks mazer, that was a pretty cool solution...im gonna try it on my own now |
|
|
|
|
|
Thuged_Out_G
|
Posted: Fri Dec 12, 2003 7:50 pm Post subject: (No subject) |
|
|
i have another question
i made the sonar bleep things to appear where the user clicks the mouse, and i am trying to make it so the bleeps are black when the user clicks outside the sonar....it works, but as soon as you click on the sonar area, and then outside it draws a green bleep
code: |
var angle := 0
var x, y, button : int
for i : 0 .. 255
RGB.SetColour (i, 0, (i - 150) / 150 * i / 255, 0)
end for
RGB.SetColour (255, 0, .8, 0)
RGB.SetColour (0, 0, 0, 0)
cls
View.Set ("offscreenonly")
loop
angle += 5
for decreasing c : 255 .. 170
Draw.FillArc (100, 100, 100, 100, angle + c, angle + c + 1, c)
drawfillarc (100, 100, 100, 100, angle + 255, angle + 257, 255)
end for
View.Update
delay (20)
drawfilloval (100, 100, 100, 100, 170)
Mouse.Where (x, y, button)
if button = 1 then
if x > angle and y > angle then
Draw.Oval (x, y, 5, 5, 0)
else
Draw.Oval (x, y, 5, 5, 10)
Draw.Oval (x, y, 10, 10, 10)
end if
end if
end loop
|
any suggestions? |
|
|
|
|
|
Mazer
|
Posted: Fri Dec 12, 2003 8:38 pm Post subject: (No subject) |
|
|
that's because the only part of the screen that's being drawn over is the radar part. anything that's drawn somewhere else will stay there until something else is drawn over it or the screen is cleared. try this:
code: |
var angle := 0
var x, y, button : int
for i : 0 .. 255
RGB.SetColour (i, 0, (i - 150) / 150 * i / 255, 0)
end for
RGB.SetColour (255, 0, .8, 0)
RGB.SetColour (0, 0, 0, 0)
cls
View.Set ("offscreenonly")
loop
angle += 5
for decreasing c : 255 .. 170
Draw.FillArc (100, 100, 100, 100, angle + c, angle + c + 1, c)
drawfillarc (100, 100, 100, 100, angle + 255, angle + 257, 255)
end for
Mouse.Where (x, y, button)
if button = 1 then
/*
if x > angle and y > angle then %<-- not a good idea. angle gets very large very fast... not sure what you're trying to do here anyways
Draw.Oval (x, y, 5, 5, 0)
else
Draw.Oval (x, y, 5, 5, 10)
Draw.Oval (x, y, 10, 10, 10)
end if
*/
if x >= 0 and x <= 190 and y >= 0 and y <= 190 then
Draw.Oval (x, y, 5, 5, 10)
Draw.Oval (x, y, 10, 10, 10)
end if
end if
View.Update
delay (20)
drawfillbox (0, 0, 200, 200, 170) % clear a box shaped part of the screen
%if you want, use cls to clear the whole screen (comment out the last line if you do)
end loop
|
|
|
|
|
|
|
Thuged_Out_G
|
Posted: Fri Dec 12, 2003 9:19 pm Post subject: (No subject) |
|
|
thanks mazer
i didnt really know what i was doing with the part you commented...im new to the whole graphics part of turing, and was just trying different things lol |
|
|
|
|
|
Sponsor Sponsor
|
|
|
|
|