Skip to content

Instantly share code, notes, and snippets.

View FreddyFY's full-sized avatar
🌊
In the flow

Freddy Ochner FreddyFY

🌊
In the flow
View GitHub Profile
@FreddyFY
FreddyFY / getBGSize.js
Last active October 23, 2018 12:25
Animating to/from backgroundSize: "contain" or "cover"
/**
* Source: from: https://greensock.com/forums/topic/18144-animating-tofrom-backgroundsize-contain-or-cover/
*/
//this function converts the backgroundSize of an element from "cover" or "contain" or "auto" into px-based dimensions. To set it immediately, pass true as the 2nd parameter.
function getBGSize (element, setInPx) {
var e = (typeof(element) === "string") ? document.querySelector(element) : element,
cs = window.getComputedStyle(e),
imageUrl = cs.backgroundImage,
size = cs.backgroundSize,
# Downlaod TS-Files and convert them
#
# How to get the ts-filepath https://stackoverflow.com/questions/22188332/download-ts-files-from-video-stream#answer-42124169
#
# required: wget, ffmpeg
prelink="https://domain.com/path/to/ts/file"
lastnumner=5
output=$HOME"/desktop/movie.mp4"
headers=""