• Stars
    star
    287
  • Rank 143,540 (Top 3 %)
  • Language
    TypeScript
  • License
    Other
  • Created almost 6 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Web components for making creative tools more accessible.

Creatability Accessible Web Components

Creatability is a set of experiments made in collaboration with creators and allies in the accessibility community. They explore how creative tools – drawing, music, and more – can be made more accessible using web and AI technology. We hope they inspire others to make new projects, so we've started open-sourcing components here for anyone to use. Note this repo is under development. Contributions welcome!

using input tracking

Basics

Copy the packaged file in dist/acc-components.js into your html file and you will receive the following HTML elements:

  • <acc-button> - standard button
  • <acc-content> - a container for main content. Easily pairs with inputs such as <acc-pose-input> and displays webcam for using body as cursor input.
  • <acc-group> - a group of UI controls
  • <acc-input-mode-select> - used to select the current input method (i.e. mouse/keyboard/touch or body pose).
  • <acc-item> - data used to populate an <acc-select> dropdown or an <acc-radio-group>.
  • <acc-mouse-input> - an input that combines mouse/keyboard/touch into one normalized input.
  • <acc-optgroup> - similar to <optgroup> a method of nesting within an <acc-select>
  • <acc-pose-input> - an element providing easy tracking of a selected body part to use as a cursor input.
  • <acc-radio-group> - a group of radio buttons
  • <acc-range> - a slider / range element
  • <acc-select> - a select / dropdown element
  • <acc-side-panel> - collapsable panel that you can place UI components in, also includes tabbable "skip to content" shortcut.
  • <acc-slide> - data to use as a slide within <acc-slideshow>
  • <acc-slideshow> - a slideshow with next/previous navigation
  • <acc-snackbar> - a floating temporary UI notification system. Ideal for use with ARIA-LIVE.
  • <acc-toggle> - similar to a checkbox

Usage

