### Convert Video to GIF using FFmpeg Source: https://github.com/mahozad/wavy-slider/blob/main/asset/README.md This command uses FFmpeg to convert a video file (e.g., demo.mp4) into an optimized GIF. It specifies the start time (-ss), end time (-to), input file (-i), and applies video filters for frame rate, palette generation, and palette usage to create a looping GIF. The output GIF is then optimized using an online tool. ```shell ffmpeg \ -y \ -ss 2800ms \ -to 14800ms \ -i demo.mp4 \ -vf "fps=30,split[s0][s1];[s0]palettegen=max_colors=32[p];[s1][p]paletteuse" \ -loop 0 \ output.gif ``` -------------------------------- ### Install Wavy Slider Dependency for Kotlin Projects Source: https://context7.com/mahozad/wavy-slider/llms.txt Add the Wavy Slider library dependency to your Kotlin project's build script. This is typically done in the `build.gradle.kts` file, either globally or within the `commonMain` source set for multiplatform projects. ```kotlin // build.gradle.kts implementation("ir.mahozad.multiplatform:wavy-slider:2.2.0") // For multiplatform projects, add to commonMain dependencies: kotlin { sourceSets { commonMain.dependencies { implementation("ir.mahozad.multiplatform:wavy-slider:2.2.0") } } } ``` -------------------------------- ### Generate Cursor Movements for AutoMouse Pro (Kotlin) Source: https://github.com/mahozad/wavy-slider/blob/main/asset/README.md This Kotlin script generates a sequence of cursor movements and actions to be used with AutoMouse Pro. It defines target points, interpolates paths between them, and formats the output as strings representing move, press, and release actions. The output is saved to a file and then replayed by AutoMouse Pro. ```kotlin import kotlin.math.roundToInt // Target cursor points val center = 960 to 434 val right = 1210 to 626 val left = 724 to 626 val waitAtCenter = interpolate(center, center, 30).map(::round) val waitAtRight = interpolate(right, right, 15).map(::round) val waitAtLeft = interpolate(left, left, 15).map(::round) val moveFromCenterToRight = interpolate(center, right, 30).map(::round) val moveFromRightToCenter = interpolate(right, center, 30).map(::round) val moveFromRightToLeft = interpolate(right, left, 120).map(::round) val moveFromLeftToRight = interpolate(left, right, 120).map(::round) ( waitAtCenter.map(::move) + moveFromCenterToRight.map(::move) + moveFromCenterToRight.last().let(::press) + waitAtRight.map(::move) + moveFromRightToLeft.map(::move) + moveFromLeftToRight.map(::move) + moveFromLeftToRight.last().let(::release) + moveFromRightToCenter.map(::move) + waitAtCenter.map(::move) ) .forEach(::println) fun interpolate( a: Pair, b: Pair, count: Int ): List> { val (x1, y1) = a val (x2, y2) = b val deltaX = x2 - x1 val deltaY = y2 - y1 val slope = if (deltaX == 0) 0f else deltaY.toFloat() / deltaX val xIncrement = deltaX.toFloat() / count val yIncrement = xIncrement * slope return buildList { for (i in 0..count) { val x = x1 + i * xIncrement val y = y1 + i * yIncrement add(x to y) } } } fun round(point: Pair) = point.first.roundToInt() to point.second.roundToInt() fun move(point: Pair) = "${point.first}|${point.second}|mov" fun press(point: Pair) = "${point.first}|${point.second}|ltd" fun release(point: Pair) = "${point.first}|${point.second}|ltu" ``` -------------------------------- ### Generate Animated PNGs using FFmpeg Source: https://github.com/mahozad/wavy-slider/blob/main/asset/README.md This process uses FFmpeg to capture screen recordings and convert them into animated PNG (APNG) format. It requires FFmpeg v5.1-gpl and may need specific Skiko render API settings if the output is black. The process involves capturing the application window, trimming the duration, and optimizing the resulting APNG file. ```shell # Capture screen recording to out.apng ./ffmpeg.exe -f gdigrab -framerate 30 -i title="WavySliderDemo" -plays 0 out.apng # If output is black, try setting the render API # System.setProperty("skiko.renderApi", "OPENGL") # Trim the duration of out.apng to create out-trimmed.apng ./ffmpeg.exe -ss 5s -to 7s -i out.apng -plays 0 out-trimmed.apng ``` -------------------------------- ### Configure Wavy Slider for Multiplatform Projects Source: https://github.com/mahozad/wavy-slider/blob/main/README.md Demonstrates how to set up the Wavy Slider dependency in a multiplatform project. It covers adding the dependency to the common source set for broad compatibility or to specific targets if needed. ```kotlin kotlin { sourceSets { commonMain.dependencies { implementation("ir.mahozad.multiplatform:wavy-slider:2.2.0") // ... } } } ``` ```kotlin kotlin { val desktopMain /* OR jvmMain */ by getting { dependencies { implementation("ir.mahozad.multiplatform:wavy-slider:2.2.0") // ... } } androidMain.dependencies { implementation("ir.mahozad.multiplatform:wavy-slider:2.2.0") // ... } // Other targets... } ``` -------------------------------- ### Convert APNG to GIF using apng2gif Source: https://github.com/mahozad/wavy-slider/blob/main/asset/README.md This snippet describes the manual process of converting an animated PNG (APNG) file to a GIF format using the apng2gif utility. The user needs to run the apng2gif program, drag and drop the APNG file, and click 'Convert'. The resulting GIF is then optimized using an online tool. ```shell # Assumes apng2gif utility is available in the apng2gif directory # 1. Execute the apng2gif program. # 2. Drag and drop the 'out.apng' file into the apng2gif window. # 3. Click the 'Convert' button. # 4. Optimize the resulting GIF using an online tool like ezgif.com/optimize. ``` -------------------------------- ### Convert WavySlider to Regular Slider with Kotlin Source: https://context7.com/mahozad/wavy-slider/llms.txt Demonstrates how to convert a WavySlider into a standard flat Material Slider by setting either the wave height or wave length to zero. This allows for conditional rendering of a wavy or flat slider appearance. ```kotlin import androidx.compose.runtime.* import androidx.compose.ui.unit.dp import ir.mahozad.multiplatform.wavyslider.material3.WavySlider @Composable fun ConditionalWavySlider(isWavyEnabled: Boolean) { var value by remember { mutableStateOf(0.5f) } // Setting waveHeight to 0.dp creates a flat slider WavySlider( value = value, onValueChange = { value = it }, waveHeight = if (isWavyEnabled) 16.dp else 0.dp ) // Alternatively, setting waveLength to 0.dp also creates a flat slider WavySlider( value = value, onValueChange = { value = it }, waveLength = if (isWavyEnabled) 16.dp else 0.dp ) } // Output: A slider that toggles between wavy and flat based on the boolean parameter ``` -------------------------------- ### Customize WavySlider Track and Thumb with Kotlin Source: https://context7.com/mahozad/wavy-slider/llms.txt Illustrates advanced WavySlider customization by using SliderState for direct track manipulation and custom thumb definitions. The Track composable can be used independently to create unique slider appearances with wave effects, and the thumb can be replaced with any Composable. ```kotlin import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.size import androidx.compose.foundation.background import androidx.compose.material3.* import androidx.compose.runtime.* import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import ir.mahozad.multiplatform.wavyslider.material3.WavySlider import ir.mahozad.multiplatform.wavyslider.material3.Track import ir.mahozad.multiplatform.wavyslider.WaveDirection.* @OptIn(ExperimentalMaterial3Api::class) @Composable fun CustomThumbAndTrack() { val state = remember { SliderState(value = 0.67f) } // Custom thumb with wavy slider WavySlider( state = state, thumb = { Box(modifier = Modifier.size(64.dp).background(Color.Red)) } ) // Custom track with specific gap settings WavySlider( state = state, track = { SliderDefaults.Track( sliderState = state, waveLength = 20.dp, thumbTrackGapSize = 0.dp // Remove gap between thumb and track ) } ) } ``` -------------------------------- ### Add Wavy Slider Dependency to Gradle Source: https://github.com/mahozad/wavy-slider/blob/main/README.md This snippet shows how to add the Wavy Slider library dependency to your project's Gradle build file. It's the primary way to include the library in your application. ```gradle implementation("ir.mahozad.multiplatform:wavy-slider:2.2.0") ``` -------------------------------- ### Access Default WavySlider Parameters with Kotlin Source: https://context7.com/mahozad/wavy-slider/llms.txt Shows how to access and utilize default wave parameter values provided by SliderDefaults extension properties for both Material 2 and Material 3. This is useful for referencing or modifying specific default values while keeping others unchanged. ```kotlin import androidx.compose.material3.SliderDefaults import androidx.compose.runtime.* import androidx.compose.ui.unit.dp import ir.mahozad.multiplatform.wavyslider.material3.* @Composable fun DefaultsAwareSlider() { var value by remember { mutableStateOf(0.5f) } // Access default values val defaultLength = SliderDefaults.WaveLength // 20.dp val defaultHeight = SliderDefaults.WaveHeight // 6.dp val defaultVelocity = SliderDefaults.WaveVelocity // 10.dp to TAIL val defaultThickness = SliderDefaults.WaveThickness // 4.dp val defaultTrack = SliderDefaults.TrackThickness // 16.dp (M3), 4.dp (M2) val defaultIncremental = SliderDefaults.Incremental // false val defaultSpecs = SliderDefaults.WaveAnimationSpecs // Use defaults with one modification WavySlider( value = value, onValueChange = { value = it }, waveLength = SliderDefaults.WaveLength * 2, // Double the default length waveHeight = SliderDefaults.WaveHeight // Keep default height ) } ``` -------------------------------- ### Implement Wavy Slider in Jetpack Compose Source: https://github.com/mahozad/wavy-slider/blob/main/README.md Shows a basic implementation of the Wavy Slider composable within a Jetpack Compose UI. It includes setting the value, handling changes, and configuring various wave and slider properties. ```kotlin import ir.mahozad.multiplatform.wavyslider.material3.WavySlider as WavySlider3 import ir.mahozad.multiplatform.wavyslider.material.WavySlider as WavySlider2 import ir.mahozad.multiplatform.wavyslider.WaveDirection.* @Composable fun MyComposable() { var fraction by remember { mutableStateOf(0.5f) } WavySlider3( // OR WavySlider2. See the imports above that use "as ..." value = fraction, onValueChange = { fraction = it }, waveLength = 16.dp, // Setting this to 0.dp results in a Slider waveHeight = 16.dp, // Setting this to 0.dp results in a Slider waveVelocity = 15.dp to HEAD, // Speed per second and its direction waveThickness = 4.dp, // Defaults to 4.dp irregardless of variant trackThickness = 4.dp, // Defaults to a thickness based on variant incremental = false, // Whether to gradually increase waveHeight // animationSpecs = ... // Customize various animations of the wave // Other options that are available in standard Material 2/3 Slider ) } ``` -------------------------------- ### Create Static Wavy Divider with Kotlin Source: https://context7.com/mahozad/wavy-slider/llms.txt Generates a static, non-animated wavy line divider by disabling wave movement and using snap animations. This is useful for purely decorative elements in UI layouts where interaction is not required. ```kotlin import androidx.compose.animation.core.snap import androidx.compose.material3.* import androidx.compose.runtime.Composable import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import ir.mahozad.multiplatform.wavyslider.WaveAnimationSpecs import ir.mahozad.multiplatform.wavyslider.material3.WavySlider import ir.mahozad.multiplatform.wavyslider.material3.Track import ir.mahozad.multiplatform.wavyslider.WaveDirection.* @OptIn(ExperimentalMaterial3Api::class) @Composable fun WavyDivider() { WavySlider( value = 1f, // Full width onValueChange = {}, thumb = {}, track = { SliderDefaults.Track( sliderState = it, enabled = false, colors = SliderDefaults.colors(disabledActiveTrackColor = Color.Magenta), thumbTrackGapSize = 0.dp, waveThickness = 1.dp, waveVelocity = 0.dp to HEAD, // No movement animationSpecs = WaveAnimationSpecs( waveAppearanceAnimationSpec = snap(), // Instant appearance waveVelocityAnimationSpec = snap(), waveHeightAnimationSpec = snap() ) ) } ) } // Output: A static wavy line that can be used as a decorative divider ``` -------------------------------- ### Create Material 3 Wavy Slider in Jetpack Compose Source: https://context7.com/mahozad/wavy-slider/llms.txt Implement an animated wavy slider using the Material 3 `WavySlider` composable. This function accepts standard Material 3 Slider parameters along with specific wave customizations like length, height, velocity, and thickness. ```kotlin import androidx.compose.runtime.* import androidx.compose.ui.unit.dp import ir.mahozad.multiplatform.wavyslider.material3.WavySlider import ir.mahozad.multiplatform.wavyslider.WaveDirection.* @Composable fun MediaPlayerSlider() { var progress by remember { mutableStateOf(0.5f) } WavySlider( value = progress, onValueChange = { progress = it }, waveLength = 16.dp, // Distance over which wave shape repeats waveHeight = 16.dp, // Total height from crest to trough waveVelocity = 15.dp to HEAD, // Speed and direction of wave movement waveThickness = 4.dp, // Thickness of the wavy active track trackThickness = 4.dp, // Thickness of the inactive track incremental = false, // Whether wave height increases toward thumb onValueChangeFinished = { println("User finished selecting: $progress") } ) } ``` -------------------------------- ### Disable Initial Wavy Animation with Kotlin Source: https://github.com/mahozad/wavy-slider/blob/main/README.md This code snippet shows how to disable the initial appearance or composition spread/expand animation of the wavy slider. It utilizes the Compose `snap()` animation spec for the `waveAppearanceAnimationSpec` within `WaveAnimationSpecs`. ```kotlin animationSpecs = SliderDefaults.WaveAnimationSpecs.copy(waveAppearanceAnimationSpec = snap()) ``` -------------------------------- ### Customize WavySlider Animations with Kotlin Source: https://context7.com/mahozad/wavy-slider/llms.txt Demonstrates how to customize the animation behavior of WavySlider using the WaveAnimationSpecs class. You can control the duration and easing of wave height, velocity, and appearance animations. To disable all animations, use the snap() function for each animation spec. ```kotlin import androidx.compose.animation.core.* import androidx.compose.runtime.* import androidx.compose.ui.unit.dp import ir.mahozad.multiplatform.wavyslider.WaveAnimationSpecs import ir.mahozad.multiplatform.wavyslider.material3.WavySlider import ir.mahozad.multiplatform.wavyslider.WaveDirection.* @Composable fun CustomAnimatedSlider() { var value by remember { mutableStateOf(0.5f) } WavySlider( value = value, onValueChange = { value = it }, animationSpecs = WaveAnimationSpecs( // Animation for wave height changes waveHeightAnimationSpec = tween(durationMillis = 500, easing = FastOutSlowInEasing), // Animation for velocity/direction changes waveVelocityAnimationSpec = tween(durationMillis = 1000, easing = LinearOutSlowInEasing), // Animation for initial wave appearance (spread effect) waveAppearanceAnimationSpec = tween(durationMillis = 3000, easing = EaseOutQuad) ) ) // Disable all animations with snap() WavySlider( value = value, onValueChange = { value = it }, animationSpecs = WaveAnimationSpecs( waveHeightAnimationSpec = snap(), waveVelocityAnimationSpec = snap(), waveAppearanceAnimationSpec = snap() ) ) } ``` -------------------------------- ### Create Material 2 Wavy Slider in Jetpack Compose Source: https://context7.com/mahozad/wavy-slider/llms.txt Utilize the Material 2 `WavySlider` composable for applications adhering to Material Design 2 guidelines. This variant offers the same wave animation features with Material 2 styling, including custom colors for the active track. ```kotlin import androidx.compose.material.SliderDefaults import androidx.compose.runtime.* import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import ir.mahozad.multiplatform.wavyslider.material.WavySlider import ir.mahozad.multiplatform.wavyslider.WaveDirection.* @Composable fun CustomStyledSlider() { var volume by remember { mutableStateOf(0.7f) } WavySlider( value = volume, onValueChange = { volume = it }, waveLength = 12.dp, waveHeight = 24.dp, waveVelocity = 14.dp to RIGHT, // Wave moves toward the right waveThickness = 1.dp, trackThickness = 5.dp, incremental = true, // Wave height grows from start to thumb colors = SliderDefaults.colors(activeTrackColor = Color.Red) ) } ``` -------------------------------- ### Control Wavy Slider Animation Direction with WaveDirection Enum Source: https://context7.com/mahozad/wavy-slider/llms.txt Customize the horizontal movement of the wave animation in `WavySlider` using the `WaveDirection` enum. Options include LEFT, RIGHT, TAIL, and HEAD, allowing precise control over wave propagation relative to the slider's orientation and thumb position. ```kotlin import androidx.compose.runtime.* import androidx.compose.ui.unit.dp import ir.mahozad.multiplatform.wavyslider.material3.WavySlider import ir.mahozad.multiplatform.wavyslider.WaveDirection.* @Composable fun DirectionalWaves() { var value by remember { mutableStateOf(0.5f) } // Wave moves toward the thumb (most common for media players) WavySlider( value = value, onValueChange = { value = it }, waveVelocity = 10.dp to HEAD ) // Wave moves toward the start of the slider WavySlider( value = value, onValueChange = { value = it }, waveVelocity = 10.dp to TAIL ) // Wave always moves left (ignores RTL layout) WavySlider( value = value, onValueChange = { value = it }, waveVelocity = 10.dp to LEFT ) } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.