- Prototope Documentation
- Animator
- Border
- CameraLayer
- CameraPosition
- Color
- Gesture
- Heartbeat
- Image
- Layer
- LayerAnimatorStore
- Math
- PanGesture
- Particle
- ParticleEmitter
- ParticlePreset
- Point
- Rect
- Shadow
- Size
- Sound
- TapGesture
- Timestamp
- TouchSample
- TouchSequence
- Tunable
- View as:
- Swift
- JavaScript
Tunable
These functions allow you to take a value and make it tunable by a slider or a switch!
Example usage:
tunable(0.5, name: "button alpha") { alpha in someButton.alpha = alpha }
Whenever the alpha changes, the closure will be run, and the button’s alpha will be updated.
If an instantaneous return value is good enough, you can do this instead:
someButton.alpha = tunable(0.5, name: "button alpha")
Once you’ve tuned values in the UI, you can apply them back to the project by following these steps:
- Tap “Share”
-
Get the values you just tweaked
- If you’re not attached to Xcode, email yourself from the share sheet.
- If you’re attached to Xcode, open up the console (
View > Debug Area > Activate Console
) and look for a log like this:
[
{
"label" : "Test",
"key" : "Test",
"sliderMinValue" : 0,
"sliderMaxValue" : 1400,
"sliderValue" : 179.6053
}
]
- Copy and paste the contents into
TunableSpec.json
in your project (included with OhaiPrototope).
Method reference
-
⚓
public func tunable(defaultValue: Bool, #name: String) -> Bool
-
⚓
public func tunable(defaultValue: Bool, #name: String, #maintain: Bool -> Void)
-
⚓
public func tunable(defaultValue: Double, #name: String) -> Double
-
⚓
public func tunable(defaultValue: Double, #name: String, #maintain: Double -> Void)
-
⚓
public func tunable(defaultValue: Point, #name: String) -> Point
-
⚓
public func tunable(defaultValue: Point, #name: String, #maintain: Point -> Void)