P5 mouse click opens a link
How do I program moving to a new page after a mouse click without a hyperlink? I want to just draw a circle and if you click in the circle it takes you somewhere. I am working with P5.js
thanks
hyperlink p5.js
add a comment |
How do I program moving to a new page after a mouse click without a hyperlink? I want to just draw a circle and if you click in the circle it takes you somewhere. I am working with P5.js
thanks
hyperlink p5.js
add a comment |
How do I program moving to a new page after a mouse click without a hyperlink? I want to just draw a circle and if you click in the circle it takes you somewhere. I am working with P5.js
thanks
hyperlink p5.js
How do I program moving to a new page after a mouse click without a hyperlink? I want to just draw a circle and if you click in the circle it takes you somewhere. I am working with P5.js
thanks
hyperlink p5.js
hyperlink p5.js
asked Mar 22 '17 at 22:23
scen hjordscen hjord
113
113
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
your_circle.mouseClicked(window.open('http://your-link.com'))
Reference:
mouseClicked()
window.open()
add a comment |
Stack Overflow isn't really designed for general "how do I do this" type questions. It's for specific "I tried X, expected Y, but got Z instead" type questions. But I'll try to help in a general sense.
You have to split your problem up into smaller pieces. Then take on each of those smaller steps one at a time.
For example, step one might be creating a program that draws a circle. Now detect when the mouse clicks inside that circle. Don't worry about the link yet. Just print something to the console whenever the user clicks the circle.
Step two might be creating a program that opens a link when the user clicks anywhere in the sketch. Don't worry about the circle yet. Googling "JavaScript navigate to new page" or something like that would yield a ton of results.
When you get each of them working perfectly, then you can think about combining them into a single program. And if you get stuck on a specific step, post a MCVE along with a specific question, and we'll go from there. Good luck.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f42963752%2fp5-mouse-click-opens-a-link%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
your_circle.mouseClicked(window.open('http://your-link.com'))
Reference:
mouseClicked()
window.open()
add a comment |
your_circle.mouseClicked(window.open('http://your-link.com'))
Reference:
mouseClicked()
window.open()
add a comment |
your_circle.mouseClicked(window.open('http://your-link.com'))
Reference:
mouseClicked()
window.open()
your_circle.mouseClicked(window.open('http://your-link.com'))
Reference:
mouseClicked()
window.open()
edited Dec 29 '18 at 4:30
answered Dec 29 '18 at 2:24
Lucas LopesLucas Lopes
19614
19614
add a comment |
add a comment |
Stack Overflow isn't really designed for general "how do I do this" type questions. It's for specific "I tried X, expected Y, but got Z instead" type questions. But I'll try to help in a general sense.
You have to split your problem up into smaller pieces. Then take on each of those smaller steps one at a time.
For example, step one might be creating a program that draws a circle. Now detect when the mouse clicks inside that circle. Don't worry about the link yet. Just print something to the console whenever the user clicks the circle.
Step two might be creating a program that opens a link when the user clicks anywhere in the sketch. Don't worry about the circle yet. Googling "JavaScript navigate to new page" or something like that would yield a ton of results.
When you get each of them working perfectly, then you can think about combining them into a single program. And if you get stuck on a specific step, post a MCVE along with a specific question, and we'll go from there. Good luck.
add a comment |
Stack Overflow isn't really designed for general "how do I do this" type questions. It's for specific "I tried X, expected Y, but got Z instead" type questions. But I'll try to help in a general sense.
You have to split your problem up into smaller pieces. Then take on each of those smaller steps one at a time.
For example, step one might be creating a program that draws a circle. Now detect when the mouse clicks inside that circle. Don't worry about the link yet. Just print something to the console whenever the user clicks the circle.
Step two might be creating a program that opens a link when the user clicks anywhere in the sketch. Don't worry about the circle yet. Googling "JavaScript navigate to new page" or something like that would yield a ton of results.
When you get each of them working perfectly, then you can think about combining them into a single program. And if you get stuck on a specific step, post a MCVE along with a specific question, and we'll go from there. Good luck.
add a comment |
Stack Overflow isn't really designed for general "how do I do this" type questions. It's for specific "I tried X, expected Y, but got Z instead" type questions. But I'll try to help in a general sense.
You have to split your problem up into smaller pieces. Then take on each of those smaller steps one at a time.
For example, step one might be creating a program that draws a circle. Now detect when the mouse clicks inside that circle. Don't worry about the link yet. Just print something to the console whenever the user clicks the circle.
Step two might be creating a program that opens a link when the user clicks anywhere in the sketch. Don't worry about the circle yet. Googling "JavaScript navigate to new page" or something like that would yield a ton of results.
When you get each of them working perfectly, then you can think about combining them into a single program. And if you get stuck on a specific step, post a MCVE along with a specific question, and we'll go from there. Good luck.
Stack Overflow isn't really designed for general "how do I do this" type questions. It's for specific "I tried X, expected Y, but got Z instead" type questions. But I'll try to help in a general sense.
You have to split your problem up into smaller pieces. Then take on each of those smaller steps one at a time.
For example, step one might be creating a program that draws a circle. Now detect when the mouse clicks inside that circle. Don't worry about the link yet. Just print something to the console whenever the user clicks the circle.
Step two might be creating a program that opens a link when the user clicks anywhere in the sketch. Don't worry about the circle yet. Googling "JavaScript navigate to new page" or something like that would yield a ton of results.
When you get each of them working perfectly, then you can think about combining them into a single program. And if you get stuck on a specific step, post a MCVE along with a specific question, and we'll go from there. Good luck.
edited May 23 '17 at 12:10
Community♦
11
11
answered Mar 23 '17 at 2:10
Kevin WorkmanKevin Workman
33.7k53969
33.7k53969
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f42963752%2fp5-mouse-click-opens-a-link%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown