//*********************************************************************************
//                          SPARK Wrapper Graph Demo
//      Demonstrates a special kind of interpolator , called Graph interpolator 
//*********************************************************************************



backdrop on
color backdrop 0
load image "E:\Download\new spark\demos\bin\res\point.bmp",1

move camera 0,-100

system = sp create system (0,0,0,0)
group = sp add group (system,200 ,0.01 ,0,0,0)
sp set group lifetime group ,10,10
renderer = sp set quad renderer (group,1,60,60,1,1,BLEND_ADD)


// ok lets create our graph interpolator ! We will interpolate the PARAM_SCALE

graph = sp add param graph(group,PARAM_SCALE)

// now we add entries to the graph

// the XValue is the timing parameter.
// from 0.0 to 0.5 scale 1 to 1 (keep constant)
// from 0.5 to 0.6 scale 1 to 10
// from 0.6 to 0.8 scale 10 to 10 (keep constant)
// from 0.8 to 0.801 scale 10 to 2
// from 0.801 to to 1.0 scale  2 to 2 (keep constant)
 
sp add param graph entry graph , 0.0 , 1 
sp add param graph entry graph , 0.5 , 1
sp add param graph entry graph , 0.6 , 10
sp add param graph entry graph , 0.8 , 10

sp add param graph entry graph , 0.801 , 2
sp add param graph entry graph , 1.0 , 2

// we add an rgba graph too to set some cool colors

rgba = sp add rgba graph (group)
sp add rgba graph entry rgba , 0 , 0xFF0000FF
sp add rgba graph entry rgba , 0.2,0xFF0000FF

sp add rgba graph entry rgba , 0.201,0x00FF00FF
sp add rgba graph entry rgba , 0.30,0x00FF00FF

sp add rgba graph entry rgba , 0.35,0x00FFFFFF
sp add rgba graph entry rgba , 0.50,0x00FFFFFF

// from 0.6 to 1.0 we fade out our particles

sp add rgba graph entry rgba , 0.6,0xFFFF00FF
sp add rgba graph entry rgba , 1.0,0xFFFF0000

// and finally an emitter :

emitter = sp add straight emitter(group,0,1,0, 10 ,25,25,-1,sp point zone (0,0,0))


do
    
// controling the camera
rotate camera 0 ,camera angle x(0)+ mousemovey()*0.2 , camera angle y(0)+ mousemovex()*0.2 ,0
if upkey() = 1 then move camera 0,0.1
if downkey() = 1 then move camera 0,-0.1

sp update


loop









