
-----------------------------------
Homer_simpson
Tue Mar 09, 2010 8:26 pm

Some visual effect
-----------------------------------
I got tired of studying econ

function lunch (x, y : real) : real
    result 400 * sind (x / (sin (y) * 10)) + (sin (3 * y + 1) * 1800 * sind (x / 5 + 80))
    %result (x / 10) ** 3
end lunch


View.Set ("offscreenonly")
var delta := 1
var min_x, min_y, max_x, max_y, y, ax, ay, px, py, ox, oy, dy, dx : real
var ft := true



min_x := -2000
min_y := -5000
max_x := 1000
max_y := 5000

dx := 20
dy := 20

ox := (-min_x) * (maxx / (max_x - min_x))
oy := (-min_y) * (maxy / (max_y - min_y))
var x := min_x



procedure graphfunction (aj : function func (x, y : real) : real, f : real, c : int)
    var slope : real
    x := min_x - 400
    ft := true
    var counter : int := 0
    loop
        counter := counter + 1
        x += delta
        y := aj (x, f)
        exit when x >= max_x + 400


        ax := ((x * ((maxx / (max_x - min_x)))) + (ox))
        ay := (y * (maxy / (max_y - min_y))) + (oy) %round (max_y * (maxy / (max_y - min_y)))
        if not ft then
            drawline (round (ax), round (ay), round (px), round (py), c)
            if ((counter * delta) mod 10) = 0 then
                drawline (round (ax), round (ay), round (ax + (- (py - ay) * (1500 / delta))), round (ay + ((px - ax) * (1500 / delta))), c)
                drawline (round (ax), round (ay), round (ax + ((py - ay) * (1500 / delta))), round (ay + (- (px - ax) * (1500 / delta))), 155 - c)
            end if
        else
            ft := false
        end if
        px := ax
        py := ay

    end loop
end graphfunction







color (white)
colorback (black)
cls
var xi : real := ox
var yi : real := oy
var r : real := 1
loop
    r += .01
    graphfunction (lunch, r, round ((r * 10) mod 155))
    View.Update
    cls
end loop



-----------------------------------
andrew.
Tue Mar 09, 2010 10:24 pm

RE:Some visual effect
-----------------------------------
That's pretty cool, I wish I could make it my screen saver. But doesn't this fall under the "omfg sooo trippy cool flashes!" category?

-----------------------------------
copthesaint
Tue Mar 09, 2010 11:25 pm

Re: Some visual effect
-----------------------------------

That's pretty cool, I wish I could make it my screen saver. But doesn't this fall under the "omfg sooo trippy cool flashes!" category?


I would Say so, I looked this effect and it was an eye sore after 30 seconds

-----------------------------------
Zren
Wed Mar 10, 2010 12:48 am

RE:Some visual effect
-----------------------------------
I had to add a delay and view.update after every line to figure out how it worked. And I love the effect when it goes crazy (crazy sine wave). Cool idea.

-----------------------------------
DemonWasp
Wed Mar 10, 2010 12:52 am

RE:Some visual effect
-----------------------------------
@cop: I disagree. I watched it for well over 2 minutes and I'm considering forwarding this (link) to my programmer friends.

-----------------------------------
Turing_Gamer
Wed Mar 10, 2010 8:26 am

RE:Some visual effect
-----------------------------------
Very nice, but isn't making Turing files a screen saver burn the monitor or something?

-----------------------------------
imjdubz2
Wed Mar 10, 2010 11:18 am

RE:Some visual effect
-----------------------------------
i get frame rate probs, i think its the program.
other than that the programs prettttttyyyyy

-----------------------------------
Homer_simpson
Wed Mar 10, 2010 11:44 am

Re: Some visual effect
-----------------------------------
@andrew and @copthesaint : Ouch.. :P 

maybe it would've been less hated if i called it Catacaustics effect(it isn't) or something fancy like that. i just figured if it entertained me for a bit it may entertain someone else as well, didn't mean to anger anyone..
on a different note you can try different mathematical functions for different effects eg.

function lunch (x, y : real) : real
    %result 400 * sind (x / (sin (y) * 10)) + (sin (4 * y + 1) * 1800 * sind (x / 5 + 80))
    result (x / (10 / y)) ** 2
    /*if x = 0 then
        result 1000000
    else
        result y * 50000 / (x )
    end if*/
end lunch


View.Set ("offscreenonly")
var delta := 1
var min_x, min_y, max_x, max_y, y, ax, ay, px, py, ox, oy, dy, dx : real
var ft := true



min_x := -1000
min_y := -5000
max_x := 1000
max_y := 10000

dx := 20
dy := 20

ox := (-min_x) * (maxx / (max_x - min_x))
oy := (-min_y) * (maxy / (max_y - min_y))
var x := min_x



procedure graphfunction (aj : function func (x, y : real) : real, f : real, c : int)
    var slope : real
    x := min_x - 400
    ft := true
    var counter : int := 0
    loop
        counter := counter + 1
        x += delta
        y := aj (x, f)
        exit when x >= max_x + 400


        ax := ((x * ((maxx / (max_x - min_x)))) + (ox))
        ay := (y * (maxy / (max_y - min_y))) + (oy) %round (max_y * (maxy / (max_y - min_y)))
        if not ft then
            drawline (round (ax), round (ay), round (px), round (py), c)
            if ((counter * delta) mod 10) = 0 then
                drawline (round (ax), round (ay), round (ax + (- (py - ay) * (1500 / delta))), round (ay + ((px - ax) * (1500 / delta))), c)
                drawline (round (ax), round (ay), round (ax + ((py - ay) * (1500 / delta))), round (ay + (- (px - ax) * (1500 / delta))), 155 - c)
            end if
        else
            ft := false
        end if
        px := ax
        py := ay

    end loop
end graphfunction







color (white)
colorback (black)
cls
var xi : real := ox
var yi : real := oy
var r : real := 1
loop
    r += .01
    graphfunction (lunch, r, round ((r * 10) mod 155))
    View.Update
    delay (10)
    cls
end loop


@turing gamer: I highly doubt it..

-----------------------------------
Turing_Gamer
Wed Mar 10, 2010 12:05 pm

RE:Some visual effect
-----------------------------------
I dunno, it was some other section of the forum where it said that.

-----------------------------------
DemonWasp
Wed Mar 10, 2010 3:15 pm

RE:Some visual effect
-----------------------------------
No. The original reason for screensavers is because of an effect called "burn-in" that occurs in CRT monitors, which were used almost exclusively until about 10 years ago. The problem is that if the CRT displays the same image for too long, the phosphors in the screen are actually permanently changed, leaving a "ghost" of that image. Because people have a bad habit of walking away from their computers without turning off the screens, the screensaver is designed to automatically start after a few minutes of inactivity.

The screensaver works by making the screen display a constantly-changing set of images, preventing any particular image from burning into the screen.

Although some modern screen types still suffer from burn-in (notably not LCDs), screensavers are largely aesthetic now.

A Turing "screensaver", if properly constructed so that the whole image changes, shouldn't damage your screen. If, however, only part of the image changes while other parts do not (for example, if the window area changes but the title bar at the top does not, then the title bar could burn in.

-----------------------------------
rdrake
Wed Mar 10, 2010 3:57 pm

Re: RE:Some visual effect
-----------------------------------
No. The original reason for screensavers is because of an effect called "burn-in" that occurs in CRT monitors, which were used almost exclusively until about 10 years ago. The problem is that if the CRT displays the same image for too long, the phosphors in the screen are actually permanently changed, leaving a "ghost" of that image. Because people have a bad habit of walking away from their computers without turning off the screens, the screensaver is designed to automatically start after a few minutes of inactivity.

The screensaver works by making the screen display a constantly-changing set of images, preventing any particular image from burning into the screen.

Although some modern screen types still suffer from burn-in (notably not LCDs), screensavers are largely aesthetic now.

A Turing "screensaver", if properly constructed so that the whole image changes, shouldn't damage your screen. If, however, only part of the image changes while other parts do not (for example, if the window area changes but the title bar at the top does not, then the title bar could burn in.QFT.

-----------------------------------
Homer_simpson
Wed Mar 10, 2010 4:51 pm

Re: Some visual effect
-----------------------------------
here's a coupla functions to try:
result ((x / (10 / (1 * sin (12 * y)))) ** 3) * sin (5 * y)
result ((x / (20 / (10 * sin (6 * y)))) ** 2) * sin (5 * y)
result 1100* sin (x/100)*sin(20*y)
result 500 * sin (x / 100) + 1000 * sin ((x + (800 * y)) / 120)

-----------------------------------
chrisbrown
Wed Mar 10, 2010 5:24 pm

RE:Some visual effect
-----------------------------------
You could add each function to an array of functions, and cycle through each after some number of iterations.

-----------------------------------
andrew.
Wed Mar 10, 2010 5:42 pm

Re: Some visual effect
-----------------------------------
@andrew and @copthesaint : Ouch.. :P Oh, I didn't mean it like that. I thought it was great, and I watched it for a while, but I just thought it would categorize under that.

-----------------------------------
copthesaint
Wed Mar 10, 2010 7:33 pm

RE:Some visual effect
-----------------------------------
Hmm, There should be a section for turing fractile images or other anmated images, I never said it wasnt cool, but It still hurt my eyes :p

-----------------------------------
Turing_Gamer
Thu Mar 11, 2010 8:28 am

RE:Some visual effect
-----------------------------------
Alright thanks for clarification.
@ homer.simpson: I still think your program was great!

-----------------------------------
Homer_simpson
Thu Mar 11, 2010 11:09 am

Re: Some visual effect
-----------------------------------
hehe ok thx guys =)
