SHARE
TWEET

Untitled

Wav May 25th, 2020 (edited) 815 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. sin=math.sin
  2. cos=math.cos
  3. exp=math.exp
  4. pow=math.pow
  5. random=math.random
  6. sqrt=math.sqrt
  7. atan2=math.atan2
  8.  
  9. function drawCircle(id,arg)
  10.         local point1,point2,particle=arg[1],arg[2],arg[3]
  11.         r=sqrt(pow((point1.x-point2.x),2)+pow((point1.y-point2.y),2))
  12.         res=1-r*pow(10,-2)
  13.         if(res<0.1)then res =0.04 end
  14.         for i=0,2*math.pi,res do
  15.                 tfm.exec.displayParticle(particle,point1.x+r*cos(i),point1.y+r*sin(i),random(-1,1),random(-1,1),0,0)
  16.         end
  17. end
  18.  
  19. function drawButterfly(id,arg)
  20.         local x,y,particles=arg[1],arg[2],arg[3]
  21.         for t=0,10,0.09 do
  22.                 velocityEffect(x,y,x+(sin(t)*(exp(cos(t))-2*cos(4*t)-5*pow(sin(t/12),5))*-15),y+(cos(t)*(exp(cos(t))-2*cos(4*t)-5*pow(sin(t/12),5))*-15),particles)
  23.         end
  24. end
  25.  
  26. function drawParam1(id,arg)
  27.         local x,y,a,b,c,d,particles=arg[1],arg[2],arg[3],arg[4],arg[5],arg[6],arg[7]
  28.         local j,k=3,3
  29.         for t=0,10,0.1 do
  30.                 velocityEffect(x,y,x+(cos(a*t)-pow(cos(b*t),j))*20,y+(sin(c*t)-pow(sin(d*t),k))*20,particles)
  31.         end
  32. end
  33.  
  34. function drawParam2(id,arg)
  35.         local x,y,k,a,m,particles=arg[1],arg[2],arg[3],arg[4],arg[5],arg[6]
  36.         local b=a/k
  37.         for t=0,30,0.5 do
  38.                 velocityEffect(x,y,x+((a-b)*cos(t)+b*cos(t*((a/b)-1)))*m,y+((a-b)*sin(t)-b*sin(t*((a/b)-1)))*m,particles)
  39.         end
  40. end
  41.  
  42. function drawLines(id,arg)
  43.         local x,y=arg[1],arg[2]
  44.         local particles={13,11,9,2,1}
  45.         for t=-50,50,3 do
  46.                 tfm.exec.displayParticle(table.random(particles),x+t,y+t-30,random(-1,1),random(-1,1),0,0)
  47.                 tfm.exec.displayParticle(table.random(particles),x+t,y-t+30,random(-1,1),random(-1,1),0,0)
  48.                 tfm.exec.displayParticle(table.random(particles),x+t,y-t-30,random(-1,1),random(-1,1),0,0)
  49.                 tfm.exec.displayParticle(table.random(particles),x+t,y+t+30,random(-1,1),random(-1,1),0,0)
  50.         end
  51. end
  52.  
  53. function drawCircleVelocity(id,arg)
  54.         local x,y,particles=arg[1],arg[2],{13,11,9,2,1}
  55.         for i=0,360,20 do
  56.                 tfm.exec.displayParticle(table.random(particles),x,y,cos(math.pi*i/180)*-2,-sin(math.pi*i/180)*-2,0,0)
  57.         end
  58.         x,y=x+random(-40,40),y+random(-40,40)
  59.         for i=0,360,20 do
  60.                 tfm.exec.displayParticle(table.random(particles),x,y,cos(math.pi*i/180)*-3,-sin(math.pi*i/180)*-3,0,0)
  61.         end
  62. end
  63.  
  64. function drawHeart(id,arg)
  65.         local x,y,particles=arg[1],arg[2],{13,11,9,2,1,30,31}
  66.         for t=-60,60,3 do
  67.                 if t<0 then
  68.                         l=-t
  69.                         x1=0.01*((-pow(l,2))+40*l+1200)*sin(math.pi*l/180)
  70.                         y1=-0.01*((-pow(l,2))+40*l+1200)*cos(math.pi*l/180)
  71.                 else
  72.                         x1=-0.01*((-pow(t,2))+40*t+1200)*sin(math.pi*t/180)
  73.                         y1=-0.01*((-pow(t,2))+40*t+1200)*cos(math.pi*t/180)
  74.                 end
  75.                 tfm.exec.displayParticle(table.random(particles),x1*5+x,y1*5+y,table.random({-0.5,0.5}),table.random({-0.5,0.5}),0,0)
  76.         end
  77. end
  78.  
  79. function drawCurve(id,arg)
  80.         local x,y,particles=arg[1],arg[2],arg[3]
  81.         for j=1,random(2,3) do
  82.                 for i=0,100,2 do
  83.                         tfm.exec.displayParticle(table.random(particles),x+cos(i)*10,y-i,table.random({-0.5,0.5}),random(-1,1),0,0)
  84.                 end
  85.         end
  86. end
  87.  
  88. function drawBasic(id,arg)
  89.         tfm.exec.displayParticle(10,arg[1],arg[2],0,0,0,0)
  90.         tfm.exec.displayParticle(12,arg[1]+random(-20,20),arg[2]+random(-20,20),0,0,0,0)
  91. end
  92.  
  93. function drawCirclePlus(id,arg)
  94.         local last,particles=0,arg[3]
  95.         for j=1,random(2,3)do
  96.                 rand=random(-40,40)
  97.                 for i=1,random(2,3) do
  98.                         repeat
  99.                                 particleId=table.random(particles)
  100.                         until particleId~=last
  101.                         last=particleId
  102.                         drawCircle(id,{{x=arg[1]+rand,y=arg[2]},{x=arg[1]+rand+(i+1)*10,y=arg[2]},last})
  103.                 end
  104.                 arg[1]=arg[1]+random(-40,40)
  105.         end
  106. end
  107.  
  108. function velocityEffect(xS,yS,xE,yE,particles)
  109.         local angle = atan2(yE - yS, xE - xS)
  110.         tfm.exec.displayParticle(table.random(particles),xE,yE,cos(angle),sin(angle),0,0)
  111. end
  112.  
  113. fireworksTable={drawBasic,drawHeart,drawLines,drawParam1,drawParam1,drawParam1,drawCurve,drawCirclePlus,drawCircleVelocity,drawParam1,drawParam1,drawParam1,drawParam1,drawParam1,drawParam1}
  114. glitter={13,11,9,2,1}
  115. fireworksArgs={{0,-130},{0,-130},{0,-130},{0,-130,7,1,7,1,glitter},{0,-130,1,5,1,5,glitter},{0,-130,1,3,3,1,glitter},{0,-130,glitter},{0,-130,glitter},{0,-130},{0,-130,4,1,4,1,glitter},
  116. {0,-130,2,1,2,1,glitter},{0,-130,1,2,1,2,glitter},{0,-130,1,4,1,4,glitter},{0,-130,4,1,4,1,glitter},{0,-130,1,3,3,1,glitter}}
  117.  
  118. function fireworks(boxId,time)
  119.         for i=0,math.random(0,1) do
  120.                 local choice,args=random(1,#fireworksTable),{}
  121.                 for k,v in pairs(fireworksArgs[choice])do table.insert(args,v) end
  122.                 args[1],args[2]=tfm.get.room.objectList[boxId].x+math.random(-40*i,40*i)+fireworksArgs[choice][1],tfm.get.room.objectList[boxId].y+math.random(-40*i,-20*i)+fireworksArgs[choice][2]
  123.                 system.newTimer(fireworksTable[choice],time+400+i*200,false,args)
  124.         end
  125. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top