mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
Merge b8f32027d7 into f0916f71c5
This commit is contained in:
commit
e60803733b
6 changed files with 34 additions and 13 deletions
|
|
@ -7,13 +7,13 @@ Returns a new state with a dynamically animated value of the source.
|
||||||
- ### Type
|
- ### Type
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
|
type Animatable = number | CFrame | Color3 | UDim | UDim2 | Vector2 | Vector3
|
||||||
|
|
||||||
function spring<T>(
|
function spring<T>(
|
||||||
source: () -> T & Animatable,
|
source: () -> T & Animatable,
|
||||||
period: number = 1,
|
period: number = 1,
|
||||||
damping_ratio: number = 1
|
damping_ratio: number = 1
|
||||||
): () -> T
|
): () -> T
|
||||||
|
|
||||||
type Animatable = number | CFrame | Color3 | UDim | UDim2 | Vector2 | Vector3
|
|
||||||
```
|
```
|
||||||
|
|
||||||
- ### Details
|
- ### Details
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,11 @@ Creates a new UI element, applying any given properties.
|
||||||
- ### Type
|
- ### Type
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
function create(class: string): (Properties) -> Instance
|
type Properties = Map<string | number, any>
|
||||||
function create(instance: Instace): (Properties) -> Instance
|
|
||||||
|
function create(class: string): (Properties) -> Instance
|
||||||
|
function create(instance: Instance): (Properties) -> Instance
|
||||||
|
|
||||||
type Properties = Map<string|number, any>
|
|
||||||
```
|
```
|
||||||
|
|
||||||
- ### Details
|
- ### Details
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,8 @@
|
||||||
|
|
||||||
- [source()](../api/reactivity-core.md#source)
|
- [source()](../api/reactivity-core.md#source)
|
||||||
- [derive()](../api/reactivity-core.md#derive)
|
- [derive()](../api/reactivity-core.md#derive)
|
||||||
- [map()](../api/reactivity-core.md#map)
|
- [indexes()](../api/reactivity-core.md#indexes)
|
||||||
|
- [values()](../api/reactivity-core.md#values)
|
||||||
- [watch()](../api/reactivity-core.md#watch)
|
- [watch()](../api/reactivity-core.md#watch)
|
||||||
|
|
||||||
### [Reactivity: Utility](../api/reactivity-utility.md)
|
### [Reactivity: Utility](../api/reactivity-utility.md)
|
||||||
|
|
|
||||||
|
|
@ -39,9 +39,9 @@ Runs a callback on state change.
|
||||||
- ### Type
|
- ### Type
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
function watch(callback: () -> ()): Unwatch
|
|
||||||
|
|
||||||
type Unwatch = () -> ()
|
type Unwatch = () -> ()
|
||||||
|
|
||||||
|
function watch(callback: () -> ()): Unwatch
|
||||||
```
|
```
|
||||||
|
|
||||||
- ### Details
|
- ### Details
|
||||||
|
|
@ -58,15 +58,15 @@ Runs a callback on state change.
|
||||||
- ### Example
|
- ### Example
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
local state = wrap(1)
|
local state = source(1)
|
||||||
|
|
||||||
watch(function()
|
watch(function()
|
||||||
print(state.Value)
|
print(state())
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- prints 1
|
-- prints 1
|
||||||
|
|
||||||
state.Value += 1
|
state(state() + 1)
|
||||||
|
|
||||||
-- prints 2
|
-- prints 2
|
||||||
```
|
```
|
||||||
|
|
@ -99,7 +99,7 @@ Derives a new state from existing states.
|
||||||
- ### Example
|
- ### Example
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
local count = wrap(0)
|
local count = source(0)
|
||||||
local text = derive(function() return `count: {count()}` end)
|
local text = derive(function() return `count: {count()}` end)
|
||||||
|
|
||||||
text() -- "count: 0"
|
text() -- "count: 0"
|
||||||
|
|
|
||||||
19
docs/api/type-docs.md
Normal file
19
docs/api/type-docs.md
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
# Type Documentation
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
## Map<K, V>
|
||||||
|
|
||||||
|
### Type Definition
|
||||||
|
|
||||||
|
```lua
|
||||||
|
type Map<K, V> = { [K]: V }
|
||||||
|
```
|
||||||
|
|
||||||
|
## Array<T>
|
||||||
|
|
||||||
|
### Type Definition
|
||||||
|
|
||||||
|
```lua
|
||||||
|
type Array<T> = { T }
|
||||||
|
```
|
||||||
|
|
@ -19,7 +19,7 @@ local function Button(props: {
|
||||||
|
|
||||||
Position = props.Position,
|
Position = props.Position,
|
||||||
Text = props.Text,
|
Text = props.Text,
|
||||||
Callback = props.Callback
|
Activated = props.Callback
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue