Fireworks
A simple demo.
////////////////////////////////////////////////////////////// BEGIN object DEMOFIREWORKS ////////////////////////////////////////////////////////////// OBJECT Parent = APPLET OBJECT Scripta = @ DEMO_fireworks ATOM FSRenderer = ZOOMX2 END ////////////////////////////////////////////////////////////// BEGIN global CONST ////////////////////////////////////////////////////////////// INTEGERS particle_class = -3, 2, -1, 3, 4, -5, -3, -5 = 4, 3, 5, 2, 2, 6, -3, 4, -2 = 6, -3, 5, -3, -2 END ////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////// branch init ////////////////////////////////////////////////////////////// @.init() IFX $.Fx = factoryFX('FX_DEMOFIREWORKS') IANIMATION $.Ani = newAnimation() INTEGER points = 72 INTEGER p = 0 Ani . reset(points, { 'FLOAT' }, { 'x' }) while p <= points Ani . addFloat(p, 1, cos rad (p * 10)) p += 1 endwhile IANIMATOR $ . AnimXx = Fx.animator( 'axisXx' ) IANIMATOR $ . AnimXy = Fx.animator( 'axisXy' ) IANIMATOR $ . AnimYx = Fx.animator( 'axisYx' ) IANIMATOR $ . AnimYy = Fx.animator( 'axisYy' ) INSTANCES anims = INSTANCES { AnimXx AnimXy AnimYx AnimYy } anims . setAni( Ani, 1 ) anims . setLoop( 'wrap' ) AnimXx . setLimits(0, 35) AnimXy . setLimits(9, 35 + 9) AnimYx . setLimits(9, 35 + 9) AnimYy . setLimits(18, 35 + 18) anims . set(0) anims . setSpeed(5) points = 64 INTEGER pshf = 2 FLOATS xp INTEGERS off INTEGERS shf = repeat(pshf, points * 4) p = 0 FLOAT ang = 0.0 FLOAT angstep = 360.0 / points while (p += 1) <= points FLOAT x = cos rad ang FLOAT y = sin rad ang ang += angstep x *= 100 y *= 80 xp = xp append x append y INTEGER o = shl(p - 1, pshf) off = off append o append o append o append o endwhile Fx . setSources(points, xp, shf, off) end /////////////////////////////////////////////////////////////////////////////// branch update ////////////////////////////////////////////////////////////// FLOAT xc = Cursor|x FLOAT yc = Cursor|y xc -= 160.0 yc -= 120.0 xc /= 160.0 yc /= 120.0 xc *= 30.0 yc *= 30.0 Fx . setFloat('xGrav', xc) Fx . setFloat('yGrav', yc) end /////////////////////////////////////////////////////////////////////////////// branch render ////////////////////////////////////////////////////////////// rendParticleSelect(10, particle_class) rendClear ( rendColor(32, 32, 48, 255)) Fx . render(320, 240, frameTime()) end
