All Projects → jawache → Smile To Unlock

jawache / Smile To Unlock

Licence: mit
Want to give away free content on your site? How about asking for a smile in return 😁

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Smile To Unlock

Split Me
Universal web component to create resizable split layouts
Stars: ✭ 69 (-33.01%)
Mutual labels:  webcomponents
Builder
Drag and drop page building using your code components
Stars: ✭ 1,281 (+1143.69%)
Mutual labels:  webcomponents
Calcite Components
Web Components for the Calcite Design System. Built with Stencil JS. Currently in Beta!
Stars: ✭ 96 (-6.8%)
Mutual labels:  webcomponents
Webcomponents From Zero To Hero
An introduction to writing raw web components.
Stars: ✭ 70 (-32.04%)
Mutual labels:  webcomponents
Funcy.js
funcy.js - a functional web components wrapper
Stars: ✭ 87 (-15.53%)
Mutual labels:  webcomponents
Aybolit
Lightweight web components library built with LitElement.
Stars: ✭ 90 (-12.62%)
Mutual labels:  webcomponents
Web Components Angular React
Multiple apps as components POC
Stars: ✭ 64 (-37.86%)
Mutual labels:  webcomponents
Frontend
🍭 Frontend for Home Assistant
Stars: ✭ 1,366 (+1226.21%)
Mutual labels:  webcomponents
Vaadin Upload
The Web Component for uploading multiple files with progress indication. Part of the Vaadin components.
Stars: ✭ 87 (-15.53%)
Mutual labels:  webcomponents
Nanocomponent Adapters
🔌 - Convert a nanocomponent to a component for your favourite API or library (web components, (p)react, angular)
Stars: ✭ 94 (-8.74%)
Mutual labels:  webcomponents
Wired Elements
Collection of custom elements that appear hand drawn. Great for wireframes or a fun look.
Stars: ✭ 8,848 (+8490.29%)
Mutual labels:  webcomponents
Redux Store Element
A custom element allowing a more declarative use of Redux.
Stars: ✭ 83 (-19.42%)
Mutual labels:  webcomponents
Fast Morph
A Morphing UI web component built with StencilJS
Stars: ✭ 90 (-12.62%)
Mutual labels:  webcomponents
Web Components Benchmark
Web Components benchmark for a various Web Components technologies
Stars: ✭ 69 (-33.01%)
Mutual labels:  webcomponents
Highcharts Chart
Polymer Element wrapper for highcharts library. Seamlessly create various types of charts from one element.
Stars: ✭ 97 (-5.83%)
Mutual labels:  webcomponents
Onsenui
Mobile app development framework and SDK using HTML5 and JavaScript. Create beautiful and performant cross-platform mobile apps. Based on Web Components, and provides bindings for Angular 1, 2, React and Vue.js.
Stars: ✭ 8,518 (+8169.9%)
Mutual labels:  webcomponents
Covapp
The app lets everyone assess their symptoms using a questionnaire. The app also informs users about next steps, for example, precautionary measures or contacting healthcare providers and health authorities.
Stars: ✭ 90 (-12.62%)
Mutual labels:  webcomponents
Wc Loader
🚽 Webcomponents webpack loader.
Stars: ✭ 101 (-1.94%)
Mutual labels:  webcomponents
Polymer3 Webpack Starter
Polymer 3 starter built with Vaadin components and Vaadin.Router library, using webpack and modern tools
Stars: ✭ 99 (-3.88%)
Mutual labels:  webcomponents
Stencil
A toolchain for building scalable, enterprise-ready component systems on top of TypeScript and Web Component standards. Stencil components can be distributed natively to React, Angular, Vue, and traditional web developers from a single, framework-agnostic codebase.
Stars: ✭ 9,880 (+9492.23%)
Mutual labels:  webcomponents

Smile To Unlock

Want to give away free content on your site? How about asking for a smile in return 😁

Demo

IMAGE ALT TEXT HERE

You can also see it working on plunker here: https://plnkr.co/edit/MuZp7aHedI5LawAjgfJS?p=preview

What is it?

Smile To Unlock is a Web Component built using the StencilJS compiler, so is framework agnostic, can be used in an Angular, Vue, React or even in a vanilla web application.

Smile To Unlock captures an image from the users camera and uses the Azure Cognitive Services Emotive API to figure out how happy the person is.

  • NOTE: On the FREE tier you get 30,000 API requests a month.

Getting Started

  1. Include smiletounlock.js in your HTML file
  • via a script tag (quickest)
<script src="https://unpkg.com/[email protected]/dist/smiletounlock.js"></script>
  • or via a node module
npm install smile-to-unlock --save

Then add a script tag to your HTML like so:

 <script src='node_modules/smile-to-unlock/dist/smiletounlock.js></script>
  1. Grab an API Key from Azure
  • NOTE: On the FREE tier you get 30,000 API requests a month.
  1. Add this tag to your HTML
<smile-to-unlock api-key="<YOUR_API_KEY_HERE>"></smile-to-unlock>
  1. Add this code to trigger the component
var locker = document.querySelector('smile-to-unlock');
locker.start();

This opens the component full screen and starts asking the user to smile.

  1. Add this code to check to see if the user has smiled
locker.addEventListener("userSmiled", function (ev) {
    // --> Add the code to show the free content here <--
    
    locker.end(); // End the locker so the camera is shutdown
})

Using the helper hider

As a shortcut if you just have a video or part of the page you want to hide from the user unless they smile you can use the helper <smile-to-unlock-hider></smile-to-unlock-hider> component.

  1. Place the hider inside the component you want to hide.

NOTE: The element you want to hide should have the style position: relative;

<div class="this-is-what-want-to-hide" style="position: relative;">
    <!-- This will add a black overlay to any content with some text and a button to start the smiling process -->
    <smile-to-unlock-hider></smile-to-unlock-hider>

    <!-- This is the actual unlocker component  -->
    <smile-to-unlock api-key="<YOUR_API_KEY_HERE>"></smile-to-unlock>
</div>

  1. Then make sure to add this code at the end of your html file somewhere:
  • This code shows the hider overlay over the content you want to hide (so the user can't see it or click on any buttons if it's a video).
(function() {
    var hider = document.querySelector('smile-to-unlock-hider');
    var locker = document.querySelector('smile-to-unlock');

    // This event is called when the user has clicked Smile To Unlock
    hider.addEventListener("readyToSmile", function (ev) {
    // Starts the locker full screen
    locker.start();

    // This event is sent when the user has smiled
    locker.addEventListener("userSmiled", function (ev) {
        console.log(ev.detail.score);

        // Hide the hider so we show the content
        hider.hide();

        // End the locker so the camera is shutdown
        locker.end();
    })
    })
})();

Working on Smile To Unlock

To setup run:

npm install
npm start

To view the build, start an HTTP server inside of the /www directory.

To watch for file changes during develop, run:

npm run dev

To build the app for production, run:

npm run build
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].