Author Topic: Yet another play with alpha curves (With a tip :D)  (Read 4368 times)

0 Members and 2 Guests are viewing this topic.

Offline Hezad

  • Sponsor
  • Pentium
  • *******
  • Posts: 613
  • Karma: 44
  • I believe .. in Patrick.
    • View Profile
    • Hezad.com Web hosting
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 :
Code: [Select]
#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)

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17427
  • Karma: 499
  • evil/good
    • View Profile
    • My Homepage
Re: Yet another play with alpha curves (With a tip :D)
« Reply #1 on: November 09, 2008 »
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:

Offline Hezad

  • Sponsor
  • Pentium
  • *******
  • Posts: 613
  • Karma: 44
  • I believe .. in Patrick.
    • View Profile
    • Hezad.com Web hosting
Re: Yet another play with alpha curves (With a tip :D)
« Reply #2 on: November 09, 2008 »
thanks  :cheers:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: Yet another play with alpha curves (With a tip :D)
« Reply #3 on: November 10, 2008 »
Nice effect. Runs smooth here!
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Yet another play with alpha curves (With a tip :D)
« Reply #4 on: November 11, 2008 »
Well smart Hezad :)
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline DrewPee

  • I Toast Therefore I am
  • Pentium
  • *****
  • Posts: 563
  • Karma: 25
  • Eat Cheese - It's good for you!
    • View Profile
    • Retro Computer Museum
Re: Yet another play with alpha curves (With a tip :D)
« Reply #5 on: November 11, 2008 »
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

Offline Hezad

  • Sponsor
  • Pentium
  • *******
  • Posts: 613
  • Karma: 44
  • I believe .. in Patrick.
    • View Profile
    • Hezad.com Web hosting
Re: Yet another play with alpha curves (With a tip :D)
« Reply #6 on: November 11, 2008 »
thanks mates :D 'glad you like it  :cheers: