local R=require(script.Parent.Utility.ParticleProps.defaultParticleProps)local z=require(script.Parent.GooeyEmitter.registerEmitter)local J=require(script.Parent.Parent.Roact)local f=J.PureComponent:extend("\082\111\097\099\116\069\108\101\109\101\110\116")f.defaultProps=R function f.init(R)R.frameRef=J.createRef()end function f.didMount(R)if R.props.Enabled==true then R:createEmitter()end end function f.didUpdate(z,R)if R.Enabled~=z.props.Enabled then if z.props.Enabled==true then z:createEmitter()else z:destroyEmitter()end end end function f.render(R)return J.createElement("\070\114\097\109\101",{AnchorPoint=R.props.AnchorPoint,Position=R.props.Position,Size=UDim2.fromOffset(0,0),ZIndex=R.props.ZIndex,[J.Ref]=R.frameRef})end function f.willUnmount(R)R:destroyEmitter()end function f.createEmitter(R)if R.particles==nil then R.particles=z(R.frameRef:getValue(),{Acceleration=R.props.Acceleration;Color=R.props.Color;Image=R.props.Image;Lifetime=R.props.Lifetime;Rate=R.props.Rate;Rotation=R.props.Rotation,Size=R.props.Size,Speed=R.props.Speed;Spread=R.props.Spread,Transparency=R.props.Transparency,ZIndex=R.props.ZIndex})end end function f.destroyEmitter(R)if R.particles~=nil then R.particles()R.particles=nil end end return f
local defaultProps = require(script.Parent.Utility.ParticleProps.defaultParticleProps)
local registerEmitter = require(script.Parent.GooeyEmitter.registerEmitter)
local Roact = require(script.Parent.Parent.Roact)

local RoactElement = Roact.PureComponent:extend("RoactElement")
RoactElement.defaultProps = defaultProps

function RoactElement:init()
	self.frameRef = Roact.createRef()
end

function RoactElement:didMount()
	if self.props.Enabled == true then
		self:createEmitter()
	end
end

function RoactElement:didUpdate(prevProps)
	if prevProps.Enabled ~= self.props.Enabled then
		if self.props.Enabled == true then
			self:createEmitter()
		else
			self:destroyEmitter()
		end
	end
end

function RoactElement:render()
	return Roact.createElement("Frame", {
		AnchorPoint = self.props.AnchorPoint,
		Position = self.props.Position,
		Size = UDim2.fromOffset(0, 0),
		ZIndex = self.props.ZIndex,
		[Roact.Ref] = self.frameRef
	})
end

function RoactElement:willUnmount()
	self:destroyEmitter()
end

function RoactElement:createEmitter()
	if self.particles == nil then
		self.particles = registerEmitter(self.frameRef:getValue(), {
			Acceleration = self.props.Acceleration,
			Color = self.props.Color,
			Image = self.props.Image,
			Lifetime = self.props.Lifetime,
			Rate = self.props.Rate,
			Rotation = self.props.Rotation,
			Size = self.props.Size,
			Speed = self.props.Speed,
			Spread = self.props.Spread,
			Transparency = self.props.Transparency,
			ZIndex = self.props.ZIndex,
		})
	end
end

function RoactElement:destroyEmitter()
	if self.particles ~= nil then
		self.particles()
		self.particles = nil
	end
end

return RoactElement
