Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slider doesn't work #58

Open
bensk opened this issue Jun 5, 2016 · 3 comments
Open

Slider doesn't work #58

bensk opened this issue Jun 5, 2016 · 3 comments

Comments

@bensk
Copy link

bensk commented Jun 5, 2016

This works in p5:

var x
var y
var speed
var slider;

function setup() {
  createCanvas(windowWidth, windowHeight)
  x = windowWidth/2
  y = 30
  speed = 3
    // create a slider we can drag, from -30 to 30 and starting at 0
  slider = createSlider(-30, 30, 0);
  // set the position of the slider on the screen
  slider.position(windowWidth / 2-90, 90);
  // set the size of the slider
  slider.style('width', '180px');
}

function draw() {
  // We need to make a variable for the slider's value...
  var speed = slider.value();
  background('white')
  textSize(32)
  text("🤖", x, y)
  // ... so that we can move the robot
  x = x + speed
}

but in the widget I get

Line 12: Uncaught ReferenceError: createSlider is not defined

@toolness
Copy link
Owner

toolness commented Jun 5, 2016

Thanks for the bug report!

Unfortunately, this is due to #53 being unresolved: createSlider() is part of p5.dom, and the widget doesn't currently include that library in the iframe that it executes the widget snippet in.

Do you need this functionality soon or is it not a high priority for you?

@bensk
Copy link
Author

bensk commented Jun 5, 2016

Thanks for the fast reply!

I'm teaching a bunch of 8th graders about p5.dom tomorrow, but I can have them copy and paste code into the editor.

BTW, your widget has been invaluable for teaching, so thank you!

@toolness
Copy link
Owner

toolness commented Jun 5, 2016

Oh that's awesome--I love the heading OM DOM DOM 😁

Thanks, I'm glad you find the widget useful!! Unfortunately I don't have time to add support for p5.dom by tomorrow, but I will definitely prioritize it highly as I continue work on the widget.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants