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
|
||||
|
||||
```lua
|
||||
type Animatable = number | CFrame | Color3 | UDim | UDim2 | Vector2 | Vector3
|
||||
|
||||
function spring<T>(
|
||||
source: () -> T & Animatable,
|
||||
period: number = 1,
|
||||
damping_ratio: number = 1
|
||||
): () -> T
|
||||
|
||||
type Animatable = number | CFrame | Color3 | UDim | UDim2 | Vector2 | Vector3
|
||||
```
|
||||
|
||||
- ### Details
|
||||
|
|
|
|||
|
|
@ -9,10 +9,11 @@ Creates a new UI element, applying any given properties.
|
|||
- ### Type
|
||||
|
||||
```lua
|
||||
function create(class: string): (Properties) -> Instance
|
||||
function create(instance: Instace): (Properties) -> Instance
|
||||
type Properties = Map<string | number, any>
|
||||
|
||||
function create(class: string): (Properties) -> Instance
|
||||
function create(instance: Instance): (Properties) -> Instance
|
||||
|
||||
type Properties = Map<string|number, any>
|
||||
```
|
||||
|
||||
- ### Details
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
|
||||
- [source()](../api/reactivity-core.md#source)
|
||||
- [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)
|
||||
|
||||
### [Reactivity: Utility](../api/reactivity-utility.md)
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ Runs a callback on state change.
|
|||
- ### Type
|
||||
|
||||
```lua
|
||||
function watch(callback: () -> ()): Unwatch
|
||||
|
||||
type Unwatch = () -> ()
|
||||
|
||||
function watch(callback: () -> ()): Unwatch
|
||||
```
|
||||
|
||||
- ### Details
|
||||
|
|
@ -58,15 +58,15 @@ Runs a callback on state change.
|
|||
- ### Example
|
||||
|
||||
```lua
|
||||
local state = wrap(1)
|
||||
local state = source(1)
|
||||
|
||||
watch(function()
|
||||
print(state.Value)
|
||||
print(state())
|
||||
end)
|
||||
|
||||
-- prints 1
|
||||
|
||||
state.Value += 1
|
||||
state(state() + 1)
|
||||
|
||||
-- prints 2
|
||||
```
|
||||
|
|
@ -99,7 +99,7 @@ Derives a new state from existing states.
|
|||
- ### Example
|
||||
|
||||
```lua
|
||||
local count = wrap(0)
|
||||
local count = source(0)
|
||||
local text = derive(function() return `count: {count()}` end)
|
||||
|
||||
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,
|
||||
Text = props.Text,
|
||||
Callback = props.Callback
|
||||
Activated = props.Callback
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue