bloxxyz
|
  |
| Joined: 15 Apr 2012 |
| Total Posts: 6995 |
|
|
| 29 Dec 2014 03:10 AM |
function ScreenSpaceToWorld(x, y, depth) local resolution = self.AbsoluteSize local aspectRatio = resolution.X / resolution.Y local hfactor = math.tan(math.rad(c.FieldOfView)/2) local wfactor = aspectRatio*hfactor local xf, yf = x/resolution.X*2 - 1, y/resolution.Y*2 - 1 local xpos = xf * -wfactor * depth local ypos = yf * hfactor * depth return Vector3.new(xpos, ypos, depth) end
function GetDepthForWidth(partWidth, visibleSize) local resolution = self.AbsoluteSize; local aspectRatio = resolution.X / resolution.Y local hfactor = math.tan(math.rad(c.FieldOfView)/2) local wfactor = aspectRatio*hfactor return (-0.5*resolution.X*partWidth/(visibleSize*wfactor)) end |
|
|
| Report Abuse |
|
Digitov
|
  |
| Joined: 26 Mar 2013 |
| Total Posts: 10867 |
|
| |
bloxxyz
|
  |
| Joined: 15 Apr 2012 |
| Total Posts: 6995 |
|
|
| 29 Dec 2014 03:13 AM |
@Digitov
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- Setup -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
self = script.Parent c = workspace.CurrentCamera rs = game:GetService("RunService") util = LoadLibrary("RbxUtility") Create = util.Create; fade = self:WaitForChild("Fade") music = self:WaitForChild("Music")
music:Stop() music:Play()
game.StarterGui:SetCoreGuiEnabled("PlayerList",false) game.StarterGui:SetCoreGuiEnabled("Health",false) game.StarterGui:SetCoreGuiEnabled("Backpack",false)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- Screen Utilities
function ScreenSpaceToWorld(x, y, depth) local resolution = self.AbsoluteSize local aspectRatio = resolution.X / resolution.Y local hfactor = math.tan(math.rad(c.FieldOfView)/2) local wfactor = aspectRatio*hfactor local xf, yf = x/resolution.X*2 - 1, y/resolution.Y*2 - 1 local xpos = xf * -wfactor * depth local ypos = yf * hfactor * depth return Vector3.new(xpos, ypos, depth) end
function GetDepthForWidth(partWidth, visibleSize) local resolution = self.AbsoluteSize; local aspectRatio = resolution.X / resolution.Y local hfactor = math.tan(math.rad(c.FieldOfView)/2) local wfactor = aspectRatio*hfactor return (-0.5*resolution.X*partWidth/(visibleSize*wfactor)) end
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- Build inferno
for i = 0,1,.1 do local p = Create'Part' { Name = "Fire"; Transparency = 1; CanCollide = false; Anchored = true; Parent = c; Create'Fire' { Size = 10; Heat = 10; } } local function update() local res = self.AbsoluteSize local x,y = (res.X*i), (res.Y*1.4) local pos = ScreenSpaceToWorld(x,y,5) p.CFrame = c.CoordinateFrame * CFrame.new(-pos); end update() rs.RenderStepped:connect(update) end
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- Build backdrop
local backdrop = Create'Part' { FormFactor = "Custom"; Anchored = true; CanCollide = false; TopSurface = "Smooth"; BottomSurface = "Smooth"; Material = "WoodPlanks"; BrickColor = BrickColor.new("Reddish brown"); Parent = c; }
function updateBackdrop() local x,y = self.AbsoluteSize.X,self.AbsoluteSize.Y local cx,cy = math.floor(x/2),math.floor(y/2) local cz = GetDepthForWidth(40,x) local ratio = y/x local pos = ScreenSpaceToWorld(cx,cy,cz) backdrop.Size = Vector3.new(40,40*ratio,0) backdrop.CFrame = c.CoordinateFrame * CFrame.new(pos) c.CameraType = "Scriptable" c.CoordinateFrame = CFrame.new(9999,9999,9999); end
updateBackdrop() rs.RenderStepped:connect(updateBackdrop)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- Initial Fade-In
for i = 0,3.5,0.033907753944397 do fade.BackgroundTransparency = i / 4 wait(0.033907753944397) end
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- Animation.
local word = "developer drama rocks"
while wait(.1) do local name = "" for char in word:gmatch(".") do if math.random()>.5 then name = name .. string.upper(char) else name = name .. string.lower(char) end end local l = Create'TextLabel' { Size = UDim2.new(); BackgroundTransparency = 1; Font = "SourceSansBold"; FontSize = "Size48"; TextColor3 = Color3.new(0,1,1); TextStrokeTransparency = 0; Position = UDim2.new(math.random(),0,-0.3,0); Text = name; Parent = self } local con = rs.RenderStepped:connect(function () local resY = self.AbsoluteSize.Y local y = l.AbsolutePosition.Y local alpha = ((resY-y)/resY) local fade= 1 - (alpha * 3) l.TextTransparency = fade l.TextStrokeTransparency = fade l.TextColor3 = Color3.new(1-alpha,alpha,alpha) end) l:TweenPosition(UDim2.new(math.random(),0,1.3,0),"Out","Linear",10,true,function () con:disconnect() end) game:GetService("Debris"):AddItem(l,10) end
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
| Report Abuse |
|
Digitov
|
  |
| Joined: 26 Mar 2013 |
| Total Posts: 10867 |
|
| |
| |
|
| 29 Dec 2014 03:21 AM |
yes
Indian of ATR | Follow me on Twitter (@DanBossStar321_) |
|
|
| Report Abuse |
|
| |
| |
zeldu22
|
  |
| Joined: 22 Feb 2014 |
| Total Posts: 5759 |
|
| |
| |