Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • CreatiCode
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

CreatiCode Scratch Forum

  1. CreatiCode Forum
  2. Knowledge Base
  3. 2D Blocks
  4. Slider Widget

Slider Widget

Scheduled Pinned Locked Moved 2D Blocks
1 Posts 1 Posters 753 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • CreatiCodeI Offline
    CreatiCodeI Offline
    CreatiCode
    wrote on last edited by admin
    #1

    Introduction

    You can add a slider widget to the stage to make it easy for the user to specify a value within a range that looks like this:

    s1.gif

     
    To do that, use the following block:

    201ed808-9dfb-4bff-bf4e-45556b68fbf1-image.png

     

    • X and Y: you can set the position of the center of the slide using the X and Y parameters.
    • Width: the width of the slider widget
    • Minimum and Maximum Values: You can set the value range of the slider to be between a minimum value (like 0) and a maximum value (like 100). As the user slides the knob on the slider, the value will stay within this range.
    • Name: give the slider a name so that you can refer to it later.

     
     

    Set a Slider’s Value

    You can set the value of the slider to a certain value after adding it. For example, this block would set the slider to the value of 50, in the middle between 0 and 100:

    cf55d8b2-d123-48ac-9da1-cc3ff3a1a009-image.png

     
     

    Read a Slider’s Value

    To read the value selected by the user, you can use the reporter block “value of widget”:

    91d8f2ff-392a-40aa-b9a0-c693bdacf72e-image.png

     
     

    When Slider’s Value Changes

    To handle the event that the user is sliding the knob of the slider, you can use the “when widget changes” block:

    50ef0528-6514-4500-bbfe-c235230b4c57-image.png

     
     

    Demo

    In this program, we create a slider between 0 and 180, and set its value to 90 initially. Whenever the user slides the slider, we would update the direction of the apple sprite using the value of the slider.

    slid.gif

    1 Reply Last reply
    0

    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

    With your input, this post could be even better 💗

    Register Login
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • CreatiCode