### Author Topic: Blue stuff  (Read 633 times)

#### Marcus

• Hero Member
• Posts: 549
##### Blue stuff
« on: November 07, 2016 »
Code: [Select]
`import "Random.lib"import "Speed.lib"set window 32, 32, 700, 700, falseset redraw off' Create brush.brushImage = 1create image 1, 31, 31set image 1set color 0, 0, 0clsfor y = 0 to 30; dy# = float(y - 15) dysqr# = dy*dy for x = 0 to 30 dx# = float(x - 15) d# = sqr(dx*dx + dysqr) if d < 15.0 c = int(32.0*(1.0 - d/15.0)) set color c, c, c set pixel x, y endif nextnextset image primarycurveCount = 32curves#[curveCount][3][4]for i = 0 to curveCount - 1 curves[i][0][0] = 0.5*float(width(primary)) - 15.0 curves[i][0][1] = 0.5*float(height(primary)) - 15.0 curves[i][1][0] = RandomFloat(float(width(primary))) - 15.0 curves[i][1][1] = RandomFloat(float(height(primary))) - 15.0 curves[i][1][2] = curves[i][1][0] - 15.0 curves[i][1][3] = curves[i][1][1] - 15.0 curves[i][2][0] = RandomFloat(float(width(primary))) - 15.0 curves[i][2][1] = RandomFloat(float(height(primary))) - 15.0 curves[i][2][2] = curves[i][2][0] - 15.0 curves[i][2][3] = curves[i][2][1] - 15.0nextparticleCount = 400particles?[particleCount]for i = 0 to particleCount - 1 particles[i].c = RandomInt(curveCount) particles[i].p# = RandomFloat(1.0) particles[i].s# = 0.005 + RandomFloat(0.005)nextcurveChangeTimer = 0set color 0, 32, 64clsshouldDraw = truedo curveChangeTimer = curveChangeTimer - 1 if curveChangeTimer <= 0 curveChangeTimer = 60 for i = 0 to curveCount - 1 if RandomInt(2) = 0 curves[i][1][2] = RandomFloat(float(width(primary))) - 15.0 curves[i][1][3] = RandomFloat(float(height(primary))) - 15.0 endif if RandomInt(4) = 0 curves[i][2][2] = RandomFloat(float(width(primary))) - 15.0 curves[i][2][3] = RandomFloat(float(height(primary))) - 15.0 endif next endif for i = 0 to curveCount - 1 curves[i][1][0] = curves[i][1][0]*0.99 + curves[i][1][2]*0.01 curves[i][1][1] = curves[i][1][1]*0.99 + curves[i][1][3]*0.01 curves[i][2][0] = curves[i][2][0]*0.99 + curves[i][2][2]*0.01 curves[i][2][1] = curves[i][2][1]*0.99 + curves[i][2][3]*0.01 next if shouldDraw for i = 0 to particleCount - 1 particles[i].p# = particles[i].p# + particles[i].s# if particles[i].p# >= 1.0 particles[i].p# = particles[i].p# - 1.0 particles[i].c = RandomInt(curveCount) particles[i].s# = 0.005 + RandomFloat(0.005) endif c = particles[i].c p# = particles[i].p# b1# = (1.0 - p)*(1.0 - p) b2# = 2.0*(1.0 - p)*p b3# = p*p particles[i].x# = b1*curves[c][0][0] + b2*curves[c][1][0] + b3*curves[c][2][0] particles[i].y# = b1*curves[c][0][1] + b2*curves[c][1][1] + b3*curves[c][2][1] particles[i].i = int(255.0*(1.0 - p)) next set color 0, 32, 64, 24 cls set additive true for i = 0 to particleCount - 1 set color 64, 128, 255, particles[i].i draw image brushImage, int(particles[i].x#), int(particles[i].y#) next set additive false redraw endif shouldDraw = SPD_HoldFrameDraw(60)until keydown(27, true)`
« Last Edit: November 07, 2016 by Marcus »
.\\\opz

#### B+

• Full Member
• Posts: 215
##### Re: Blue stuff
« Reply #1 on: November 07, 2016 »
Nice effect! I've been looking for working example using alpha, thanks!

B+

#### Rick3137

• Sr. Member
• Posts: 347
• May the Force be with You
##### Re: Blue stuff
« Reply #2 on: November 07, 2016 »
Cool... That ought to be useful for something. Just not sure yet what to use it for.

#### Marcus

• Hero Member
• Posts: 549
##### Re: Blue stuff
« Reply #3 on: November 07, 2016 »
Cool... That ought to be useful for something. Just not sure yet what to use it for.

.\\\opz