yejin shin
yejin shin

Reputation: 9

Use mousePressed() function in p5js

//stroke weight
let strokeweight_driver = sin(millis()/300)
stroke_weight = map((strokeweight_driver), -1, 1, 5, 8)
stroke("black")
strokeweight(stroke_weight)
circle(20,30,20)

I want to make this strokeweight of circle in 20, when I click the screen. So I decided to use a mousePressed function and type a stroke_weight = 20 but it doesn't work. What should I do? p.s. English is not my mother language so there're might be has a wrong sentence. Please understand me.

Upvotes: 0

Views: 84

Answers (1)

Nick Ven
Nick Ven

Reputation: 91

There is no strokeweight() function. It's strokeWeight(). Try this:

stroke_weight = map((strokeweight_driver), -1, 1, 5, 8)
stroke("black")
strokeWeight(stroke_weight)
circle(20,30,20)```

Upvotes: 1

Related Questions