GithubHelp home page GithubHelp logo

wordseek's Introduction

wordseek screenshot

WordSeek

A word search game implemented using modern web technologies, especially CSS flex box and SVG.

Try the live demo

Usage

Open wordseek.html in your favorite browser (testing on Chrome, Firefox, Safari and iOS)

History

The first implementation tried using only DIV elements to implement the grid. But making it scale on different devices (e.g. iPhone, laptop, iPad) proved hard: using font-size:1vw for example was a guessing game.

The second implementation used a CANVAS element: scaling it also scaled the characters drawn in the grid. But the font drawn on the CANVAS looked not as sharp as the words nearby. Even after taking into account the device pixel ratio to boost the size of the CANVAS on retina displays.

The current implementation draws the grid using an SVG element. Underneath each text, a small rectangle captures the mouse or touch events. Text elements are removed from the event loop using the CSS rule pointer-events:none. Without the rectangles behind each character, the event would not fire unless the mouse or finger was touching the glyph.

Solutions are added as invisible SVG lines under the text grid (so they appear below the text). When the user has found a word, CSS turns the visibility to 'visible'.

A neat CSS animation shows the number of words found in the current round. Again, the CSS pointer-events:none is used to prevent stealing events destined to the grid element underneath.

The CSS is responsive using media queries to detect device orientation and width.

crossword screenshot

CrossWord

Similar architecture, but with CSS animations of SVG elements, including removing classnames when the animations end. Also how to rotate and apply CSS animations to SVG elements requires modifying the transform-origin property.

Try the live demo

Usage

Open crossword.html in your favorite browser (testing on Chrome, Firefox, Safari and iOS)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.