Skip to content
This repository has been archived by the owner on Jul 28, 2022. It is now read-only.

Commit

Permalink
Doc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Sleitnick committed Jan 6, 2020
1 parent 1f15fe7 commit 3431461
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 14 deletions.
2 changes: 2 additions & 0 deletions docs/module_docs/client_controllers/fade.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
The Fade controller allows for easy and simple fade-in and fade-out effects on the screen.

For most cases, using just the `In` and `Out` methods is enough.

## Methods

### `In([Number duration [, Boolean async]])`
Expand Down
93 changes: 92 additions & 1 deletion docs/module_docs/client_modules/smooth.md
Original file line number Diff line number Diff line change
@@ -1 +1,92 @@
Coming soon
The Smooth module allows for silky-smooth movements. It is great for camera damping and smooth movement effects.

The underlying concept is to feed the Smooth object a Vector3 goal, and the algorithm will smoothly move toward that goal.

---------------------------

## Constructor

### `Smooth.new(Vector3 initialValue, Number smoothTime)`
Constructs a new Smooth object. The `initialValue` is the starting point for the smoother, and the `smoothTime` is the amount of time it takes for the algorithm to reach its goal.

```lua
local smooth = Smooth.new(Vector3.new(), 0.1)
```

!!! tip
Keep the `smoothTime` as low as possible. While smoothing effects are fun to make, the players will be annoyed by transitions and movements that are too slow.

## Methods

### `Update([Vector3 goal])`
Calculate the new value based on the goal.

```lua
-- Continuously update the 'goal' to be the mouse's position &
-- move 'part' to the new calculated position:
runService:BindToRenderStep("Example", 0, function()
local position = smooth:Update(mouse.Hit.Position)
part.Position = position
end)
```

---------------------------

### `UpdateAngle([Vector3 goal])`
The same as `Update`, but will wrap the value around Tau (2π), which is a full circle in radians. This is necessary if the Smooth object is being used to calculate any sort of rotation (e.g. camera rotation).

```lua
-- Inside RenderStep or Heartbeat loop:
local rotVector = smooth:UpdateAngle(newRotationVector)
```

---------------------------

### `SetMaxSpeed(Number speed)`
Set the max speed at which the smoothing algorithm can travel. By default, there is no maximum speed.

```lua
-- Limit speed to 10 studs per second:
smooth:SetMaxSpeed(10)
```

---------------------------

### `GetMaxSpeed()`
Gets the max speed set for the smoothing algorithm.

```lua
local maxSpeed = smooth:GetMaxSpeed()
```

---------------------------

## Properties

### `Value`
The current Vector3 value calculated by the smoothing algorithm.

---------------------------

### `Goal`
The current Vector3 goal that the smoothing algorithm is moving toward.

---------------------------

### `SmoothTime`
The time it takes for the smoothing algorithm to reach the goal.

---------------------------

## Example

```lua
-- Move 'part' smoothly toward the mouse:

local smoothPosition = Smooth.new(part.Position, 0.5)

runService:BindToRenderStep("Example", 0, function()
local position = smoothPosition:Update(mouse.Hit.Position)
part.Position = position
end)
```
28 changes: 15 additions & 13 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,21 @@ nav:
- Modules: modules.md
- Execution Model: execution_model.md
- Module Docs:
- Server Services:
- StoreService: module_docs/server_services/store_service.md
- Server Modules:
- Data: module_docs/server_modules/data.md
- Client Controllers:
- UserInput: module_docs/client_controllers/user_input.md
- Fade: module_docs/client_controllers/fade.md
- TaskScheduler: module_docs/client_controllers/task_scheduler.md
- Client Modules:
- CameraShaker: module_docs/client_modules/camera_shaker.md
- Smooth: module_docs/client_modules/smooth.md
- Tween: module_docs/client_modules/tween.md
- PID: module_docs/client_modules/pid.md
- Server:
- Services:
- StoreService: module_docs/server_services/store_service.md
- Modules:
- Data: module_docs/server_modules/data.md
- Client:
- Controllers:
- UserInput: module_docs/client_controllers/user_input.md
- Fade: module_docs/client_controllers/fade.md
- TaskScheduler: module_docs/client_controllers/task_scheduler.md
- Modules:
- CameraShaker: module_docs/client_modules/camera_shaker.md
- Smooth: module_docs/client_modules/smooth.md
- Tween: module_docs/client_modules/tween.md
- PID: module_docs/client_modules/pid.md
- Shared Modules:
- Base64: module_docs/shared/base64.md
- Date: module_docs/shared/date.md
Expand Down

0 comments on commit 3431461

Please sign in to comment.