I Wish It Would Rain Down

When Phil Collins sang that song here , little did he know that one day there would be someone that would create a library that would help developers fulfill his wish. Well, the idea is not alone about rain, but particles. How about creating particles in CoronaSDK, there are libraries that do something like that, but as many developers want to take a test-drive, the developer of this library wanted the users to get an idea from the videos alone.

So cam along another developer that wanted to work on a library and also create it for mass consumption, i.e. the user community. So Jeff Strahan, aka jstrahan as he is known on the Corona forums, has created the 'Graffiti PS' PS standing for Particle System. I wanted to write a tutorial on this on using the system, but I feel that the code that Jeff has to demonstrate the same is much better. Have a look at the videos on this product.

There are two versions that Jeff has created, one that is the FREE version for all to test drive which is limited, not crippled in any way, and a full version that one can buy and try out a variety of effects.

The free GraffitiPS file can be gotten by tweeting details about the same, you can find that page here . I have not tried the other offering that is commercially available, but since I have worked closely on this one with Jeff, I can tell you that is is pretty optimised and works with Director, etc. So there are no new hoops to jump through.

Look at the various things that you can do with this library here . The best part is that it comes with a PDF documentation file, that explains how to use it.

I am sure that Jeff wouldn't mind me showing the main.lua used for the demonstration of the GraffitiPS

--  star Field        --
--  for use with gPS       --

display.setStatusBar( display.HiddenStatusBar )

local gPS = require( "gPS" )
local rdm = math.random

local bGroup = display.newGroup()
local mGroup = display.newGroup()
local fGroup = display.newGroup()

local bg = display.newRect(bGroup, 0,0,320,480)
local moveTxt, startStar, endStar

local txt = {"Beta","2 of","gPS","for","cSDK","©","2011"}

function moveTxt()
   for a=1, #txt do
        words = txt[a]
            local intro = { 
               imgStart = { 
                  life = 3000+(a*800), 
                  alpha = 1,
                  stroke = {}, 
                  size = {16,16},
                  scale = {7,1},
                  pos = {160, 600,0,0,0}},
               imgEnd = {
                 alpha = 0.7, 
                 scale = {0.5,0.5}, 
                 pos = {0,-340,0,0,0,move = 1, ease = easing.linear}},
               imgInfo = {group = bGroup,max = 10, text = words}}
  timer.performWithDelay(10000, startStar )
function startStar()
  for a = 1, 20 do
    local star1 = { 
        imgStart = { 
             life = rdm(200,500), alpha = 0, 
             size = {1,1}, stroke={}, 
             pos = {160,240,rdm(-20,20),rdm(-20,20)},
 imgEnd = { 
             onComplete = endStar, alpha = 0.3, 
             scale ={1,1},
             pos={0,0,0,0,move = 1, ease = easing.inExpo}},
 imgInfo = { 
            group = fGroup, max = 60}}
    if star1.imgStart.pos[3]< 0 then 
        star1.imgEnd.pos[1] = rdm(-30,-0) 
        star1.imgEnd.pos[1] = rdm(0,30) 
    if star1.imgStart.pos[4]< 0 then 
        star1.imgEnd.pos[2] = rdm(-30,-0) 
        star1.imgEnd.pos[2] = rdm(0,30) 
function endStar(params)  
  local star2 = {
                imgStart = { 
                       life = rdm(500,800), alpha = 0.3, 
                       size = {1,1}, scale={},
                       pos = {params.pos[1],params.pos[2],0,0},
  imgEnd = { 
                      onComplete = startStar, alpha = 1, scale ={1,1},
                      pos={0,0,0,0,move = 1, ease = easing.outQuad}},
  imgInfo = { group = mGroup, max = 40}}

  if params.pos[1]< 160 then 
                     star2.imgEnd.pos[1] = rdm(-400,0) 
                     star2.imgEnd.pos[1] = rdm(0,400) 
  if params.pos[2]< 240 then 
                     star2.imgEnd.pos[2] = rdm(-500,0) 
                     star2.imgEnd.pos[2] = rdm(0,500) 



It's that simple...

So tweet the message at Jeff's site and get a FREE copy of the code and try it in your projects, if you wish, for more control and stuff, you can purchase the full version.


Popular Posts