Skip to content

Instantly share code, notes, and snippets.

View kiinlam's full-sized avatar
:octocat:
hard working

kiinlam kiinlam

:octocat:
hard working
View GitHub Profile
@kiinlam
kiinlam / make-it-center
Created December 11, 2014 09:00
居中的样式
.center {
position: absolute;
top: 50%;
left: 50%;
width: 100%;
-webkit-transform: translate(-50%,-50%) translateZ(0);
white-space: nowrap;
text-align: center
}
@kiinlam
kiinlam / css-animation
Created December 11, 2014 09:14
css3动画
.animation {
-webkit-animation: float 2s linear 0 infinite alternate;
}
.fadeIn {
-webkit-animation-name: fadeIn
}
@-webkit-keyframes fadeIn {
from {
opacity: 0;
@kiinlam
kiinlam / stop-uc-control.js
Created December 17, 2014 09:17
UC浏览器关闭默认手势和长按弹出菜单
// UC-U3内核JavaScript专用API
// (经测试,官方文档给出的API很多也不能使用,下面只列出测试能用的)
// 1. 关闭默认手势
// 用法:
navigator.control.gesture(false);
// 推荐写法:
try {
navigator.control.gesture(false);
} catch (e) {
}
@kiinlam
kiinlam / js-string-replace.js
Created December 18, 2014 04:01
js中string对象的replace方法的用法
String.replace(reg, function (matchStr, subStr1,..., subStrN, indexOfMatchStr, originStr) {
return anything;
});
@kiinlam
kiinlam / dynamic-svgElement-demo.html
Last active August 29, 2015 14:12
dynamic create svgElement
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head>
</head><body>
<svg id="s" xmlns="http://www.w3.org/2000/svg"/>
<script type="text/javascript">
function makeSVG(tag, attrs) {
var el= document.createElementNS('http://www.w3.org/2000/svg', tag);
for (var k in attrs)
el.setAttribute(k, attrs[k]);
return el;
@kiinlam
kiinlam / dynashow.js
Created December 29, 2014 02:57
dynashow-demo
var SVG_NS = "http://www.w3.org/2000/svg";
var XLINK_NS = "http://www.w3.org/1999/xlink";
var ATTR_MAP = {
"className": "class",
"svgHref": "href"
};
var NS_MAP = {
"svgHref": XLINK_NS
@kiinlam
kiinlam / chinese-month.js
Created January 14, 2015 02:23
get chinese-month
var month_cn = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'][new Date().getMonth()]
@kiinlam
kiinlam / baidu-evil.js
Created January 26, 2015 03:34
do not use baidu
;(function($) {
$(function() {
var url=document.referrer;
if ( url && url.search("http://")>-1) {
var refurl = url.match(/:\/\/(.[^/]+)/)[1];
if(refurl.indexOf("baidu.com")>-1){
alert('no baidu, no evil');
}
}
});
@kiinlam
kiinlam / str-enc-dec.js
Created January 29, 2015 09:56
String Encryption and Decrypt
// 基础知识
parseInt("kiinlam",36); //44655371662 把第一个参数用36进制来看待,解析成10进制
(44655371662).toString(36); //"kiinlam" 将数字转成字符串,36表示数字的基数,即将被转的数字变成36进制
var radix = 16; // 加密基数2-36
// 字符加密
function strEnc(str,radix){
  var val="", code;
  radix = radix || 10;

Circles, text and getImageData

I'm back with more of them moving circles. This script uses getImageData to form the text with particles. You can do some fun stuff with text and Canvas this way. Once again I'm using createjs for Canvas manipulation and the greensock library for easy tweening.

Forked from Rachel Smith's Pen Circles, text and getImageData.

A Pen by Captain Anonymous on CodePen.

License.