Skip to content

Instantly share code, notes, and snippets.

@noromanba
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noromanba/5c509ad759190f6b6d9d to your computer and use it in GitHub Desktop.
Save noromanba/5c509ad759190f6b6d9d to your computer and use it in GitHub Desktop.
feather animation on SoundCloud for UserScript
// ==UserScript==
// @name smooth SoundCloud
// @namespace http://noromanba.flavors.me
// @description feather animation on SoundCloud for UserScript
// @include *://soundcloud.com/*
// @include *://*.soundcloud.com/*
// @grant none
// @run-at document-end
// @version 2015.5.20.0
// @homepage https://gist.github.com/noromanba/5c509ad759190f6b6d9d
// @downloadURL https://gist.github.com/noromanba/5c509ad759190f6b6d9d/raw/smooth-soundcloud.user.js
// @license MIT License http://nrm.mit-license.org/2014
// @author noromanba http://noromanba.flavors.me
// @icon https://upload.wikimedia.org/wikipedia/commons/thumb/0/0d/Michael_Jackson_-_icon.svg/32px-Michael_Jackson_-_icon.svg.png
// @icon64 https://upload.wikimedia.org/wikipedia/commons/thumb/0/0d/Michael_Jackson_-_icon.svg/64px-Michael_Jackson_-_icon.svg.png
// ==/UserScript==
// Icon (PD by Pintoandres91 JovianEye Was_a_bee)
// https://commons.wikimedia.org/wiki/File:Michael_Jackson_-_icon.svg
// Devel
// https://gist.github.com/noromanba/5c509ad759190f6b6d9d
(function () {
var FPS = 5; // change fps as you like
var throttleAnimation = function forceFallback(fps, ctx) {
fps = fps || 10;
ctx = ctx || window;
var start = function (callback) { return ctx.setTimeout(callback, 1000 / fps); };
var stop = function (callback) { return ctx.clearTimeout(callback, 1000 / fps); };
if (ctx.requestAnimationFrame) {
ctx.requestAnimationFrame = start;
ctx.cancelAnimationFrame = stop;
return;
}
['moz', 'webkit', 'ms', 'o'].some(function (prefix) {
if (ctx[prefix + 'RequestAnimationFrame']) {
ctx[prefix + 'RequestAnimationFrame'] = start;
ctx[prefix + 'CancelAnimationFrame'] = stop;
return true;
}
});
};
throttleAnimation(FPS);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment