Created
April 1, 2016 08:46
-
-
Save jbt/4b2b55252a7120362780b487bea8fe5e to your computer and use it in GitHub Desktop.
GoSquared Embedded Live Cat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function embedLiveCatTM() { | |
var π = document, π = "style", β¬ = "left", β¬ = "bottom", π = "translateX(-50%)", π³ = window, | |
β = "innerHeight", β = "innerWidth", πΊ = 0, π = π³[β] / 2, π = 0, πΊ = 0, π» = "px", | |
π’ = Math, β² = setInterval, π©, π± = π.createElement("img"); | |
π±.setAttribute("src", "//static.gosquared.com/images/april/nes/cat_02.png"); | |
π±[π ].height = π³[β] / 20 * 10 + π»; | |
π±[π ].position = "fixed"; | |
π±[π ].transform = π; | |
π.body.appendChild(π±); | |
(function π(){ | |
requestAnimationFrame(π); | |
π© = 0.01; | |
πΊ = π * π© + πΊ * (1 - π©); | |
π© = 0.1; | |
π = πΊ * π© + π * (1 - π©); | |
π±[π ][β¬] = π + π»; | |
π±[π ][β¬ ] = πΊ + π»; | |
})(); | |
β²(function(){ | |
π = π³[β] * (0.2 + π’.random() * 0.6); | |
π±[π ].transform = π < πΊ ? π + " scaleX(-1)" : π; | |
}, 3000); | |
β²(function(){ | |
var β = 0.065 * π³[β]; | |
πΊ = -β - β * π’.random(); | |
}, 200); | |
} | |
// now just call embedLiveCatTM() whenever you want a Live Cat on your site |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For boring browsers that don't support emoji as JS identifiers, try something like this instead: