@quenty/depthoffield 1.4.1-canary.8533eea.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,7 +3,15 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [1.4.1-canary.8533eea.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/depthoffield@1.4.0...@quenty/depthoffield@1.4.1-canary.8533eea.0) (2021-12-18)
6
+ ## [1.5.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/depthoffield@1.5.0...@quenty/depthoffield@1.5.1) (2021-12-30)
7
+
8
+ **Note:** Version bump only for package @quenty/depthoffield
9
+
10
+
11
+
12
+
13
+
14
+ # [1.5.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/depthoffield@1.4.0...@quenty/depthoffield@1.5.0) (2021-12-18)
7
15
 
8
16
  **Note:** Version bump only for package @quenty/depthoffield
9
17
 
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # DepthOfField
2
2
  <div align="center">
3
- <a href="http://quenty.github.io/api/">
4
- <img src="https://img.shields.io/badge/docs-website-green.svg" alt="Documentation" />
3
+ <a href="http://quenty.github.io/NevermoreEngine/">
4
+ <img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/docs.yml/badge.svg" alt="Documentation status" />
5
5
  </a>
6
6
  <a href="https://discord.gg/mhtGUS8">
7
- <img src="https://img.shields.io/badge/discord-nevermore-blue.svg" alt="Discord" />
7
+ <img src="https://img.shields.io/discord/385151591524597761?color=5865F2&label=discord&logo=discord&logoColor=white" alt="Discord" />
8
8
  </a>
9
9
  <a href="https://github.com/Quenty/NevermoreEngine/actions">
10
10
  <img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/build.yml/badge.svg" alt="Build and release status" />
@@ -13,6 +13,8 @@
13
13
 
14
14
  Depth of field service to allow multiple systems to write depth of field
15
15
 
16
+ <div align="center"><a href="https://quenty.github.io/NevermoreEngine/api/DepthOfFieldService">View docs →</a></div>
17
+
16
18
  ## Installation
17
19
  ```
18
20
  npm install @quenty/depthoffield --save
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/depthoffield",
3
- "version": "1.4.1-canary.8533eea.0",
3
+ "version": "1.5.1",
4
4
  "description": "Depth of field service to allow multiple systems to write depth of field",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -25,16 +25,16 @@
25
25
  "Quenty"
26
26
  ],
27
27
  "dependencies": {
28
- "@quenty/acceltween": "2.0.0",
29
- "@quenty/baseobject": "3.2.0",
30
- "@quenty/loader": "3.1.1",
31
- "@quenty/maid": "2.0.1",
32
- "@quenty/signal": "2.0.0",
33
- "@quenty/steputils": "3.0.0",
34
- "@quenty/valueobject": "3.4.1-canary.8533eea.0"
28
+ "@quenty/acceltween": "^2.0.1",
29
+ "@quenty/baseobject": "^3.2.1",
30
+ "@quenty/loader": "^3.1.2",
31
+ "@quenty/maid": "^2.0.2",
32
+ "@quenty/signal": "^2.0.1",
33
+ "@quenty/steputils": "^3.0.1",
34
+ "@quenty/valueobject": "^3.5.1"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"
38
38
  },
39
- "gitHead": "8533eeade3bf6835c0295785c1c326b9abee3222"
39
+ "gitHead": "d146c77d0a8e452824de0ab0b4b03ba0370bcc1b"
40
40
  }
@@ -1,6 +1,6 @@
1
- ---
2
- -- @classmod DepthOfFieldModifier
3
- -- @author Quenty
1
+ --[=[
2
+ @class DepthOfFieldModifier
3
+ ]=]
4
4
 
5
5
  local require = require(script.Parent.loader).load(script)
6
6
 
@@ -20,21 +20,41 @@ function DepthOfFieldModifier.new(distance, radius)
20
20
  self._distance = distance
21
21
  self._radius = radius
22
22
 
23
+ --[=[
24
+ Fires when the modifier is removing.
25
+ @prop Removing Signal
26
+ @within DepthOfFieldModifier
27
+ ]=]
23
28
  self.Removing = Signal.new()
24
29
  self._maid:GiveTask(function()
25
30
  self.Removing:Fire()
26
31
  self.Removing:Destroy()
27
32
  end)
28
33
 
34
+ --[=[
35
+ Fires when the distance changes.
36
+ @prop DistanceChanged Signal
37
+ @within DepthOfFieldModifier
38
+ ]=]
29
39
  self.DistanceChanged = Signal.new()
30
40
  self._maid:GiveTask(self.DistanceChanged)
31
41
 
42
+ --[=[
43
+ Fires when the radius changes.
44
+ @prop RadiusChanged Signal
45
+ @within DepthOfFieldModifier
46
+ ]=]
32
47
  self.RadiusChanged = Signal.new()
33
48
  self._maid:GiveTask(self.RadiusChanged)
34
49
 
35
50
  return self
36
51
  end
37
52
 
53
+ --[=[
54
+ Sets the target depth of field distance
55
+ @param distance number
56
+ @param doNotAnimate boolean
57
+ ]=]
38
58
  function DepthOfFieldModifier:SetDistance(distance, doNotAnimate)
39
59
  assert(type(distance) == "number", "Bad distance")
40
60
 
@@ -46,6 +66,11 @@ function DepthOfFieldModifier:SetDistance(distance, doNotAnimate)
46
66
  self.DistanceChanged:Fire(distance, doNotAnimate)
47
67
  end
48
68
 
69
+ --[=[
70
+ Sets the target depth of field distance
71
+ @param radius number
72
+ @param doNotAnimate boolean
73
+ ]=]
49
74
  function DepthOfFieldModifier:SetRadius(radius, doNotAnimate)
50
75
  assert(type(radius) == "number", "Bad radius")
51
76
 
@@ -57,14 +82,26 @@ function DepthOfFieldModifier:SetRadius(radius, doNotAnimate)
57
82
  self.RadiusChanged:Fire(radius, doNotAnimate)
58
83
  end
59
84
 
85
+ --[=[
86
+ Retrieves the distance
87
+ @return number
88
+ ]=]
60
89
  function DepthOfFieldModifier:GetDistance()
61
90
  return self._distance
62
91
  end
63
92
 
93
+ --[=[
94
+ Retrieves the radius
95
+ @return number
96
+ ]=]
64
97
  function DepthOfFieldModifier:GetRadius()
65
98
  return self._radius
66
99
  end
67
100
 
101
+ --[=[
102
+ Resets the radius
103
+ @param doNotAnimate boolean
104
+ ]=]
68
105
  function DepthOfFieldModifier:Reset(doNotAnimate)
69
106
  self:SetDistance(self._originalDistance, doNotAnimate)
70
107
  self:SetRadius(self._originalRadius, doNotAnimate)
@@ -1,6 +1,6 @@
1
- ---
2
- -- @module DepthOfFieldService
3
- -- @author Quenty
1
+ --[=[
2
+ @class DepthOfFieldService
3
+ ]=]
4
4
 
5
5
  local require = require(script.Parent.loader).load(script)
6
6
 
@@ -13,6 +13,10 @@ local ValueObject = require("ValueObject")
13
13
 
14
14
  local DepthOfFieldService = {}
15
15
 
16
+ --[=[
17
+ Initializes the DepthOfFieldService. Should be done via [ServiceBag].
18
+ @param _serviceBag ServiceBag
19
+ ]=]
16
20
  function DepthOfFieldService:Init(_serviceBag)
17
21
  self._maid = Maid.new()
18
22
 
@@ -48,6 +52,10 @@ function DepthOfFieldService:Init(_serviceBag)
48
52
  self._modifierStack = {}
49
53
  end
50
54
 
55
+ --[=[
56
+ Creates a new depth of field modifier
57
+ @return DepthOfFieldModifier
58
+ ]=]
51
59
  function DepthOfFieldService:CreateModifier()
52
60
  local maid = Maid.new()
53
61
 
@@ -1,6 +1,7 @@
1
- ---
2
- -- @classmod DepthOfFieldTweener
3
- -- @author Quenty
1
+ --[=[
2
+ Tweens DepthOfField. Prefer to use [DepthOfFieldService].
3
+ @class DepthOfFieldTweener
4
+ ]=]
4
5
 
5
6
  local require = require(script.Parent.loader).load(script)
6
7
 
@@ -14,6 +15,12 @@ local DepthOfFieldTweener = setmetatable({}, BaseObject)
14
15
  DepthOfFieldTweener.ClassName = "DepthOfFieldTweener"
15
16
  DepthOfFieldTweener.__index = DepthOfFieldTweener
16
17
 
18
+ --[=[
19
+ Create a new DepthOfFieldTweener.
20
+ @param depthOfField number
21
+ @param speed number?
22
+ @return DepthOfFieldTweener
23
+ ]=]
17
24
  function DepthOfFieldTweener.new(depthOfField, speed)
18
25
  local self = setmetatable(BaseObject.new(), DepthOfFieldTweener)
19
26
 
@@ -42,6 +49,11 @@ function DepthOfFieldTweener.new(depthOfField, speed)
42
49
  return self
43
50
  end
44
51
 
52
+ --[=[
53
+ Sets the radius and starts any animation
54
+ @param radius number
55
+ @param doNotAnimate boolean
56
+ ]=]
45
57
  function DepthOfFieldTweener:SetRadius(radius, doNotAnimate)
46
58
  local target = math.clamp(radius, 0, 500)
47
59
  self._radius.t = target
@@ -53,14 +65,27 @@ function DepthOfFieldTweener:SetRadius(radius, doNotAnimate)
53
65
  self:_startAnimation()
54
66
  end
55
67
 
68
+ --[=[
69
+ Gets the current radius being rendered
70
+ @return number
71
+ ]=]
56
72
  function DepthOfFieldTweener:GetRadius()
57
73
  return self._radius.p
58
74
  end
59
75
 
76
+ --[=[
77
+ Gets the current distance being set
78
+ @return number
79
+ ]=]
60
80
  function DepthOfFieldTweener:GetDistance()
61
81
  return self._distance.p
62
82
  end
63
83
 
84
+ --[=[
85
+ Sets the distance to render
86
+ @param distance number
87
+ @param doNotAnimate boolean
88
+ ]=]
64
89
  function DepthOfFieldTweener:SetDistance(distance, doNotAnimate)
65
90
  local target = math.clamp(distance, 0, 500)
66
91
  self._distance.t = target
@@ -72,16 +97,28 @@ function DepthOfFieldTweener:SetDistance(distance, doNotAnimate)
72
97
  self:_startAnimation()
73
98
  end
74
99
 
100
+ --[=[
101
+ Resets the depth of field to the original distance
102
+ @param doNotAnimate boolean
103
+ ]=]
75
104
  function DepthOfFieldTweener:Reset(doNotAnimate)
76
105
  self:ResetRadius(doNotAnimate)
77
106
  self:ResetDistance(doNotAnimate)
78
107
  end
79
108
 
109
+ --[=[
110
+ Resets the radius
111
+ @param doNotAnimate boolean
112
+ ]=]
80
113
  function DepthOfFieldTweener:ResetRadius(doNotAnimate)
81
114
  self:SetRadius(self._originalDistance, doNotAnimate)
82
115
  self:_startAnimation()
83
116
  end
84
117
 
118
+ --[=[
119
+ Resets the distance
120
+ @param doNotAnimate boolean
121
+ ]=]
85
122
  function DepthOfFieldTweener:ResetDistance(doNotAnimate)
86
123
  self:SetDistance(self._originalDistance, doNotAnimate)
87
124
  self:_startAnimation()