Code Monkey home page Code Monkey logo

junoslider's Introduction

JunoSlider

Two JunoSliders vertically stacked, the first narrower than the second, being slid and updating corresponding Text views

JunoSlider is a custom slider for visionOS (probably works with iOS fine, though!) to mimic the style of Apple's expanding sliders in views like AVPlayer in instances where you're unable to use AVPlayer.

It's built in SwiftUI and customizable, with both the collapsed and expanded height being values you can change.

Apple's built-in Slider control may be a better fit for a lot of cases especially those where you don't require the expansion effect. The built-in Slider can animate its controlSize property, but the animation is a little weird on visionOS. Also, the height is not super customizable, even .mini with Slider does not allow you to get as narrow as Apple's AVPlayer slider, for instance.

Big thanks to Matthew Skiles and Ed Sanchez for helping me with the inner and drop shadows on the control. Also thank you to kind Twitter and Mastodon folks for helping me debug an animation issue with this control, it seems like a SwiftUI bug and the idea of just cropping out the animation jump seemed to be the best tradeoff.

Example Usage

import JunoUI

struct ContentView: View {
    @State var sliderValue: CGFloat = 0.5
    @State var isSliderActive = false
    
    var body: some View {
        JunoSlider(sliderValue: $sliderValue, maxSliderValue: 1.0, baseHeight: 10.0, expandedHeight: 22.0, label: "Video volume") { editingChanged in
            isSliderActive = editingChanged
        }
    }
}

junoslider's People

Contributors

christianselig avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.