Skip to content

muvicado/SpriteSlider

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SpriteKit based Slider and Toggle widgets

Description

SpriteKit itself does not provide native UI controls like sliders, switches (toggles), or buttons in the way UIKit does. SpriteKit is a game and animation framework focused on 2D rendering and scene management, not general-purpose app UI.

Here we create custom, minimal version of stylable controls directly in SpriteKit with sprites and touches. We'll use custom artwork (for slider thumb positions and toggle states).

Usage

Slider

Use two SKSpriteNodes:

  • One for the slider track.
  • One for the thumb (movable handle).

Track touchesMoved to update the thumb’s position and value. You can decorate the track and thumb with any images you like.

Toggle

Use two SKSpriteNodes:

  • One for the normal start.
  • One for the "toggled" state.

Respond to "mouse up inside" state to invert the toggle's state and value. You can customize what the normal and toggled state look like with your custom images.

image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages