Skip to content

Instantly share code, notes, and snippets.

var beziers = {
easeInQuad: '.55,.085,.68,.53'
, easeInCubic: '.55,.055,.675,.19'
, easeInQuart: '.895,.03,.685,.22'
, easeInQuint: '.755,.05,.855,.06'
, easeInSine: '.47,0,.745,.715'
, easeInExpo: '.95,.05,.795,.035'
, easeInCirc: '.6,.04,.98, .335'
, easeInBack: '.6,-.28,.735,.045'
, easeOutQuad: '.25,.46,.45,.94'
/**
* Create cross browser transition CSS
*
* @param {Integer} duration Duration in milliseconds.
* @param {String} easing Easing function. Can be built-in CSS3 function or one of the provided custom functions.
* @param {String} prop CSS property to apply transition to.
*/
function transitionCss(duration, easing, prop) {
var easingDefs = {
easeInCubic : 'cubic-bezier(0.550, 0.055, 0.675, 0.190)',
@yaoduren123
yaoduren123 / easing.js
Last active August 29, 2015 14:06 — forked from frederickk/easing.js
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
var EasingFunctions = {
// no easing, no acceleration
linear: function (t) { return t },
// accelerating from zero velocity
easeInQuad: function (t) { return t*t },
@yaoduren123
yaoduren123 / animate.js
Last active August 29, 2015 14:06 — forked from oodavid/animate.js
// sdk/timestep/ui/backend/animate.js
/**
* @license
* This file is part of the Game Closure SDK.
*
* The Game Closure SDK is free software: you can redistribute it and/or modify
* it under the terms of the Mozilla Public License v. 2.0 as published by Mozilla.
* The Game Closure SDK is distributed in the hope that it will be useful,
@yaoduren123
yaoduren123 / bezier.js
Last active August 29, 2015 14:22 — forked from LiuJi-Jim/bezier.js
function DeCasteljauBezier(points, density, step){
//if (points.length < 3) return null;
console.time('bezier');
var ps = points.map(function(p){
return {
x: p.x,
y: p.y
};
}),
results = [],
@yaoduren123
yaoduren123 / Example1.js
Created March 14, 2012 07:39 — forked from tolmasky/Example1.js
Building a Better JavaScript Profiler with WebKit
document.addEventListener("click", function() { /*...*/ }, false);
@yaoduren123
yaoduren123 / LICENSE.txt
Created May 17, 2012 04:47 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@yaoduren123
yaoduren123 / LICENSE.txt
Created May 18, 2012 07:15 — forked from jed/LICENSE.txt
convert RGB to HEX
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@yaoduren123
yaoduren123 / gist:3608247
Created September 3, 2012 10:04 — forked from remy/gist:350433
Storage polyfill
if (typeof window.localStorage == 'undefined' || typeof window.sessionStorage == 'undefined') (function () {
var Storage = function (type) {
function createCookie(name, value, days) {
var date, expires;
if (days) {
date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires = "; expires="+date.toGMTString();
/*
* Simple Pub/Sub Implementation for jQuery
*
* Inspired by work from Peter Higgins (https://github.com/phiggins42/bloody-jquery-plugins/blob/master/pubsub.js)
*
* This is about the simplest way to write a pubsub JavaScript implementation for use with jQuery.
*/
(function( $ ) {
// Cache of all topics