A simple example of including the library then supporting mouse/keyboard and body tracking inputs.

    <body>
        <!-- webcomponents-loader loads polyfills only for browsers not supporting Shadow DOM -->
        <script src="//cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/2.0.2/webcomponents-loader.js"></script>
        <script src="dist/acc-components.min.js"></script>

        <acc-input-mode-select>
            <acc-mouse-input amplification="10"></acc-mouse-input>
            <acc-pose-input smoothing="0.5" selected></acc-pose-input>
        </acc-input-mode-select>

        <script>
            const inputSelector = document.querySelector('acc-input-mode-select');

            // all of the input's events bubble up to the selector
            inputSelector.addEventListener('input', function onInput(event){
                const input = event.target;
                // position mapped to the content's coordinate space
                // by default this is document.body, it can be set to any
                // element with inputSelector.contentElement = htmlElement;
                // or <acc-input-mode-select contentselector="#content">
                // exists on individual inputs as well
                const x = input.contentX;
                const y = input.contentY;
            }
        </script>
    </body>

In pure JavaScript these elements behave like normal HTMLElement's:

const input = document.createElement('acc-pose-input');
//or use document.querySelector('acc-pose-input')

input.addEventListener('input', (event)=>{
    console.log(event.target.position);
});

//this triggers the loading and initialization of any resources
input.initialize();

Input Event Cycle

All input types dispatch the following events:

  • 'initializing' when the input begins to load and initialize any necessary resources.
  • 'ready' when the input has completed initializing and is now operating
  • 'input' dispatched every time the input has a new value
  • 'stop' dispatched if the input has stopped such as by switching inputs or calling input.stop().
  • 'change' dispatched when an attribute/property changes values

Side Panel and Content

Quickly scaffold an application with a collapsable sidebar and content area that resizes accordingly and can display webcam when in use.

<acc-side-panel label="My Application">
    <acc-group>
        <acc-input-mode-select contentselector="#main-content">
            <acc-mouse-input amplification="10" enablekeyboard></acc-mouse-input>
            <acc-pose-input amplification="3" multiplier="1.01" smoothing="0.75" part="nose"></acc-pose-input>
        </acc-input-mode-select>
    </acc-group>
</acc-side-panel>

<!-- mounted attribute tells the element to be fullscree minus side-panel width -->
<acc-content id="main-content" webcamopacity="0.25" grayscale mounted>
</acc-content>

Snackbar

Snackbar is meant to be a temporary notification UI. Snackbar is ideal for ARIA Live Regions. To use as a Live Region YOU must add the aria-live attribute to the element directly in the HTML. When its message changes (or show() is invoked) it will display for its set duration in seconds. Typically there is only one per application, the code below is for demonstration purposes.

<acc-snackbar id="snackbar-1" duration="5" aria-live="polite" dismissable>
    <strong>Example 1</strong> will show for 5 seconds every time this content changes or until "DISMISS" is clicked
</acc-snackbar>

<acc-snackbar duration="0" aria-live="assertive" dismissable error>
    <strong>Example 2</strong> will show up indefinitely until "DISMISS" is clicked and will be styled boldly as an error alert.
</acc-snackbar>

<acc-snackbar aria-live="polite">
    <strong>Example 3</strong> will show up for 4 seconds every time its content changes.
</acc-snackbar>


<script>

    setTimeout(function() {
        // changing a snackbar's content will trigger it to show up again
        // and with aria-live it will be read by screen readers when changed
        const snack1 = document.querySelectorAll('#snackbar-1');
        snack1.innerHTML = `
            <img alt="A heart icon" src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/c8/Love_Heart_symbol.svg/1000px-Love_Heart_symbol.svg.png" width="32">
            <div style="display: inline-block; transform: translate(0, -50%); padding-left: 8px;">
                <strong>Example 1 updated</strong> this changed message will get read by screen readers.
            </div>`;
    }, 10000);

</script>

Tutorial

The tutorial element gives you a simple slide show. It extends AbstractModal so it can be added to the screen by adding an "open" attribute. Each of the <acc-slide> children will be rendered as a slide-show.

<acc-tutorial>
    <acc-slide
        video="assets/s1.mp4"
        alt="don't forget to add alt text for the video"
        caption="This experiment lets you combine speech and music in a fun way."></acc-slide>
    <acc-slide
        caption="Just type some words, then set them into your own melody."
        video="assets/s2.mp4"></acc-slide>
    <acc-slide
        caption="You can change the melody using your mouse or keyboard."
        video="assets/s3.mp4"></acc-slide>
    <acc-slide
        caption="Just play around – try different voices, scales, and more."
        video="assets/s4.mp4"></acc-slide>
</acc-tutorial>

Contributors

This is not an official Google product

More Repositories

1

anypixel

A web-friendly way for anyone to build unusual displays
C
6,437
star
2

quickdraw-dataset

Documentation on how to access and use the Quick, Draw! Dataset.
6,092
star
3

teachable-machine-v1

Explore how machine learning works, live in the browser. No coding required.
JavaScript
3,848
star
4

coder

A simple way to make web stuff on Raspberry Pi
JavaScript
2,425
star
5

open-nsynth-super

Open NSynth Super is an experimental physical interface for the NSynth algorithm
C++
2,419
star
6

chrome-music-lab

A collection of experiments for exploring how music works, all built with the Web Audio API.
JavaScript
2,127
star
7

aiexperiments-ai-duet

A piano that responds to you.
JavaScript
1,631
star
8

teachablemachine-community

Example code snippets and machine learning code for Teachable Machine
TypeScript
1,488
star
9

paper-signals

Build your own voice controlled object.
C++
742
star
10

aiexperiments-drum-machine

Thousands of everyday sounds, organized using machine learning.
JavaScript
736
star
11

Sprayscape

Sprayscape is a perfectly imperfect VR-ish camera. It is an open source Android app released on the Android Experiments platform.
Objective-C
568
star
12

teachable-machine-boilerplate

Boilerplate code for Teachable Machine
JavaScript
504
star
13

aiexperiments-giorgio-cam

Take a picture to make music with the computer.
JavaScript
481
star
14

aiexperiments-bird-sounds

Thousands of bird sounds visualized using machine learning.
JavaScript
474
star
15

ar-drawing-java

A simple AR drawing experiment build in Java using ARCore.
Java
415
star
16

inside-music

Inside Music lets you step inside of a song, seeing its individual pieces to give you a closer look at how music is made.
JavaScript
384
star
17

meter

Meter is a data-driven wallpaper that displays your battery, wireless signal and notifications
Java
362
star
18

digital-wellbeing-experiments-toolkit

Code components for starting your own Digital Wellbeing experiments
Kotlin
341
star
19

giantemoji

JavaScript
313
star
20

morse-learn

A fun little web app to help you learn Morse code on Gboard.
JavaScript
284
star
21

alto

Explore the basics of machine learning by building your own teachable object at home.
Python
278
star
22

aiexperiments-sound-maker

Make unusual new sounds with machine learning.
JavaScript
255
star
23

justaline-android

The first cross-platform collaborative AR app (for doodling)
Java
252
star
24

shadercam

Simple OpenGL Shaders with the camera2 apis in Android 5.0+
Java
240
star
25

posenet-sketchbook

PoseNet Sketchbook is a collection of open source, interactive web experiments designed to allude to the artistic possibilities of using PoseNet (running on tensorflow.js) to create a relationship between movement and machine.
JavaScript
207
star
26

arexperiments-portal-painter

Doodle new worlds onto your own, with Google ARCore.
C#
198
star
27

beat-blender

Blend beats using machine learning to create music in a fun new way.
JavaScript
190
star
28

coder-projects

Fun projects and sneakily educational things that can all be made with Coder and Rasberry Pi.
CSS
188
star
29

landmarker

Orientation, GPS, and Places enabled Android Experiment
Java
180
star
30

webvr-musicalforest

Join users from around the world in a musical forest. A WebVR Experiment.
JavaScript
164
star
31

balloon-pop

A multiplayer geospatial experience
C#
163
star
32

melody-mixer

A fun way to explore music using machine learning.
JavaScript
153
star
33

lipswap

Replace sections of a photo with your own recorded video.
Java
142
star
34

norman-ar

Decorate your world with AR animations.
C++
136
star
35

justaline-ios

The first cross-platform collaborative AR app (for doodling)
Swift
120
star
36

quickdraw-component

Use any of the of the 50 million Quick, Draw! doodles in your web-based project with one line of markup
JavaScript
104
star
37

creatability-seeing-music

Experience music visually.
JavaScript
101
star
38

semi-conductor

Semi-Conductor allows you to conduct a virtual orchestra using only your web browser & webcam.
JavaScript
100
star
39

tunnelvision

Distort your surroundings through a collection of transformative filters
Java
93
star
40

lines-of-play

Design domino art creations that interact with the real world using the ARCore Depth API.
C#
89
star
41

project-oasis

A voice controlled terrarium that recreates outside weather inside a box
JavaScript
89
star
42

access-mars

JavaScript
82
star
43

tiny-motion-trainer

Train and test machine learning models for your Arduino Nano 33 BLE Sense in the browser.
JavaScript
79
star
44

mystery-animal

A new spin on the classic 20-questions game.
JavaScript
79
star
45

mix-lab

MixLab is an experiment that makes it easier for anyone to create music, using simple voice commands.
TypeScript
71
star
46

sounds-in-space

An interactive audio experience, where the virtual sounds you hear change depending on your physical location.
C#
70
star
47

tf4micro-motion-kit

Arduino Sketch and a Web Bluetooth API for loading models and running inference on the Nano Sense 33 BLE device.
C++
66
star
48

obvi

A Polymer 3+ webcomponent / button for doing speech recognition
JavaScript
57
star
49

finger-user-interface

Control connected devices with the wave of a finger.
C
54
star
50

xyfi

Xyfi: BYO pointing device at a physical installation
JavaScript
48
star
51

morse-speak-demo

Text-to-Speech (TTS) demo web app that converts written text into spoken words via Morse code
JavaScript
44
star
52

aog-canvas-quiz

Canvas Quiz is a starter kit for developers to make custom, voice-enabled question-answer games for the Google Assistant.
JavaScript
40
star
53

air-snare

Play drums in the air.
Svelte
40
star
54

webvr-speaktogo

Explore the world with your voice.
JavaScript
34
star
55

norman-sketch-player

Embed Norman animated sketches on the web
JavaScript
29
star
56

pattern-radio

Code for patternradio.withgoogle.com
JavaScript
27
star
57

things-with-firebase-at-io2017

The Android Things projects used in the Experiments Tent at Google I/O 2017
Java
22
star
58

astrowand

Draw shapes in the sky to form constellations with TensorFlow and a microcontroller.
JavaScript
19
star
59

visual-alarm-clock

Get up in the morning by striking a pose to stop your alarm from ringing.
C++
10
star
60

dat.fire

JavaScript
6
star
61

.allstar

2
star
62

.github

1
star