sign.js 2.1.2

SignScribe road signs for web pages

sign.js is a JavaScript library that draws SignScribe road signs in a web page, still or animated. Animated signs are drawn from their construction lines, then filled with their colours and legends. The artwork is the same as SignScribe Desktop exports.

Download
6.4 MB
Featured signs
51
Desktop layouts
126
AS 1743 templates
496
Built-in sequence, drawn live by sign.js
Playground

Try the options

Choose a sign and adjust its motion. The configuration below updates as you change the settings and can be pasted into your page.

LoadingClick the sign to draw it in again.

Configuration

Only the settings that differ from the defaults.

Templates

Edit a template

Choose a Desktop layout or an AS 1743 template, type new legends and change colours, then copy the code or download the sign. Signs exported from SignScribe Desktop with Export › sign.js can be opened here too.

126 Desktop layouts496 AS 1743 templatessign.js 2.1.2

Choose a signDrop a SignScribe .signjs.json file here.

Code for your page

Works with the downloaded sign.js. A sign opened from a Desktop export is loaded from its own file.

Library

Sign library

The signs built into sign.js, drawn live. Select a sign to open it in the playground.

Direction, lane and information signs exported from the SignScribe Desktop layout engine, with their roads, arrow endings, legends and borders.

Animation is illustrative

Moving signs are for presentation. The static face exported by SignScribe is the governing artwork. Design and review signs in SignScribe Desktop, then export them as sign.js packages for the web.

Usage

Getting started

sign.js has no dependencies. Add the script, give the sign an element with a size, and call signJS with the element's id.

  1. Add sign.js and a sized element

    Every sign on this page is in the downloaded file. Give the sign an element with a size and call signJS with its id.

    <div id="sign" style="width:320px;height:320px"></div>
    <script src="sign.js"></script>
    <script>
      signJS("sign", { sign: "DIR-ROUNDABOUT" });
    </script>
  2. Show a Desktop layout

    The 126 SignScribe Desktop layouts are shown by their template code.

    signJS("sign", { sign: "G1-5" });
  3. Change the legends of an AS 1743 template

    Any of the 496 AS 1743 templates with editable legends. New text is set in the template's road series and letter height.

    signJS("sign", { sign: { template: "R4-1B", legends: ["80"] } });
  4. Show a sign designed in Desktop

    In SignScribe Desktop, choose Export › sign.js, then load the exported package.

    signJS.load("sign", "my-sign.signjs.json");
  5. Play a sequence

    Each sign draws out before the next draws in.

    signJS("hero", { mode: "sequence",
      signs: ["DIR-ROUNDABOUT", "TOUR-WHALES", "SVC-AHEAD"] });
  6. Control the instance

    The instance can be driven from your own controls.

    var sign = signJS("sign", { sign: "W7-4B" });
    sign.pause(); sign.seek(2.5); sign.play();
    sign.on("sign", function (e) { console.log(e.code); });
Options

Options reference

Every option has a default, so a sign works without settings. The playground generates the configuration for you.

OptionDefaultDescription
sign"DIR-ROUNDABOUT"The sign to show: a code from signJS.list(), a template with new legends such as { template: "R4-1B", legends: ["80"] }, or a sign exported from SignScribe Desktop.
animatetruefalse draws the sign still, at its finished face.
mode"single"single shows one sign; sequence moves through signs, each one drawing out before the next draws in.
signs[]The sign codes for sequence. Empty uses the whole library.
motion.speed1Playback speed. 0 holds every sign still.
motion.energy1How far a pictograph moves: 0 is the published artwork, 1 the designed motion.
transition.intro1.7Seconds to draw a sign in: construction outlines first, then the colours.
transition.outro1.0Seconds to draw a sign out before the next one replaces it.
transition.drafttrueShow the construction outlines and centre lines while a sign draws in and out.
sequence.hold5.5Seconds each sign holds in a sequence before it leaves.
fit.padding0.08Space around the sign, as a fraction of the element.
interactivity.click"replay"Clicking a single sign draws it in again. "none" turns it off.
interactivity.hover"none""play" animates the sign only while the cursor is over it.
theme.mode"auto"Follows data-theme on the page, then the system setting, for the construction-line colour. The sign artwork does not change with the theme.
performance.fps_limit60Frame rate cap. Animation pauses off screen, in background tabs and for visitors who ask for reduced motion.
API

API reference

Functions on signJS, and methods on the instance that signJS() returns.

signJS
FunctionDescription
signJS(element, options)Draws a sign in an element (or element id) and returns its instance.
signJS.use(url)Loads an extra sign package from a URL. Not needed for the signs in the downloaded file. Returns a promise.
signJS.load(element, url)Loads a sign.js package exported from SignScribe Desktop and draws it.
signJS.register(package)Registers an exported package you have already fetched. Returns its sign code.
signJS.list(filter)Lists the registered signs, optionally filtered by group name or function.
signJS.get(code)Returns one sign: code, name, group, size in millimetres and motion.
signJS.legends(code)Lists the legends of a template with their road series and capital height.
signJS.colours(code)Lists the colours used by a sign.
signJS.edit(code, changes)Registers a copy of a template with new legends or colours. Returns its code.
signJS.svg(code)Returns the finished sign face as an SVG in millimetres.
signJS.package(code)Returns a sign as a portable package for signJS.register.
signJS.core.render(ctx, code, options)Draws a sign into your own canvas context at time t, inside box.
Instance
MethodDescription
show(code)Draws the current sign out and the given sign in.
next() · prev()Moves through a sequence.
replay()Draws the current sign in again.
set(options)Changes options on the running sign, such as { motion: { speed: 0.5 } }.
pause() · play() · seek(seconds)Controls playback.
on(event, handler)Listens for events; "sign" fires when a new sign starts.
current()Returns the sign being shown.
export()Returns the instance configuration.
destroy()Stops the sign and removes its canvas.
Download

sign.js 2.1.2

One JavaScript file with no dependencies. It contains the sign.js runtime, the 51 featured signs, the 126 SignScribe Desktop layouts and the 496 AS 1743 templates, so every sign on this page is available as soon as the file loads.

The runtime code is released under the MIT licence. The sign artwork, symbols and road lettering belong to SignScribe and may be used to display SignScribe signs.

Download sign.js6.4 MB · version 2.1.2
Contact

Contact the SignScribe team

Ask for a demonstration or a trial, or tell us about a project.

Fields marked * are required. Do not include passwords, licence keys or confidential project data. Sending opens your email program with the enquiry ready to send.

Enter your name.
Enter a valid email address.
Enter a subject.
20 to 4,000 characters.Write at least 20 characters.