Advertisement
tyridge77

Untitled

Aug 24th, 2013
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 19.71 KB | None | 0 0
  1. wait(0)
  2. local GlobalSource = [==[
  3. wait()
  4. local cr,cc = coroutine.resume,coroutine.create;
  5. local sqrt,sin,acos = math.sqrt,math.sin,math.acos;
  6. local property = '';
  7. local function QuaternionFromCFrame(cf)
  8.     local mx,  my,  mz,
  9.           m00, m01, m02,
  10.           m10, m11, m12,
  11.           m20, m21, m22 = cf:components()
  12.     local trace = m00 + m11 + m22
  13.     if trace > 0 then
  14.         local s = sqrt(1 + trace)
  15.         local recip = 0.5/s
  16.         return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5
  17.     else
  18.         local i = 0
  19.         if m11 > m00 then i = 1 end
  20.         if m22 > (i == 0 and m00 or m11) then i = 2 end
  21.         if i == 0 then
  22.             local s = sqrt(m00-m11-m22+1)
  23.             local recip = 0.5/s
  24.             return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip
  25.         elseif i == 1 then
  26.             local s = sqrt(m11-m22-m00+1)
  27.             local recip = 0.5/s
  28.             return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip
  29.         elseif i == 2 then
  30.             local s = sqrt(m22-m00-m11+1)
  31.             local recip = 0.5/s
  32.             return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip
  33.         end
  34.     end
  35. end
  36.  
  37. local function QuaternionToCFrame(px, py, pz, x, y, z, w)
  38.     local xs, ys, zs = x + x, y + y, z + z
  39.     local wx, wy, wz = w*xs, w*ys, w*zs
  40.     --
  41.     local xx = x*xs
  42.     local xy = x*ys
  43.     local xz = x*zs
  44.     local yy = y*ys
  45.     local yz = y*zs
  46.     local zz = z*zs
  47.     --
  48.     return CFrame.new(px,        py,        pz,
  49.                       1-(yy+zz), xy - wz,   xz + wy,
  50.                       xy + wz,   1-(xx+zz), yz - wx,
  51.                       xz - wy,   yz + wx,   1-(xx+yy))
  52. end
  53.  
  54. local function QuaternionSlerp(a, b, t)
  55.     local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4]
  56.     local startInterp, finishInterp;
  57.     if cosTheta >= 0.0001 then
  58.         if (1 - cosTheta) > 0.0001 then
  59.             local theta = acos(cosTheta)
  60.             local invSinTheta = 1/sin(theta)
  61.             startInterp = sin((1-t)*theta)*invSinTheta
  62.             finishInterp = sin(t*theta)*invSinTheta
  63.         else
  64.             startInterp = 1-t
  65.             finishInterp = t
  66.         end
  67.     else
  68.         if (1+cosTheta) > 0.0001 then
  69.             local theta = acos(-cosTheta)
  70.             local invSinTheta = 1/sin(theta)
  71.             startInterp = sin((t-1)*theta)*invSinTheta
  72.             finishInterp = sin(t*theta)*invSinTheta
  73.         else
  74.             startInterp = t-1
  75.             finishInterp = t
  76.         end
  77.     end
  78.     return a[1]*startInterp + b[1]*finishInterp,
  79.            a[2]*startInterp + b[2]*finishInterp,
  80.            a[3]*startInterp + b[3]*finishInterp,
  81.            a[4]*startInterp + b[4]*finishInterp        
  82. end
  83.  
  84. local TweenPart = function(part, a, b, length)
  85.     local property = '';
  86.     if part:isA('Motor6D') or part:isA('Weld') then
  87.         property = 'C0';
  88.     elseif part:isA('Part') then
  89.         property = 'CFrame';
  90.     end
  91.     moving = nil
  92.     wait(0)
  93.     moving = true
  94.     local qa = {QuaternionFromCFrame(a)}
  95.     local qb = {QuaternionFromCFrame(b)}
  96.     local ax, ay, az = a.x, a.y, a.z
  97.     local bx, by, bz = b.x, b.y, b.z
  98.     --
  99.     local c = 0
  100.     local tot = 0
  101.     --
  102.     local startTime = tick()
  103.     while moving do
  104.         wait()
  105.         local t = (tick()-startTime)/length
  106.         local _t = 1-t
  107.         if t > 1 then break end
  108.         local startT = tick()
  109.         local cf = QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,
  110.                                          QuaternionSlerp(qa, qb, t))
  111.         tot = tot+(tick()-startT)
  112.         c = c + 1
  113.         part[property] = cf
  114.     end
  115. end
  116. local registered = {};
  117. local api = {
  118.     ['RegisterAnimation'] = function(Part,Playing,Animation,Loops,FrameCount)
  119.         registered[Part] = {Playing,Animation,Loops,FrameCount};
  120.         print(string.upper('Registered '..Part.Name..' To '..Animation.Name))
  121.     end,
  122.     ['PlayAnimation'] = function(Part) print("HAI")
  123.         if not Part then return end
  124.         if registered[Part] then
  125.             print('Test1')
  126.             cr(cc(function()
  127.             local tab = registered[Part];
  128.             local Playing,Animation,Loops,FrameCount =
  129.             tab[1],tab[2],tab[3],tab[4];
  130.             local count = FrameCount.Value;
  131.             Playing.Value = true;
  132.             local frame1 = Animation["Frame#1"];
  133.             print('Test2')
  134.             for i = 1, count do wait()
  135.                 local currentframe = Animation["Frame#"..i];
  136.                 local rate = currentframe['FrameSpeed'].Value;
  137.                 local origin = currentframe['Origin'].Value;
  138.                 local goal = currentframe['Goal'].Value;
  139.                 print('Test 2.25')
  140.                 Part.CFrame = origin;
  141.                 print('Test 2.5')
  142.                 TweenPart(Part,origin,goal,rate);
  143.                 print('Test 2.75')
  144.             end
  145.             if Loops.Value == true then
  146.                 _G.AnimationAPI.PlayAnimation(Part);
  147.             end
  148.             print('Test3')
  149.             Part.CFrame = frame1.Origin.Value;
  150.             Playing.Value = false;
  151.             end))
  152.         else
  153.             print('No Animation connected to: '..Part.Name..'!')
  154.         end
  155.     end
  156. }
  157. _G.AnimationAPI = api;
  158.  
  159.  
  160. ]==]
  161. local Source = [==[
  162. wait(5)
  163. repeat wait() until _G.AnimationAPI;
  164. local API = _G.AnimationAPI;
  165. local RegisterAnimation = API.RegisterAnimation;
  166. local Animation = script.Parent;
  167. local Part = Animation.Parent;
  168. local Properties = Animation:WaitForChild('Properties')
  169. local function Acquire(par,...)
  170. local args = {...};
  171. print('Fetching')
  172. local fetched = {};
  173.     for _,v in pairs(args) do
  174.         if par:FindFirstChild(v) then
  175.             fetched[#fetched+1]=par:FindFirstChild(v);
  176.         else
  177.             error('Missing object');
  178.         end
  179.     end
  180.     return unpack(fetched);
  181. end
  182. local Playing,Loops,FrameCount = Acquire(Properties,'Playing','Loops','FrameCount');
  183. RegisterAnimation(Part,Playing,Animation,Loops,FrameCount);
  184. script:Destroy();
  185. ]==]
  186. --INTERPOLATE CFRAME
  187.  
  188.  
  189.  
  190. -- By Anaminus
  191. local cr,cc = coroutine.resume,coroutine.create;
  192. local sqrt,sin,acos = math.sqrt,math.sin,math.acos;
  193. local property = '';
  194. function QuaternionFromCFrame(cf)
  195.     local mx,  my,  mz,
  196.           m00, m01, m02,
  197.           m10, m11, m12,
  198.           m20, m21, m22 = cf:components()
  199.     local trace = m00 + m11 + m22
  200.     if trace > 0 then
  201.         local s = sqrt(1 + trace)
  202.         local recip = 0.5/s
  203.         return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5
  204.     else
  205.         local i = 0
  206.         if m11 > m00 then i = 1 end
  207.         if m22 > (i == 0 and m00 or m11) then i = 2 end
  208.         if i == 0 then
  209.             local s = sqrt(m00-m11-m22+1)
  210.             local recip = 0.5/s
  211.             return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip
  212.         elseif i == 1 then
  213.             local s = sqrt(m11-m22-m00+1)
  214.             local recip = 0.5/s
  215.             return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip
  216.         elseif i == 2 then
  217.             local s = sqrt(m22-m00-m11+1)
  218.             local recip = 0.5/s
  219.             return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip
  220.         end
  221.     end
  222. end
  223.  
  224. function QuaternionToCFrame(px, py, pz, x, y, z, w)
  225.     local xs, ys, zs = x + x, y + y, z + z
  226.     local wx, wy, wz = w*xs, w*ys, w*zs
  227.     --
  228.     local xx = x*xs
  229.     local xy = x*ys
  230.     local xz = x*zs
  231.     local yy = y*ys
  232.     local yz = y*zs
  233.     local zz = z*zs
  234.     --
  235.     return CFrame.new(px,        py,        pz,
  236.                       1-(yy+zz), xy - wz,   xz + wy,
  237.                       xy + wz,   1-(xx+zz), yz - wx,
  238.                       xz - wy,   yz + wx,   1-(xx+yy))
  239. end
  240.  
  241. function QuaternionSlerp(a, b, t)
  242.     local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4]
  243.     local startInterp, finishInterp;
  244.     if cosTheta >= 0.0001 then
  245.         if (1 - cosTheta) > 0.0001 then
  246.             local theta = acos(cosTheta)
  247.             local invSinTheta = 1/sin(theta)
  248.             startInterp = sin((1-t)*theta)*invSinTheta
  249.             finishInterp = sin(t*theta)*invSinTheta
  250.         else
  251.             startInterp = 1-t
  252.             finishInterp = t
  253.         end
  254.     else
  255.         if (1+cosTheta) > 0.0001 then
  256.             local theta = acos(-cosTheta)
  257.             local invSinTheta = 1/sin(theta)
  258.             startInterp = sin((t-1)*theta)*invSinTheta
  259.             finishInterp = sin(t*theta)*invSinTheta
  260.         else
  261.             startInterp = t-1
  262.             finishInterp = t
  263.         end
  264.     end
  265.     return a[1]*startInterp + b[1]*finishInterp,
  266.            a[2]*startInterp + b[2]*finishInterp,
  267.            a[3]*startInterp + b[3]*finishInterp,
  268.            a[4]*startInterp + b[4]*finishInterp        
  269. end
  270.  
  271. function TweenPart(part, a, b, length)
  272.     moving = nil
  273.     wait(0)
  274.     moving = true
  275.     local qa = {QuaternionFromCFrame(a)}
  276.     local qb = {QuaternionFromCFrame(b)}
  277.     local ax, ay, az = a.x, a.y, a.z
  278.     local bx, by, bz = b.x, b.y, b.z
  279.     --
  280.     local c = 0
  281.     local tot = 0
  282.     --
  283.     local startTime = tick()
  284.     while moving do
  285.         wait()
  286.         local t = (tick()-startTime)/length
  287.         local _t = 1-t
  288.         if t > 1 then break end
  289.         local startT = tick()
  290.         local cf = QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,
  291.                                          QuaternionSlerp(qa, qb, t))
  292.         tot = tot+(tick()-startT)
  293.         c = c + 1
  294.         part[property] = cf
  295.     end
  296. end
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307. local new = Instance.new;
  308. if not Workspace:FindFirstChild('AnimationRegistry') then
  309.     local Global = new('Script',Workspace);
  310.     Global.Name = 'AnimationRegistry';
  311.     Global.Source = GlobalSource;
  312.     Global.Disabled = false;
  313. end
  314. local Plugin = PluginManager():CreatePlugin()
  315. local ToolBar = Plugin:CreateToolbar("Auto Tabber")
  316. local Button = ToolBar:CreateButton("Auto Tabber", "Auto Tabber", "")
  317. local CoreGui = game:GetService('CoreGui');
  318. local Active = false;
  319. local Selection = game:GetService('Selection');
  320. local function Assign()
  321.     Selected = nil;
  322.     framecount = 1;
  323.     frames = {};
  324.     framerate = .1;
  325.     Label = new('TextLabel');
  326.     Looping = true;
  327. end
  328. Assign();
  329. -- Array
  330.  
  331.  
  332.  
  333. local BoolToString = {[false] = 'false',[true] = 'true'}
  334.  
  335.  
  336. local function SelectFire()
  337. repeat wait() until Selection:Get()[1]; print't'
  338. Selecting = true
  339. while Selecting do wait(3)
  340.     print('Changed')
  341.     wait(.1)
  342.     Selected = Selection:Get()[1];
  343.     if Selected.ClassName == 'Weld' or Selected.ClassName == 'Motor6D' then
  344.         property = 'C0';
  345.     elseif Selected.ClassName == 'Part' then
  346.         property = 'CFrame';
  347.     else
  348.         Label.Text = 'NONE'; return
  349.     end
  350.     if  Selected == nil  or property == '' then Label.Text = 'NONE'; return end
  351.     print('Here')
  352.     print(Selected);
  353.     print('Here')
  354.        Label.Text = Selected:GetFullName();
  355.    
  356.        
  357.         if   partorigin then
  358.             partcf = Selected[property];
  359.             frames[framecount] = {partorigin,Selected,partcf,framerate};
  360.             wait(.1)
  361.         end
  362.     wait(.1)
  363. end
  364. end
  365.  
  366. local function CreateGui()
  367. Gui = new("ScreenGui",CoreGui)
  368. Main = new("Frame", Gui)
  369. Main.Name = "Main"
  370. Main.Position = UDim2.new(0, 0, 0, 0)
  371. Main.Size = UDim2.new(1,0, 0.30000001192093, 0)
  372. Main.BackgroundColor3 = Color3.new(0.090196080505848, 0.090196080505848, 0.094117656350136)
  373. Main.BackgroundTransparency = 0.5
  374.  
  375. Title = new("TextLabel", Main)
  376. Title.Name = "Title"
  377. Title.Size = UDim2.new(1, 0, 0.15000000596046, 0)
  378. Title.BackgroundTransparency = 1
  379. Title.Text = "Animator V1.0"
  380. Title.Font = Enum.Font.ArialBold
  381. Title.FontSize = Enum.FontSize.Size36
  382. Title.TextColor3 = Color3.new(0.7294117808342, 0, 0.011764707043767)
  383. Title.TextStrokeColor3 = Color3.new(1, 1, 1)
  384.  
  385.  
  386. LoopsFrame = new("Frame", Main)
  387. LoopsFrame.Name = "LoopsFrame"
  388. LoopsFrame.Visible = false;
  389. LoopsFrame.Position = UDim2.new(0.30000001192093, 0, 0.40000000596046, 0)
  390. LoopsFrame.Size = UDim2.new(0.20000000298023, 0, 0.30000001192093, 0)
  391. LoopsFrame.Style = Enum.FrameStyle.RobloxRound
  392.  
  393. Loops = new("TextLabel", LoopsFrame)
  394. Loops.Name = "Loops"
  395. Loops.Size = UDim2.new(1, 0, 0.40000000596046, 0)
  396. Loops.BackgroundColor3 = Color3.new(1, 1, 1)
  397. Loops.BackgroundTransparency = 0.80000001192093
  398. Loops.Text = "Loops"
  399. Loops.FontSize = Enum.FontSize.Size12
  400. Loops.TextWrapped = true
  401. Loops.TextColor3 = Color3.new(1, 1, 1)
  402.  
  403. LoopsTitle = new("TextButton", LoopsFrame)
  404. LoopsTitle.Name = "LoopsTitle"
  405. LoopsTitle.Position = UDim2.new(0, 0, 0.40000000596046, 0)
  406. LoopsTitle.Size = UDim2.new(1, 0, 0.60000002384186, 0)
  407. LoopsTitle.BackgroundColor3 = Color3.new(0.97254908084869, 0.97254908084869, 0.97254908084869)
  408. LoopsTitle.BackgroundTransparency = 0.80000001192093
  409. LoopsTitle.Text = "true"
  410. LoopsTitle.FontSize = Enum.FontSize.Size14
  411. LoopsTitle.TextWrapped = true
  412. LoopsTitle.TextColor3 = Color3.new(1, 1, 1)
  413.  
  414.  
  415.  
  416.  
  417. Current = new("Frame", Main)
  418. Current.Name = "Current"
  419. Current.Visible = false;
  420. Current.Position = UDim2.new(0.050000000745058, 0, 0.40000000596046, 0)
  421. Current.Size = UDim2.new(0.2, 0, 0.40000000596046, 0)
  422. Current.Style = Enum.FrameStyle.RobloxRound
  423.  
  424. Label = new("TextLabel", Current)
  425. Label.Name = "Label"
  426. Label.Position = UDim2.new(0, 0, 0.40000000596046, 0)
  427. Label.Size = UDim2.new(1, 0, 0.60000002384186, 0)
  428. Label.BackgroundColor3 = Color3.new(1, 1, 1)
  429. Label.BackgroundTransparency = 0.80000001192093
  430. Label.Text = "NONE"
  431. Label.FontSize = Enum.FontSize.Size14
  432. Label.TextWrapped = true
  433. Label.TextColor3 = Color3.new(1, 1, 1)
  434.  
  435. CurrentTitle = new("TextLabel", Current)
  436. CurrentTitle.Name = "Title"
  437. CurrentTitle.Size = UDim2.new(1, 0, 0.30000001192093, 0)
  438. CurrentTitle.BackgroundTransparency = 1
  439. CurrentTitle.Text = "Currently Animating:"
  440. CurrentTitle.FontSize = Enum.FontSize.Size14
  441. CurrentTitle.TextWrapped = true
  442. CurrentTitle.TextColor3 = Color3.new(1, 1, 1)
  443.  
  444. TransitionTime = new("Frame", Main)
  445. TransitionTime.Visible = false;
  446. TransitionTime.Name = "TransitionTime"
  447. TransitionTime.Position = UDim2.new(0.60000002384186, 0, 0.20000000298023, 0)
  448. TransitionTime.Size = UDim2.new(0.2, 0, 0.30000001192093, 0)
  449. TransitionTime.Style = Enum.FrameStyle.RobloxRound
  450.  
  451.  
  452. TransitionTimeLabel = new("TextBox", TransitionTime)
  453. TransitionTimeLabel.Name = "Label"
  454. TransitionTimeLabel.Position = UDim2.new(0, 0, 0.40000000596046, 0)
  455. TransitionTimeLabel.Size = UDim2.new(1, 0, 0.60000002384186, 0)
  456. TransitionTimeLabel.BackgroundColor3 = Color3.new(1, 1, 1)
  457. TransitionTimeLabel.BackgroundTransparency = 0.80000001192093
  458. TransitionTimeLabel.Text = "0.1"
  459. TransitionTimeLabel.FontSize = Enum.FontSize.Size14
  460. TransitionTimeLabel.TextWrapped = true
  461. TransitionTimeLabel.TextColor3 = Color3.new(1, 1, 1)
  462.  
  463.  
  464. TransitionTimeTitle = new("TextLabel", TransitionTime)
  465. TransitionTimeTitle.Name = "Title"
  466. TransitionTimeTitle.Position = UDim2.new(0, 0, 0, 0)
  467. TransitionTimeTitle.Size = UDim2.new(1, 0, 0.400000006, 0)
  468. TransitionTimeTitle.BackgroundColor3 = Color3.new(1, 1, 1)
  469. TransitionTimeTitle.BackgroundTransparency = 0.80000001192093
  470. TransitionTimeTitle.Text = "Transition Time"
  471. TransitionTimeTitle.FontSize = Enum.FontSize.Size12
  472. TransitionTimeTitle.TextWrapped = true
  473. TransitionTimeTitle.TextColor3 = Color3.new(1, 1, 1)
  474.  
  475.  
  476. Origin = new("Frame", Main)
  477. Origin.Visible = false;
  478. Origin.Name = "Origin"
  479. Origin.Position = UDim2.new(0.60000002384186, 0, 0.60000002384186, 0)
  480. Origin.Size = UDim2.new(0.2, 0, 0.30000001192093, 0)
  481. Origin.Style = Enum.FrameStyle.RobloxRound
  482.  
  483. OriginTitle = new("TextLabel", Origin)
  484. OriginTitle.Name = "Title"
  485. OriginTitle.Size = UDim2.new(1, 0, 0.30000001192093, 0)
  486. OriginTitle.BackgroundTransparency = 1
  487. OriginTitle.Text = "Set As Origin"
  488. OriginTitle.FontSize = Enum.FontSize.Size12
  489. OriginTitle.TextWrapped = true
  490. OriginTitle.TextColor3 = Color3.new(1, 1, 1)
  491.  
  492. OriginSet = new("TextButton", Origin)
  493. OriginSet.Name = "Set"
  494. OriginSet.Position = UDim2.new(0, 0, 0.40000000596046, 0)
  495. OriginSet.Size = UDim2.new(1, 0, 0.60000002384186, 0)
  496. OriginSet.BackgroundColor3 = Color3.new(0.97254908084869, 0.97254908084869, 0.97254908084869)
  497. OriginSet.BackgroundTransparency = 0.80000001192093
  498. OriginSet.Text = "Set"
  499. OriginSet.FontSize = Enum.FontSize.Size14
  500. OriginSet.TextWrapped = true
  501. OriginSet.TextColor3 = Color3.new(1, 1, 1)
  502. OriginSet.Active = false
  503.  
  504.  
  505. NextFrame = new("TextButton", Main)
  506. NextFrame.Name = "NextFrame"
  507. NextFrame.Position = UDim2.new(0, 0, 0.89999997615814, 0)
  508. NextFrame.Size = UDim2.new(0.30000001192093, 0, 0.10000000149012, 0)
  509. NextFrame.Text = "Next Frame"
  510. NextFrame.Visible = false;
  511. NextFrame.Font = Enum.Font.ArialBold
  512. NextFrame.FontSize = Enum.FontSize.Size18
  513. NextFrame.TextColor3 = Color3.new(1, 0.33333334326744, 0)
  514. NextFrame.Style = Enum.ButtonStyle.RobloxButton
  515.  
  516. Preview = new("TextButton", Main)
  517. Preview.Name = "Preview"
  518. Preview.Position = UDim2.new(0.33000001311302, 0, 0.89999997615814, 0)
  519. Preview.Size = UDim2.new(0.25, 0, 0.10000000149012, 0)
  520. Preview.Text = "Preview"
  521. Preview.Visible = false;
  522. Preview.Font = Enum.Font.ArialBold
  523. Preview.FontSize = Enum.FontSize.Size18
  524. Preview.TextColor3 = Color3.new(1, 0.33333334326744, 0)
  525. Preview.Style = Enum.ButtonStyle.RobloxButton
  526.  
  527. Done = new("TextButton", Main)
  528. Done.Name = "Done"
  529. Done.Position = UDim2.new(0.60000002384186, 0, 0.89999997615814, 0)
  530. Done.Size = UDim2.new(0.30000001192093, 0, 0.10000000149012, 0)
  531. Done.Text = "DONE!"
  532. Done.Visible = false;
  533. Done.Font = Enum.Font.ArialBold
  534. Done.FontSize = Enum.FontSize.Size14
  535. Done.TextColor3 = Color3.new(0.098039224743843, 1, 0)
  536. Done.Style = Enum.ButtonStyle.RobloxButton
  537.  
  538. local DoneClick = Done.MouseButton1Click:connect(function()
  539.     if not Selected then return end
  540.     local sel = Selected;
  541.     local Animation = new('Backpack',sel);
  542.     Animation.Name = sel.Name..' Animation';
  543.     local Properties = new('Configuration',Animation);
  544.        Properties.Name = 'Properties';
  545.            local Loop = new('BoolValue',Properties);
  546.        local Playing = new('BoolValue',Properties);
  547.        local count = new('IntValue',Properties)
  548.        count.Name = 'FrameCount';
  549.        count.Value = framecount;
  550.        Loop.Name = 'Loops';
  551.        Playing.Name = 'Playing';
  552.        Loop.Value = Looping;
  553.        local ReadMe = new('Script',Animation);
  554.        ReadMe.Name = 'README';
  555.        ReadMe.Source = [==[
  556.         Derp = [=[
  557.         To play the animation,
  558.         You need to type ,
  559.         _G.AnimationAPI.PlayAnimation(Part);
  560.         So for instance if the animated part was named Left Arm, and placed in the Workspace,
  561.         and had a backpack called Left Arm Animation, a backpack similar to the one you're in now,
  562.         You'd type _G.AnimationAPI.PlayAnimation(Workspace['Left Arm']);
  563.         ]=]
  564.        ]==];
  565.        local AnimPlay = new('Script',Animation);
  566.        AnimPlay.Name = 'AnimationPlay';
  567.        AnimPlay.Source = Source;
  568.     for i = 1, framecount do wait()
  569.        local currentframe = frames[i];
  570.        local origin,part,cf,rate = currentframe[1],currentframe[2],currentframe[3],currentframe[4];
  571.        local newframe = new('Backpack',Animation);
  572.        newframe.Name = 'Frame#'..i;
  573.            local originval,cfval,rateval = new('CFrameValue'),new('CFrameValue'),new('NumberValue');
  574.        originval.Parent,cfval.Parent,rateval.Parent = newframe,newframe,newframe;
  575.        originval.Name = 'Origin';
  576.        cfval.Name = 'Goal';
  577.            rateval.Name = 'FrameSpeed'
  578.            originval.Value = origin;
  579.        cfval.Value = cf;
  580.        rateval.Value = rate;
  581.     end
  582. end)
  583. local PreviewClick = Preview.MouseButton1Click:connect(function()
  584.     if property == ''  or previewing then return end
  585.     previewing = true;
  586.     for i = 1, framecount do wait()
  587.         if frames[framecount] then
  588.         local currentframe = frames[i];
  589.         local origin,part,cf,rate = currentframe[1],currentframe[2],currentframe[3],currentframe[4];
  590.         print(origin.p,part,cf.p,rate);
  591.         part.Transparency = 1;
  592.         local clone = part:Clone();
  593.         clone.Parent = Workspace;
  594.         clone.Transparency = .7;
  595.         clone[property] = origin;
  596.         clone.Anchored = true;
  597.         TweenPart(clone,clone[property],cf,rate)
  598.         part.Transparency = 0;
  599.         clone:Destroy();
  600.         end
  601.     end
  602.     previewing = nil;
  603. end)
  604. local NextFrameClick = NextFrame.MouseButton1Click:connect(function()
  605.     if not Selected then return end
  606.     framecount = framecount + 1;
  607.     partorigin = Selected[property];
  608.  
  609. end)
  610. local OriginCreate = OriginSet.MouseButton1Click:connect(function()
  611.     if not Selected  then print('Not Selected') return end
  612.     if framecount >1 then
  613.         OriginSet.Text = 'FrameCount>1!'
  614.         wait(3)
  615.         OriginSet.Text = 'Set';
  616.     else
  617.     print('Setting origin');
  618.         partorigin = Selected[property];
  619.     end
  620. end)
  621. local LoopsClick = LoopsTitle.MouseButton1Click:connect(function()
  622.     Looping = not Looping;
  623.     LoopsTitle.Text = BoolToString[Looping];
  624. end)
  625. Selecting = true;
  626.  
  627. local function ExitSetup()
  628.     Current.Visible = true;
  629.     LoopsFrame.Visible = true;
  630.     TransitionTime.Visible = true;
  631.     Origin.Visible = true;
  632.     Done.Visible = true;
  633.     NextFrame.Visible = true;
  634.     Preview.Visible = true;
  635. end
  636. ExitSetup();
  637. TransitionTimeLabel.Changed:connect(function()
  638.     framerate = tonumber(TransitionTimeLabel.Text);
  639. end)
  640. SelectFire();
  641. end
  642. local function Show() print('Showing');
  643.    Active = not Active;
  644.    if Active == true then
  645.      if SelectionChanged then SelectionChanged:disconnect() end CreateGui();
  646.    else
  647.       if Gui then
  648.       Processes = {};
  649.       Selecting = nil;
  650.       FrameCount = 1;
  651.       Assign();
  652.       Gui:Destroy()
  653.     SelectionChanging = nil; end
  654.    end
  655. end
  656. Button.Click:connect(Show);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement