add demos to README.md
This commit is contained in:
@@ -40,21 +40,49 @@ val radiusHistory by tracking(state::radius)
|
||||
<!-- __demos__ -->
|
||||
## Demos
|
||||
### DemoDifferencing01
|
||||
[source code](src/jvmDemo/kotlin/DemoDifferencing01.kt)
|
||||
|
||||
|
||||

|
||||
|
||||
### DemoFollowing01
|
||||
[source code](src/jvmDemo/kotlin/DemoFollowing01.kt)
|
||||
[source code](src/jvmDemo/kotlin/DemoDifferencing01.kt)
|
||||
|
||||
### DemoFollowing01
|
||||
|
||||
Demonstrates using delegate-magic tools with
|
||||
[Double] and [Vector2].
|
||||
|
||||
The white circle's position uses [following].
|
||||
The red circle's position uses [smoothing].
|
||||
|
||||
`following` uses physics (velocity and acceleration).
|
||||
`smoothing` eases values towards the target.
|
||||
|
||||
Variables using delegates (`by`) interpolate
|
||||
toward target values, shown as gray lines.
|
||||
|
||||
The behavior of the delegate-magic functions can be configured
|
||||
via arguments that affect their output.
|
||||
|
||||
The arguments come in pairs of similar name:
|
||||
The first one, often of type [Double], is constant,
|
||||
The second one contains `Property` in its name and can be
|
||||
modified after its creation and even be linked to a UI
|
||||
to modify the behavior of the delegate function in real time.
|
||||
The `Property` argument overrides the other.
|
||||

|
||||
|
||||
[source code](src/jvmDemo/kotlin/DemoFollowing01.kt)
|
||||
|
||||
### DemoSmoothing01
|
||||
[source code](src/jvmDemo/kotlin/DemoSmoothing01.kt)
|
||||
|
||||
|
||||

|
||||
|
||||
[source code](src/jvmDemo/kotlin/DemoSmoothing01.kt)
|
||||
|
||||
### DemoSpring01
|
||||
[source code](src/jvmDemo/kotlin/DemoSpring01.kt)
|
||||
|
||||
|
||||

|
||||
|
||||
[source code](src/jvmDemo/kotlin/DemoSpring01.kt)
|
||||
|
||||
Reference in New Issue
Block a user