21 top examples of JavaScript

12. Design Matters

JavaScript examples design matters

The Design Matters site has a continually colour-shifting gradient background

Design Matters is a radio show launched by Debbie Millman in 2005. Over the years, Millman has interviewed over 200 designers, artists and creatives around the world. These are now housed on a beautifully redesigned site.

The first thing you notice is the morphing gradient background, which is subtle yet unique and mesmerising. The next thing you notice when you jump into an interview page is the enormous play icon overlaying the content.

"From the beginning I knew I wanted to have a giant play button on the screen, and after playing around with the design I settled on a completely transparent button," says Armin Vit of UnderConsideration, the studio behind the site. "Since the interviews are all about transparency between Debbie and her guests, I enjoyed the visual extension of that."

Vit used JS layout library Masonry to create a Pinterest-like grid of interview 'pods', each of which contains a well thought-out type hierarchy and image. As the audio is housed on SoundCloud, Vit had to figure out how to make the play button trigger a SoundCloud file via its unique ID.

What does Millman think of the site? "Armin took all the myriad must-haves for this site and created one design for me to look at," she smiles. "I loved it the second I saw it."

13. Wrap Genius

JavaScript examples Wrap Genius

Food data

NYC-based designer and developer Sam Slover and team set out on a mission to document what he ate for 10 weeks, and created an interesting visual look into his diet.

"We wanted to tell the story of one person trying to figure out how to make his personal food data more meaningful," says Slover. "So we took the audience on a journey: what does it mean to track your own food data and what insights can come of it?"

The result of his data-gathering is a one-page site that houses a beautiful collection of infographics. "It turns out there was quite a bit of data to design around," he smiles. "We needed to make hard decisions about which areas to pursue when doing visualisations."

Along with outlining what food was purchased, the team chose to focus on representing where the food came from, the ingredients, and an awards system where the best and worst foods were rated.

The team used Illustrator to develop the visuals, and Chart.js and D3.js to render some of the charts. While the site's layout is simple, don't be fooled – some serious number crunching went on behind the scenes, with the aid of a Node.js and MongoDB stack.

14. The Local Palette

JavaScript examples The local palate

Fuzzco took inspiration from the print version of this publication

The local Palate is the South's premiere food culture magazine. In redesigning the site, the team at Fuzzco took its cues from the print magazine. "We started with a grid structure similar to the one similar found throughout the magazine," says Fuzzco founder and creative director Helen rice. "For the typography we took a bold, modern approach and allowed space for large, engrossing photographs to reflect the engaging feeling found in print." The navigation also mimics the look of the spine of the magazine.

The site's stunning food photography and striking typography are arranged in a refreshingly simple layout that is a pleasure to view on any device. The recipe grids and full article pages are especially beautiful.

To build the site, the team used the – as they put it – "usual suspects" of jQuery, Sass and Typekit to serve the type. WordPress was selected to give editors flexibility in how the content is presented.

"We set up a system for editors to change the colour of some of the homepage elements to represent the current feature article," continues rice. "This creates the same effect as a new magazine cover."

15. Mike Kus

JavaScript examples Mike Kus

The portfolio of designer Mike Kus presents his stunning work in a refreshingly clean and understated manner

Here designer Mike Kus presents his stunning work in a refreshingly clean and understated manner, in which large images live alongside simple user interface elements. Bold dashes of colour come through from the portfolio items themselves, rather than from unnecessary decorative elements.

"I think of my work as the brand, hence there was no need to add a lot of style to the actual site [or its] UI," says Kus.

The website is fully responsive and equally easy to navigate on larger and smaller screens. What makes the site such a pleasure to explore, however, is the image selection: each portfolio item uses strong, carefully selected imagery that make you want to see more of the project.

Kus notes that "one of the main issues was making sure the site had the same visual impact across all viewport sizes" – and in our opinion, it certainly does.

16. Multeor

Top examples of JavaScript

Multeor is written in plain JavaScript using HTML5 Canvas

Multeor is a multiplayer web game developed by Arjen de Vries and Filidor Wiese and designed by Arthur van 't Hoog. The idea of the game is to control a meteor crashing into earth. You score points by ensuring you leave the biggest trail of destruction. Up to eight players can connect to a single game simultaneously.

Multeor is written in plain JavaScript using HTML5 Canvas and backed with a Node.js server to manage the communications between the desktop and mobile devices using WebSockets.

Rather than using one of the many game libraries, Wiese built entirely from stratch. "We decided not to use a prefab game engine," he says, "which means rendering the graphics, detecting collisions, keeping track of entities and coding a particle system for the explosions. Not depending on a specific game engine was great fun: it gave us a lot of creative freedom and we definitely learned a lot because of it."

17. Here Is Today

Top examples of JavaScript

Here Is Today required a small amount of JavaScript to put the animation in place

