Musical Staff and Notes centering

Hello guys,

I'm currently working on a project and I'm stuck at a very important part of it and as I just started getting into Processing I need your help.

I have to make a musical staff, which limits clickable area from line 1 to line five and the two edges of the stuff. Moreover, when you click above or on the middle(3rd line) of the staff a note with tail down appears and if you click bellow the middle a note with tail up appears.

My problem is that I cannot centre the notes right on the lines(2,3 and 4) or right in between the lines, in the gaps.

Any help would be much appreciated.

Code written so far:

final float dia = 22.0; //diameter of the circle of the note float tail = 63.0; //Note's tail length float x, y; void setup () { size(520, 160); smooth(); background(255, 255, 255); //5 music staff lines line(15, 36, 505, 36); line(15, 58 , 505, 58); line(15, 80, 505, 80); line(15, 102, 505, 102); line(15, 124, 505, 124); strokeWeight(9); strokeCap(PROJECT); //Makes edge(thick) lines squared at corners //Edge(thick) lines line(15, 40, 15, 120); line(505, 40, 505, 120); mouseClicked(); } void draw () { } void mouseClicked () { //Limits clickable area if ((mouseY < 47) || (mouseY > 113) || (mouseX < 32) || (mouseX > 488)) { noFill(); strokeWeight(2); } //Note tails down else if (mouseY <= height/2) { ellipse( mouseX, mouseY, dia, dia); line( mouseX + dia/2, mouseY, mouseX + dia/2, mouseY + tail); } //Note tails up else if (mouseY > height/2) { ellipse( mouseX, mouseY, dia, dia); line( mouseX + dia/2, mouseY, mouseX + dia/2, mouseY - tail); } } 
submitted by /u/geekthegreek
[link] [comments]

[PWC4] Whiteboard

Hello Everybody, this is the fourth Weekly Processing challenge, the challenges are decided just to give you a prompt to test your skills so it can be as simple or as complicated as you have time to write!

Start Date : 04-04-2016 End Date : 11-04-2016

Entries must be submitted with the [PWC4] In the Title of their post. Or post them in the comments here with the same tag.

This Weeks Challenge : Whiteboard , create a whiteboard which allows users to draw on it, you can add as many tools or color selectors and effects as you like. a simple start will be making a basic drawing on a white background , you may find it useful to use mouseX and mouseY here.

If you are here to learn feel free to ask for help in the comments below. Either you run the day or the day runs you, Joe

Winner from last week as decided by mods

Highest Voted : TBD

Interaction : TBD

Graphics : TBD

Accuracy : TBD

submitted by /u/seoceojoe
[link] [comments]

Gloom and broken windows. A time travel to Thatcher-era Glasgow

The Barbican in London has recently opened Strange and Familiar: Britain as Revealed by International Photographers, an exhibition exploring the way international photographers have been portraying the UK since the 1930s. The show was curated by Martin Parr. I’m quite the Parr fan so i raced there, expecting cheerfulness throughout the galleries. And I was certainly much entertained during my visit but i never expected to be moved to tears by one of the photo series.

fdrimnkdepardon1
Raymond Depardon, Glasgow, Scotland, 1980. © Raymond Depardon / Magnum Photos

SCOTLAND. Glasgow. 1980.
Raymond Depardon, Glasgow, Scotland, 1980. © Raymond Depardon / Magnum Photos

In 1980, the Sunday Times Magazine asked Raymond Depardon to go and photograph Glasgow. Depardon was a French war photographer who had just returned from civil war-torn Beirut. Yet he wasn’t ready for the scenes of poverty and desolation he found in Thatcher-era Glasgow. Rows of tall, dark council flats. Drunk men on wobbly legs. Broken windows. Raw poverty. Rain and so much grey skies. But also smiling guys, children playing and stylish mums. Still, his images was deemed too upsetting and Sunday Times Magazine never published them.

I knew that Glasgow used to have a bad reputation but to me, it’s the city of Charles Rennie Mackintosh, of lovely accents, contemporary art and the UK capital veganism. A tour of the city in the early 1980s shocked me beyond words.

red-car-photo-raymond-depardon-magnum
Raymond Depardon, Glasgow, Scotland, 1980. © Raymond Depardon / Magnum Photos

SCOTLAND. Glasgow. 1980.
Raymond Depardon, Glasgow, Scotland, 1980. © Raymond Depardon / Magnum Photos

Raymond-Depardon-Glasgow-1980-5
Raymond Depardon, Glasgow, Scotland, 1980. © Raymond Depardon / Magnum Photos

SCOTLAND. Glasgow. 1980.
Raymond Depardon, Glasgow, Scotland, 1980. © Raymond Depardon / Magnum Photos

8magasinsnd-depardon-magnum
Raymond Depardon, Glasgow, Scotland, 1980. © Raymond Depardon / Magnum Photos

autobleuM8dQJmq
Raymond Depardon, Glasgow, Scotland, 1980. © Raymond Depardon / Magnum Photos

SCOTLAND. Glasgow. 1980.
Raymond Depardon, Glasgow, Scotland, 1980. © Raymond Depardon / Magnum Photos

littleboy-1980-2
Raymond Depardon, Glasgow, Scotland, 1980. © Raymond Depardon / Magnum Photos

NpubsN11455863
Raymond Depardon, Glasgow, Scotland, 1980. © Raymond Depardon / Magnum Photos

unquartiero5_1280
Raymond Depardon, Glasgow, Scotland, 1980. © Raymond Depardon / Magnum Photos

SCOTLAND. Glasgow. 1980.
Raymond Depardon, Glasgow, Scotland, 1980. © Raymond Depardon / Magnum Photos

SCOTLAND. Glasgow. 1980.
Raymond Depardon, Glasgow, Scotland, 1980. © Raymond Depardon / Magnum Photos

SCOTLAND. Glasgow. 1980.
Raymond Depardon, Glasgow, Scotland, 1980. © Raymond Depardon / Magnum Photos

SCOTLAND. Glasgow. 1980.
Raymond Depardon, Glasgow, Scotland, 1980. © Raymond Depardon / Magnum Photos

pinkdressegirleee
Raymond Depardon, Glasgow, Scotland, 1980. © Raymond Depardon / Magnum Photos

Raymond-Depardon-Glasgow-1980-3
Raymond Depardon, Glasgow, Scotland, 1980. © Raymond Depardon / Magnum Photos

Raymond-Depardon-Glasgow-1980-6
Raymond Depardon, Glasgow, Scotland, 1980. © Raymond Depardon / Magnum Photos

SCOTLAND. Glasgow. 1980.
Raymond Depardon, Glasgow, Scotland, 1980. © Raymond Depardon / Magnum Photos

852602-man-reeling-and-green-bus-photo-raymond-depardon-magnum
Raymond Depardon, Glasgow, Scotland, 1980. © Raymond Depardon / Magnum Photos

depardon4mur
Raymond Depardon, Glasgow, Scotland, 1980. © Raymond Depardon / Magnum Photos

0litlegirls-Glasgow-by-Raymond-Depardon
Raymond Depardon, Glasgow, Scotland, 1980. © Raymond Depardon / Magnum Photos

SCOTLAND. Glasgow. 1980.
Raymond Depardon, Glasgow, Scotland, 1980. © Raymond Depardon / Magnum Photos

SCOTLAND. Glasgow. 1980.
Raymond Depardon, Glasgow, Scotland, 1980. © Raymond Depardon / Magnum Photos

More images online. Or in the freshly published book Glasgow, Raymond Depardon, préface William Boyd (amazon USA and UK.)

Strange and Familiar: Britain as Revealed by International Photographers, curated by Martin Parr, is at the Barbican in London until 19 June 2016.