Vanilla JS Tutorials

JsIso Tutorials

RSS feed

04 - Rotating JsIso Isometric Map

In this example we introduce the 'jsiso/canvas/Input' module. We apply an event listener for keyboard input and when the buttons Q or W is pressed we rotate. At this point we then clear the current drawn image and redraw from the rotated perspective.

    function(CanvasControl, TileField, imgLoad, CanvasInput) {

      // RGBA of color to use
      var tileColor = "(158, 154, 255, 1)";
      var groundColor =  "(100, 154, 100, 1)";

      // Our Tile Map
      var tileMap = [
        [groundColor, groundColor, groundColor, groundColor, groundColor, groundColor, groundColor],
        [groundColor, tileColor, groundColor, tileColor, groundColor, tileColor, groundColor],
        [groundColor, tileColor, tileColor, tileColor, groundColor, tileColor, groundColor],
        [groundColor, tileColor, groundColor, tileColor, groundColor, tileColor, groundColor],
        [groundColor, groundColor, groundColor, groundColor, groundColor, groundColor, groundColor]

      // Our Height Map 
      var tileHeightMap = [

      // X & Y drawing position, and tile span to draw 
      var xrange = 8;
      var yrange = 8;

      // use CanvasControl to create a simple canvas element
      // ID of Canvas,
      // width of Canvas,
      // Height of Canvas,
      // Optioanl: Any Style proprties we wish to apply,
      // Optional: The DOM ID location we wish to place the canvas in, otherwise it appends to Body
      var context = CanvasControl.create("canavas", 640, 640, {});

      var tileLayer = new TileField(context, CanvasControl().height, CanvasControl().width);

      var input = new CanvasInput(document, CanvasControl());  // Create our Input controls and pass through the CanvasControl to it
      input.keyboard(function(pressed, keydown) { // Pressed is the keycode of user input, and keydown means the button is down rather than press ended
        if (!keydown) {
          switch(pressed) {
            case 81:
              // Call draw Tile Map function
            case 87:
              // Call draw Tile Map function

      var images = [
          graphics: [
            "/img/game/ground/blank-block.png" // The images we want to load using imgLoader

      function drawTileMap() {
        // Clear drawn map before clearing
        context.clearRect(0, 0, CanvasControl().width, CanvasControl().height);
        // Loop through our tiles and draw the map  
        for (i = 0; i < 0 + xrange; i++) {
          for (j = 0; j < 0 + yrange; j++) {

      imgLoad(images).then(function(imgResponse) { // imgLoad uses Promises, once the images have loaded we continue and use the returned imgResponse

          layout: tileMap,
          isometric: true, // Flag used to layout grid in non isometric format
          tileHeight: 50,
          tileWidth: 100,
          heightMap: {
            map: tileHeightMap,
            heightTile: imgResponse[0].files["blank-block.png"], // imgResponse[0] contains the files[] we placed in the graphcis array for loading
            offset: 0
          shadow: {
            offset: 50, // Offset is the same height as the stack tile
            verticalColor: '(5, 5, 30, 0.4)',
            horizontalColor: '(6, 5, 50, 0.5)'

        // Rotate our entire Map 

        // Set an offset so our map is on screen
        tileLayer.setOffset(200, 100)
        // Call draw Tile Map function

Check out the View Source to see tutorial.
Q & W to rotate.

Tutorial Outcome (View & Run Source)


  1. Nice post! Thanks for sharing.

    — Neil Mon, 1 Apr 2019

  2. I have been looking for this information for a long time, I was very surprised when I found it here. Thu, 4 Apr 2019

  3. Would appreciate any link on a video for this tutorial. Im still learning things.

    screen repair melbourne fl Thu, 23 May 2019

  4. I would like to thank for the efforts you have made in writing this post. I am hoping the same best work from you in the future as well. candy crush soda saga

    — samuelddarden Wed, 29 May 2019

  5. air conditioning replace great post i wish more people would make comments on this.

    don king Sun, 9 Jun 2019

  6. tree service outstanding content! If i had a few more sites I would comment them. O wait.. I DO!
    Boom! bathroom remodeling company elkhorn ne
    seo for hvac companies
    iowa excavating company
    tow truck orlando fl
    ford dealer brevard county

    Ripmane Sun, 9 Jun 2019

  7. I have no a clear idea about this. If any one have more information and to like to share this then please post his/her comment. I am very thank full for this act of kindness. i will come back soon is you have more idea about this. 100% commission Tampa

    — Joshua A. Price Mon, 10 Jun 2019

  8. I have been longing to learn all of this since then.

    junkyard davie fl Tue, 25 Jun 2019

  9. This is dope. How did you do this?

    stamped concrete birmingham al Mon, 1 Jul 2019

  10. The layering techniques is quite simple but direct. Would love to try this techniques on my own.

    line markers perth Tue, 2 Jul 2019

  11. Your way of putting things together is admirable. Unfortunately, Im still quite in the dark about all of this so I'll prolly come back when I can contribute a more decent comment. tree service

    — fredluis Wed, 10 Jul 2019

  12. Thanks for sharing your knowledge with us! This is great. | Villa Bellissima

    — Daniel Mon, 15 Jul 2019

  13. Congratulate me for making a successful project because of your post! Hahaha! I can't thank you enough! :D

    nextride Tue, 23 Jul 2019

  14. We are really grateful for your blog post. You will find a lot of approaches after visiting your post. Great work tech blogs

    — tech blogs Wed, 24 Jul 2019

  15. Much thanks for composing such an intriguing article on this point. This has truly made me think and I plan to peruse more Okra

    — Okra Thu, 25 Jul 2019

  16. Much thanks for composing such an intriguing article on this point. This has truly made me think and I plan to peruse more Okra

    — Okra Thu, 25 Jul 2019

  17. I am a new user of this site so here i saw multiple articles and posts posted by this site,I curious more interest in some of them hope you will give more information on this topics in your next articles. Cucumber

    — Cucumber Thu, 25 Jul 2019

  18. I am a new user of this site so here i saw multiple articles and posts posted by this site,I curious more interest in some of them hope you will give more information on this topics in your next articles. Cucumber

    — Cucumber Thu, 25 Jul 2019

  19. Very nice blog and articles. I am realy very happy to visit your blog. Now I am found which I actually want. I check your blog everyday and try to learn something from your blog. Thank you and waiting for your new post. Lemongrass

    — Lemongrass Thu, 25 Jul 2019

  20. This is an excellent post I seen thanks to share it. It is really what I wanted to see hope in future you will continue for sharing such a excellent post. 13 Zodiac Signs

    — 13 Zodiac Signs Thu, 25 Jul 2019

  21. It proved to be Very helpful to me and I am sure to all the commentators here! Text Chemistry

    — Text Chemistry Thu, 25 Jul 2019

  22. After reading your article I was amazed. I know that you explain it very well. And I hope that other readers will also experience how I feel after reading your article. Brown Rice

    — Brown Rice Thu, 25 Jul 2019

  23. This is really very nice post you shared, i like the post, thanks for sharing.. Quinoa

    — Quinoa Thu, 25 Jul 2019

  24. This is a good post. This post gives truly quality information. I’m definitely going to look into it. Really very useful tips are provided here. Thank you so much. Keep up the good works Coconut Water

    — Coconut Water Thu, 25 Jul 2019

  25. I adore this tutorial , wonderful content material! super why! phonics fair

    — SAMS Thu, 1 Aug 2019

  26. After reading your article I was amazed. I know that you explain it very well. And I hope that other readers will also experience how I feel after reading your article. Mesa Locksmith

    — Mesa Locksmith Sat, 3 Aug 2019

  27. This is an excellent post I seen thanks to share it. It is really what I wanted to see hope in future you will continue for sharing such a excellent post. locksmith Atlanta

    — locksmith Atlanta Sat, 3 Aug 2019

  28. Thanks for sharing the code for the Rotating JsIso Isometric Map. This will be helpful for our Limited Liability Company.

    — Billy Martinez Mon, 12 Aug 2019

  29. Good day very nice site!! Man .. Excellent .. Wonderful .. electrician Orlando

    — Cassandra D. Everhart Tue, 20 Aug 2019

  30. Thanks for sharing these tutorials. I learnt a lot here and I'll always keep coming back for more tutorials.

    — Mike Double Tue, 20 Aug 2019

  31. Thanks for the effort you provide to share this post!
    Pensacola Emergency Towing Service

    — Mark Tue, 20 Aug 2019

  32. Op onze website vindt u verschillende types kamersteigers.
    Belangrijk is te weten wat de verschillen zijn tussen al dit aanbod.
    Allereerst belangrijk om te weten of de werkhoogte naderhand
    aangepast kan worden, bij sommige typen is dat mogelijk bij
    andere typen kamersteigers is dit absoluut niet mogelijk.
    Is het mogelijk om een luik te plaatsen of zijn de wielen
    aanpasbaar of te vervangen voor bijvoorbeeld andere ondergrond?
    Voordat u tot koop overgaat moet het gebruik van de steiger
    duidelijk zijn om teleurstellingen later te voorkomen!
    Daar koop u tenslotte geen steiger voor. Ons meest populaire
    merk voor dit artikel merk Euroscaffold met een werkhoogte
    van 3 meter, deze is uitbreidbaar en heeft meerdere opties! Verschil tussen kamersteigers

    — muneer ahmed Sat, 31 Aug 2019

  33. Bron: Wikipedia. Een touringcar is een luxueuze autobus, die
    gebruikt wordt voor personenvervoer over korte en grotere
    afstanden. Een tegenwoordige touringcar verschilt van een
    stads- of streekbus op onder meer de volgende punten:
    Er zijn meer zitplaatsen (meestal vier op een rij met
    een smal gangpad) terwijl een stadsbus vaak maar drie zit-
    plaatsen op een rij heeft en een breder gangpad. De
    inrichting van de bus is gericht op comfort.

    Onder in de bus is een grote bagageruimte gecreëerd. De bus
    is hierdoor hoger, en heeft derhalve een hoge instap.
    Met het oog op comfort (beter optrekken) zijn touringcars
    vaak uitgerust met een handgeschakelde versnellingsbak,
    hoewel tegenwoordig ook steeds meer touringcars met een
    goed afgestelde automaat worden uitgerust. Een moderne
    touringcar heeft vaak een toilet, een koelkast en
    dvd-(tv)-systeem. Er is een slaapcabine voor de chauffeur(s)
    voor met name buitenlandse lange ritten naar veelal vakantie-
    bestemmingen in Europa. Touringcarverhuur bedrijven worden
    veelal ingeschakeld voor groepsvervoer, zoals voor uitjes,
    grote evenmenten, jaarlijkse schoolreisjes en natuurlijk
    ook naar vakantiebestemmingen in het buitenland. Touringcar- en busverhuurbedrijven

    — muneer ahmed Tue, 3 Sep 2019

  34. Eigenlijk al jaren staat het contractvervoer binnen de taxibranche
    onder een hoge druk van bezuinigen. Daarnaast is hier een felle
    concurrentie van toepassing als het gaat om aanbestedingen.
    De taxibranche zet contractvervoer laag in om te overleven.
    Zij gaan liever aan het werk voor weinig geld dan dat zij
    een faillissement boven het hoofd hangt. Tevens voorkomen zij
    dat er zomaar naar een ander taxibedrijf wordt overgestapt
    aangezien de kosten al extreem laag zijn. Echter is deze methode
    wel gevaarlijk voor de taxiondernemers die hier op deze
    manier op inspelen inzake deze contracvervoer constructies. Taxibranche contractvervoer

    — muneer Tue, 3 Sep 2019

  35. Ons kattenhotel heeft een ruime buitenren met voldoende beschutting
    tegen zon, regen en wind. Binnen beschikt het kattenpension over
    vloerverwarming en alle ruimtes zijn voorzien van mechanische ventilatie.
    Comfortabel voor de gasten en een garantie voor een altijd schone
    en frisse omgeving. De buitenren is uiteraard volledig afgesloten
    zodat uw poes of kat niet kan ontsnappen. Buitenren voor katten

    — muneer ahmed Thu, 5 Sep 2019

  36. "Professor Peter Hajek concludeert dat de onderzoekers de vloeistof
    hebben oververhit bij en verdampen / roken e-sigaret. Bij normaal
    gebruik komt er geen formaldehyde vrij. Zijn conclusie: Wanneer je
    kip laat verbranden dan is het eten van de zwart verbrande korst
    kankerverwekkend. Echter kun je daarmee niet stellen dat de kip
    kankerverwekkend is. De komende jaren zullen ongetwijffeld nieuwe
    studies meer inzicht geven." Uitkomst Portlandonderzoek omstreden

    — muneer ahmed Sat, 14 Sep 2019

  37. This article is great! Continue the fantastic informations!

    — jake Wed, 18 Sep 2019

  38. Your writing style in fact is exceptional!

    — jake Wed, 18 Sep 2019

  39. You are making operating a blog looks simple and easy! angerofstickcoins

    — jake Wed, 18 Sep 2019

  40. Many thanks for your current fantastic post! I most certainly liked analyzing it.

    — jake Wed, 18 Sep 2019

  41. There should be at least one time in your life that you forget yourself for someone, asking for no result, no company, no ownership or even love me. Just ask for meeting you in my most beautiful years. gucci uk outlet gucci outlet christian louboutin shoes christian louboutin shoes ugg boots outlet ugg boots ugg boots cheap ugg boots valentino shoes valentino rockstud valentino outlet valentino outlet ray ban sunglasses ray-ban sunglasses ray-ban outlet ray ban outlet sac louis vuitton sac louis vuitton coach factory coach outlet online michael kors outlet online michael kors outlet louis vuitton outlet louis vuitton outlet coach outlet online ray-ban outlet ray ban sunglasses ray-ban outlet lunettes de soleil ray ban pas cher ray-ban outlet oakley outlet oakley sunglasses oakley outlet

    cheap ugg boots Mon, 23 Sep 2019

  42. This made this program super easy to implement. Thank you

    Homer of Towing company Parma Ohio

    — Homer Glenn Mon, 23 Sep 2019

  43. This is effortless. Thank you. Baytown HVAC

    Baytown HVAC Wed, 25 Sep 2019

  44. Honestly, I have no idea about this. I'm just read it. Houston Stamped Concrete

    Houston Stamped Concrete Wed, 25 Sep 2019

  45. This is the best tutorials I've read. Tree Services Pasadena

    Tree Services Pasadena Wed, 25 Sep 2019

  46. I think Google is awesome.. So glad I found this site.

    NYC Trees Fri, 27 Sep 2019

  47. I like this post,And I figure that they having a great time to peruse this post,they might take a decent site to make an information,thanks for sharing it to me.

    — mneer Sat, 28 Sep 2019

  48. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free. bitcoin canada

    — mumeer Mon, 30 Sep 2019

  49. Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with extra information? It is extremely helpful for me.

    ביטוח חיים Thu, 10 Oct 2019

  50. great post thank you so much for allowing us tow share our content here too : )

    North Florida Towing Mon, 28 Oct 2019

  51. Great article with excellent idea!Thank you for such a valuable article. I really appreciate for this great information.. ACL Pros

    — muneer ahmed Tue, 29 Oct 2019

  52. I am extremely delighted in for this web journal. Its a useful subject. It help me all that much to take care of a few issues. Its chance are so awesome and working style so rapid. flooring store

    — muneer ahmed Sat, 2 Nov 2019

  53. I want you to thank for your time of this wonderful read!!! I definitely enjoy every little bit of it and I have you bookmarked to check out new stuff of your blog a must read blog Umzugskosten Berlin

    — muneer ahmed Tue, 5 Nov 2019

  54. A fascinating dialog is value remark. I feel that it is best to compose more on this matter, it may not be an unthinkable theme however generally people are insufficient to chat on such subjects. To the following. Salud. numero de voyance gratuite

    — muneer ahmed Sat, 9 Nov 2019

  55. Needed this a lot. Thank you. I love all the useful info on your site!

    Our Company Mon, 11 Nov 2019

  56. Thank you so much! I was wondering how to rotate isometric in JS!


    Aubrey Graham Mon, 25 Nov 2019

  57. We really needed this to make our site sex in bayern much more interactive. Thanks for helping us with the problem

    sexbayern Mon, 25 Nov 2019

  58. Canada Goose Black Friday Sale , golden goose hi star , Lewis Hamilton Caps , air max 270 , Air Jordan Big Deal , Moncler Cyber Monday Deals , Golden Goose Sneakers Outlet , Golden Goose Slide , Golden Goose Mid Star , vans shoes , Converse Store , lewis hamilton hat , mercedes lewis hamilton hats , Air Jordan 1 Black Friday , Canada Goose Big Sales , Yeezy Boost Cyber Monday Deals , Philippe Model Shoes , Yeezy Boost Big Deal , Moncler Women Vests , Golden Goose Hi Star , air max 270 sale , Golden Goose Starter , nike shoes , Golden Goose Mid Star , golden goose uomo , Mercedes Lewis Hamilton Caps , golden goose mid star , Golden Goose Mid Star , golden goose hi star , Golden Goose Starter , Golden Goose Big Deal , Golden Goose Outlet , nike air max 270 , golden goose slide , golden goose mid star , moncler men coats , Converse Outlet , Sport Shoes On Sale , Converse Monochrome , Converse Leather Shoes , Golden Goose Superstar , Golden Goose Superstar , Golden Goose Outlet , Jordan Black Friday Sales , Philippe Model , Converse High Top , Moncler Big Deals , Golden Goose , air max 270 outlet , golden goose superstar , Air Jordan Big Sales , Air Jordan 1 55088-062 , Golden Goose Sneakers , moncler accessories , Lewis Hamilton Cap 2019 , golden goose v star , Golden Goose Starter , Moncler Black Friday Sale , Yeezy Boost , Sport Shoes , Golden Goose Superstar , Golden Goose , Philippe Model Man , air jordan shoes , Golden Goose Sneakers , moncler women jackets , Golden Goose Hanami , Golden Goose Shoes , Golden Goose Slide , golden goose hanami , Golden Goose , Philippe Model Sneakers , Moncler Men Jackets , Moncler Women Coats , moncler men jackets , golden goose starter , Converse Low Top , yeezy boost , golden goose mid star , golden goose v star , golden goose superstar , Yeezy Boost Black Friday Sale , Golden Goose Sneakers Sale , Golden Goose Francy , Golden Goose , Mercedes Lewis Hamilton Hat , Golden Goose Hi Star , Sport Shoes Sale , golden goose starter , Golden Goose Ball Star , golden goose ball star , Golden Goose Sneakers , golden goose francy , Golden Goose Sneakers , Mercedes Lewis Hamilton , new balance shoes , Golden Goose Black Friday Sale , Canada Goose Cyber Monday Deals , Lewis Hamilton Cap , Air Jordan 1 , Moncler Women Jackets , Yeezy Boost Big Sales , Converse 1970s , moncler women coats , Golden Goose Scarpe , golden goose v star , Golden Goose Sneakers , air max 270 , Moncler Big Deal , Moncler Big Sales , Golden Goose Sale , Golden Goose Cyber Monday Deals , Golden Goose Outlet , Jordan Black Friday Sale , Moncler Outlet , Golden Goose Big Sales , Moncler Outlet Store , Golden Goose Saldi , Moncler Men Vests , Mercedes Lewis Hamilton Cap , moncler men vests , golden goose francy , golden goose donna , golden goose hi star , golden goose slide , Golden Goose V Star , Golden Goose , golden goose francy , golden goose slide , golden goose starter , Converse Shoes , Air Jordan 1 Bloodline , Moncler Outlet Online , Converse Outlet , Golden Goose V Star , Moncler Men Coats , Golden Goose Sale , golden goose ball star , Golden Goose Francy , Golden Goose Ball Star , Golden Goose Sale , puma shoes , Golden Goose Hi Star , adidas shoes , Lewis Hamilton Hat , Golden Goose Francy , Golden Goose Sneakers , converse shoes , Converse Seasonal Color , mercedes f1 hat , Air Jordan 1 Meant To Fly , golden goose superstar , Canada Goose Big Deal , Sport Shoes Outlet , Philippe Model Woman , Lewis Hamilton Cap Collection , Golden Goose , Jordan Cyber Monday Deals , Golden Goose Slide , Philippe Model Sale , cheap air max 270 , Golden Goose Sale , Mercedes F1 Cap , moncler women vests , Golden Goose Outlet ,

    Golden Goose Mon, 2 Dec 2019

  59. With more and more interesting things to share and people to meet, websitesex niedersachsen is now one of the best places to chat and meet girls from niedersachsen

    sex niedersachsen Mon, 2 Dec 2019

  60. nice words man

    Josephcat Fri, 6 Dec 2019

  61. If you thirst for to watch gay porno in astonishing mark (and against relaxed), you came to the right hamlet! This online gay sextube is prospering to keep your voluptuous cravings at bay because we secure some of the hottest gay porn videos right here. - gay0day

    MariaLam Sun, 8 Dec 2019

  62. The layering techniques are fascinating. Thank you for this. Jerry | concrete stair repair chicago

    basement waterproofing rockford il Mon, 30 Dec 2019

  63. It's actually a story you tell after some time with your substance. As Sonia stated, your possibility is the legend of their own voyage, so now and then you're actually recounting to accommodating stories (like contextual investigations) and different occasions the story is essentially the adjustment in the possibility's life because of your substance and in the end item or administration.

    eHealtHow Sun, 5 Jan 2020

  64. Just what I needed. You're so wonderful. Will make sure to bookmark this site for future projects.

    mobile auto detailing victoria bc Sun, 5 Jan 2020

  65. What to do to stimulate sexual development and assurance that it is acceptable and beguiling? There are different proposition that all stars propose to achieve this target:

    BioVirexagen Thu, 16 Jan 2020

  66. Incredible! This blog looks exactly like my old one! It's on a totally different topic but it has pretty much the same layout and design. Wonderful choice of colors!| а

    должностная инструкция заведующего клинико диагнос Mon, 20 Jan 2020

  67. What a fantabulous post this has been. Never seen this kind of useful post. I am grateful to you and expect more number of posts like these. Thank you very much

    custom embroidered patches Sat, 25 Jan 2020

  68. Thanks for the blog post buddy! Keep them coming...

    Are chameleons good pets Mon, 27 Jan 2020

Please insert the result of the arithmetical operation from the following image:

Please insert the result of the arithmetical operation from this image. =