Be more productive with these tools! ❄️ January picks for you
Tags: webdev, productivity, design, javascript
Published: 2020-01-09 14:13:19

![Happy](https://media.giphy.com/media/g6Xmo9j6U0IhO/giphy.gif)


No better way to start the new year than a collection of Javascript libraries and get inspired for your projects! Without further ado, let's see what January brings us. 


------------------------------


![Sal.js]
(https://thepracticaldev.s3.amazonaws.com/i/lztg0gol56hkurkanam1.png)

Sal.js is a scroll animation library, focusing on performance and  small footprint. It is written in vanilla JavaScript and doesn't introduce any additional dependencies.

It is based on the Intersection Observer API, which allows to asynchronously observe changes in the intersection of a target element with an ancestor one or with a top-level document's viewport.

Be aware though that not all browsers [support](https://caniuse.com/#feat=intersectionobserver) this API:

![Support](https://thepracticaldev.s3.amazonaws.com/i/b2s5gk3eheksfqukc53e.png)

In case your target browser is not supported, you need to use a [polyfill](https://github.com/w3c/IntersectionObserver/tree/master/polyfill).
&nbsp;

### Usage

In your template file, add `data-sal` attribute with an animation name as value:

```html
<div data-sal="fade"></div>

<!--
Many other animations are available:
- fade
- slide-up
- slide-down
- slide-left
- slide-right
- zoom-in
- zoom-out
- flip-up
- flip-down
- flip-left
- flip-right
 -->
```

Then simply initialise the library in the script file:

```javascript
// ES6 modules
import sal from 'sal.js'

// CommonJS modules
var sal = require('sal.js')

sal();
```

Sal.js will look for all elements with a `data-sal` attribute and launch their animation when visible in the viewport. The animation's properties: `duration, delay and easing` can be customised according to your own needs.

```html
<div
  data-sal="slide-up"
  style="--sal-duration: 3s; --sal-delay: 2s;">
</div>
```

[Website](https://mciastek.github.io/sal/)

&nbsp;

------------------------------

&nbsp;
![Logo](https://thepracticaldev.s3.amazonaws.com/i/xoyr69149rptf2m5v62t.png)

Headroom.js is a lightweight, high-performance JS widget (with no dependencies) that allows you to react to the user's scroll. 

> Fixed headers are a popular approach for keeping the primary navigation in close proximity to the user. This can reduce the effort required for a user to quickly navigate a site, but they are not without problems…

> Large screens are usually landscape-oriented, meaning less vertical than horizontal space. A fixed header can therefore occupy a significant portion of the content area. Small screens are typically used in a portrait orientation. Whilst this results in more vertical space, because of the overall height of the screen a meaningfully-sized header can still be quite imposing.

> Headroom.js allows you to bring elements into view when appropriate, and give focus to your content the rest of the time.

The library dynamically adds and removes CSS classes from the target element, allowing developers to carefully define what should happen in each case:

```html
<!-- initially -->
<header class="headroom">

<!-- scrolling down -->
<header class="headroom headroom--unpinned">

<!-- scrolling up -->
<header class="headroom headroom--pinned">

<style>
.headroom {
    will-change: transform;
    transition: transform 200ms linear;
}
.headroom--pinned {
    transform: translateY(0%);
}
.headroom--unpinned {
    transform: translateY(-100%);
}
</style>
```

There are plenty of options that you can use to adapt the library with ease:

```javascript
var headroom = new Headroom(elem, {
  "offset": 205,
  "tolerance": 5,
  "classes": {
    "initial": "animated",
    "pinned": "bounceInDown",
    "unpinned": "bounceOutUp"
  }
});
headroom.init();

// to destroy
headroom.destroy();
```

You can test it with different [demos](https://wicky.nillia.ms/headroom.js/playroom/). <br>
Below an example using the swing effect: 

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/gd4d2f7wqwsgpfua8d5r.gif)

[Website](https://wicky.nillia.ms/headroom.js/)

&nbsp;

------------------------------

&nbsp;

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/34strmipjvws2og3aer8.png)

PWA asset generator is a tool implemented by my friend [Önder Ceylan](https://twitter.com/onderceylan) and based on [Puppeteer](https://pptr.dev/). It generates icons and splash screens automatically for your app and integrates them directly into the related files (manifest and index.html).
If you have implemented at least once a PWA, you know how tedious and time consuming is creating icon images for different platforms, while  keeping sizes and quality for all of them. Thanks to PWA asset generator you can completely automate this step and be sure to deliver pixel perfect images to the several target devices.

![demo](https://raw.githubusercontent.com/onderceylan/pwa-asset-generator/HEAD/static/demo.gif)
&nbsp;

### Install & Usage


```shell
$ npm install --global pwa-asset-generator

$ npx pwa-asset-generator
```

PWA asset generator offers several option to customise the generated assets:

```shell
  Options
    -b --background             Page background to use when image source is provided: css value  [default: transparent]
    -o --opaque                 Shows white as canvas background and generates images without transparency  [default: true]
    -p --padding                Padding to use when image source provided: css value  [default: "10%"]
    -s --scrape                 Scraping Apple Human Interface guidelines to fetch splash screen specs  [default: true]
    -m --manifest               Web app manifest file path to automatically update manifest file with the generated icons
    -i --index                  Index HTML file path to automatically put splash screen and icon meta tags in
    -a --path                   Path prefix to prepend for href links generated for meta tags
    -t --type                   Image type: png|jpeg  [default: png]
    -q --quality                Image quality: 0...100 (Only for JPEG)  [default: 100]
    -h --splash-only            Only generate splash screens  [default: false]
    -c --icon-only              Only generate icons  [default: false]
    -f --favicon                Generate favicon image and HTML meta tag  [default: false]
    -l --landscape-only         Only generate landscape splash screens  [default: false]
    -r --portrait-only          Only generate portrait splash screens  [default: false]
    -d --dark-mode              Generate iOS splash screen meta with (prefers-color-scheme: dark) media attr  [default: false]
    -u --single-quotes          Generate HTML meta tags with single quotes  [default: false]
    -g --log                    Logs the steps of the library process  [default: true]
```

[Github](https://github.com/onderceylan/pwa-asset-generator)

&nbsp;

------------------------------

&nbsp;

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/23wwkestlz7x31g9ttvv.png)

UnDraw is a collection of open-source (MIT licensed), constantly updated, sketched images to use in your blog or web app. 

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/992yjakyiz0yylui47ao.png)

The selection available is quite wide, allowing everybody to find easily an image matching almost any context. 
<br>Before downloading a file, you can also customise the colours to better fit the target colour palette.  

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/1uvxnsmgyhk5cvggncaw.png)

[Website](https://undraw.co/illustrations)

&nbsp;

------------------------------

&nbsp;

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/cwpacw5z63ttnfwz8mwd.png)

OFFEO is an online animated video maker to create social media videos with ease. It provides many motion graphics elements, templates and more than 500 royalty free soundtracks.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/4luoycyeo8elxk5beeyx.png)

You start by selecting a template from different categories:

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/humimu8r26cskv3bfgm9.png)

And then you continue by adding elements and animations from the libraries available. Below a sample I created in barely 10 minutes (I know it is kind of horrible, but considering the time invested it is not too bad after all :smile:):

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/1ko9va2csrkj9kocs015.gif)

Anyway, to better understand the true potential behind the tool, watch the official introductory video:

{% youtube vcCRU7WB4NE %}
&nbsp;

------------------------------

&nbsp;&nbsp;


![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/qqk4c9uzdj9kl4r6tunb.jpg)