Here is Today was created by designer Luke Twyman. He explains the motive behind the site: "Being fascinated by the scale of time, I wanted to create something that would clearly give people a sense of that vastness, and a feeling of where we sit in relation to all that's gone before. To do this, two important features on the technical side would be some kind of zooming/scaling mechanic, and also a super clean layout."

Twyman kept all widths relative to make the site's message convey equally well on a smaller screen: "From the start I decided to do away with pixel measurements and pt sizes for type, and instead set my own measurement unit based on a fraction of the screen width. I set one unit to be 1/22 of the screen width and positioned and scaled everything using that unit, so the spacious layout would be maintained on different displays."

It took just a small amount of JavaScript to put the animation in place: "The zoom mechanic is based on a simple tween animation formula, which I've used numerous times now, although I'd never used it in JS before. In fact this is only the second thing I've built using JS, but I've found the transition from other languages I've used or tried to be fairly easy, and there's plenty of great documentation at hand online."

18. The Trip

Examples of JavaScript

The Trip is an interactive film with audio, powered entirely through JavaScript and HTML5

The Trip is an interactive film with audio, powered entirely through HTML5 and JavaScript (with Flash nowhere to be seen). The complexity of the project proved challenging, as developer Otto Nascarella explains. He says, "Most of the difficulties we had during the development process were due to the lack of cross browser/devices consistency of HTML5 new technologies, so it was decided we'd 'recommend' Chrome for a better experience on desktops," he says.

"The JavaScript code uses jQuery for almost everything - even though I flirted with the possibilities of using Zepto - I wrote two plugins for jQuery, [used] TextBlur to animate blur on fonts using text-shadow, that did not get used the end, and also TextDrop, the one that is responsible for the typographic animations."

19. MapsTD

Examples of JavaScript

MapsTD harnesses the power of Google Maps for an immersive gaming experience

MapsTD is a tower defence game, but with a difference. You tell it where your home is, and through the power of Google Maps, it will produce a game in which you're defending your hometown, with the baddies relentlessly charging past the streets and houses of your neighbourhood.

Creator Duncan Barclay explains how it works. "It's obviously built using the Google Maps API, with MooTools being used for the other aspects of the UI and as a general-purpose JavaScript library. It uses several bits of functionality provided by Google Maps. As well as the map itself, the biggest part is the route finder API, which is used to work out the paths the enemies follow. Once you've picked a start location, it does a lookup to get the latitude and longitude. It then looks for four routes by adding or subtracting a fixed number from that latitude and longitude (to get a point due north, due east, and so on), and uses Google to find a path between the two."

Creeps

As the game progresses, more enemies (or 'creeps' as he has called them) appear on screen. Barclay found himself battling to keep performance high and timings correct: "One of the biggest challenges – one that still isn't quite right - was the timing. Firstly, if the page isn't active, most browsers reduce how often they check if timeouts have reached the end, resulting in creeps moving in bursts rather than moving steadily. I ended up fixing that by pausing the game when the tab loses focus. The detection code was taken from David Walsh's blog and is in the game credits.

"The other problem was that as you progressed, there were too many things happening, which resulted in the game slowing down a lot. The workaround ended up being to use harder creeps rather than more of them, and making the game incrementally more difficult each level after level 50."

20. Command and Conquer

Examples of JavaScript

Command & Conquer is back, and it's online, thanks to Aditya Ravi Shankar

This is an amazing example of how powerful today's tools are. Aditya Ravi Shankar has used them to create an online version of classic real-time strategy game Command and Conquer.

Recreating the original 1995 game was a long and painstaking process, says Shankar. "Every little thing took time - things like selecting single units or multiple units; being able to select by drawing the box from left to right or from right to left; making sure the panning was smooth; figuring out a decent fog of war implementation; allowing for building construction, dependencies (the Power Plant is needed for the Refinery, which is needed for the Factory) and building placement (buildings cannot be constructed on top of other buildings); and depth sorting when drawing so units could move behind buildings and trees."

It's only when the development tasks are itemised in this way that you realise just how much work went into the project, including some very complicated logic - making it even more impressive that the entire thing could be achieved using only HTML5 and JavaScript.

Examples of JavaScript

Peanut Gallery is a project from the Google Creative Lab

Peanut Gallery is a project from the Google Creative Lab. Valdean Klump, a producer at the Lab, explains the concept. "The Peanut Gallery is a Chrome experiment that lets users add intertitles to silent film clips by talking to their browser," he says.

"The technology behind it is Google's Web Speech API, a JavaScript API that lets developers integrate speech recognition into their web apps." The project does a good job of demonstrating the Web Speech API, which displays live text updates as it tries to understand a human's speech.

"One of our favourite features of the API is that text updates in real time while you speak," Klump continues. "For example, if you say 'European Union' slowly, you can watch as the API begins by printing 'your' or 'year' and then corrects it to 'European Union'. "Another neat feature (for English speakers only at this point), is punctuation. Say 'question mark', 'exclamation point', 'comma', or 'period' and the API will insert the correct punctuation for you," adds Klump.

These examples of JavaScript were originally published in net magazine.

Related articles: