• Welcome to Dark Bit Factory & Gravity.
 

Yet another play with alpha curves (With a tip :D)

Started by Hezad, November 09, 2008

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Hezad

Heya :D Once again, I played with curves and alpha values, and I got something which looks pretty nice. It's totally unoptimized, it's more a proof of concept than a project or anything else.

How it works ?
- Calculate the Coordinates of the next point (I used parametric equations of Quartics I guess, but surely of higher degree too). If you loop through a variable to calculate those coords (like with angles : from 0 to 2*pi), don't hesitate to use a really small step (I used a 0.005 step), it'll ask more CPU time, but the result will be more easily controllable.

- To render, I used a superposition of 3 shapes (I used circles) with decreasing radius and increasing alpha. Both first circles are filled, the last one is not. Play also with the color ! (you can use your counter variable to slightly move a component of your colors.

- If you want movement, use another counter variable which'll be increased slowly and added in some of the equations members (eg : Cos(Angle+NewCounterVariable) )

Play with those tthree steps, and you'll have a nice transparent/neon colors on your moving shapes :)

If anyone is interested with this method, I'd be really glad to see some creations in this post !


Attached : Screenshot, Rar(SRC+BIN)

Source :
#include "fbgfx.bi"

Screenres 640,480,32,2,fb.GFX_ALPHA_PRIMITIVES

dim as single x,y
dim as integer col,gridX,gridY

dim as single alphat,tglob,oldtglob,oldoldtglob

WindowTitle "Curves"

color ,rgb(25,25,25)

Do : screenlock : cls

    For t as single = 0 to 2*3.1415926535 step .005
       
        '' forme 1
        x = cos(t+tglob*.2)*cos(t+tglob)*cos(t+tglob*2)
        y = sin(t+tglob*.7)*sin(t)*sin(t)
       
        x *= 100
        y *= 100
       
        Circle(200+x,140+y),7,rgba(t*25,250,230,alphaT/8),,,,f
        Circle(200+x,140+y),6,rgba(225,225,225,alphaT/4),,,,f
        Circle(200+x,140+y),5,rgba(t*20,250,150,alphaT/2)
       
       
        '' forme 2
        x = cos(tglob)*cos(t+tglob)*cos(t+tglob)
        y = sin(t+tglob)*sin(tglob)*sin(t)
       
        x *= 100
        y *= 100
       
        Circle(440+x,140+y),7,rgba(t*25,250,230,alphaT/8),,,,f
        Circle(440+x,140+y),6,rgba(225,225,225,alphaT/4),,,,f
        Circle(440+x,140+y),5,rgba(t*20,250,150,alphaT/2)
       
        '' forme 3
       
        x = cos(tglob)*.5+cos(t*.1+tglob*.1)/cos((tglob + t)*2)
        y = sin(t+tglob)*sin(t)*sin(t*.5)*cos(tglob)
       
        x *= 100
        y *= 100
       
        Circle(320+x,340+y),7,rgba(t*25,250,230,alphaT/8),,,,f
        Circle(320+x,340+y),6,rgba(225,225,225,alphaT/4),,,,f
        Circle(320+x,340+y),5,rgba(t*20,250,150,alphaT/2)
       
    next
   
    alphaT = 12
   
    tglob +=.03
   
    Screenunlock : sleep 1,1
Loop until multikey(&h01)

Music + Coding :
http://Hezad.no-ip.org

Hosting / Hébergement :
www.hezad.com

Shockwave

Pretty mesmerising :)

I like the shape in the top left the best, those shapes really are quite lovely. K+ for releasing the code too. You are too kind!
Shockwave ^ Codigos
Challenge Trophies Won:

Hezad

Music + Coding :
http://Hezad.no-ip.org

Hosting / Hébergement :
www.hezad.com

benny!

[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Clyde

Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

DrewPee

Nice work! Thanks for the code too!

DrewPee
DrewPee
aka Falcon of The Lost Boyz (Amiga)
Ex-Amiga Coder and Graphic Designer
Administrator of > www.retrocomputermuseum.co.uk

Hezad

Music + Coding :
http://Hezad.no-ip.org

Hosting / Hébergement :
www.hezad.com