Home › Forums › JavaScript › Modify JS
- This topic is empty.
-
AuthorPosts
-
June 17, 2016 at 3:44 am #242982
X1AN36B0
ParticipantHey guys,
I’ve got this set up in which when you click anywhere on the canvas it reveals a new image. It’s pretty straightforward, just one image after the other.
I’d like to change that behavior a little bit. I’d like to have multiple stacks of images and have where you click matter.
It should behave like this: you start with a blank canvas just like now. when you click on the canvas for the first time it will reveal the 1st image of the 1st stack. from that point on if you click on an image you’ll get the next image from that stack while if you click on the canvas you’ll get the first image of next stack. I hope that wasn’t too confusing. :-)
Basically, if you click the canvas you’ll get the stacks and if you click the images you’ll get more images from that stack.
Is that too complicated?
I’m a JS n00b. :-(Thank you all very much for your help.
June 20, 2016 at 5:03 am #243014X1AN36B0
ParticipantNobody with some guidance? :-(
June 23, 2016 at 12:28 pm #243110X1AN36B0
ParticipantLooks like everybody’s gone on vacation… ✈️
My timing sucks! 😢June 24, 2016 at 3:20 am #243128Jerba
ParticipantYou’re not too far off what you’re trying to achieve…
Pretty much all you need to do now is; define some sequences of images, perhaps just using arrays.
Determine how the parameters of the click event impact the resulting sequence (maybe quadrants) and then any subsequent clicks simply get the next index in the array based on the amount of clicks since the sequence started and draw it to the screen.
June 24, 2016 at 4:55 am #243130X1AN36B0
ParticipantThanks for your advice Jerba. 👍
I kinda see what you mean, but unfortunately I don’t think I have enough JS knowledge to pull it off myself. 😞 Would you be able to help me out?
I forgot to mention this before, but I wouldn’t have only images. Some of the content would be text as well…
June 29, 2016 at 11:41 am #243260X1AN36B0
ParticipantNobody else?
July 1, 2016 at 6:21 am #243285Jerba
ParticipantPeople aren’t going to simply write the functionality for you, if you need this desperately then you may need to employ someone to build it for you.
Otherwise, I can help point you in the direction of some useful resources to help you build the basic functionality and improve your Javascript knowledge.
Javascript Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript
Javascript OOP Introduction: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Introduction_to_Object-Oriented_JavaScript
Event Listeners: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
I hope this helps!
-
AuthorPosts
- The forum ‘JavaScript’ is closed to new topics and replies.