Skip to content

Instantly share code, notes, and snippets.

View illustratordavid's full-sized avatar

David Jennings illustratordavid

  • Northallerton, North Yorkshire, UK
View GitHub Profile
@illustratordavid
illustratordavid / index.html
Created December 4, 2014 14:40
clone matrix, width, height, x and y of object http://jsbin.com/copayu
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
<script src="http://snapsvg.io/assets/js/snap.svg-min.js"></script>
<script src="http://snapsvg.io/assets/js/prism.js"></script>
</head>
<body>
<div id="svg" width="400" height="400"></div>
@illustratordavid
illustratordavid / index.html
Created December 1, 2014 16:48
snap svg drag relative to mouse and object // source http://jsbin.com/cisasu
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
<script src="http://snapsvg.io/assets/js/snap.svg-min.js"></script>
<script src="http://snapsvg.io/assets/js/prism.js"></script>
</head>
<body>
<div id="svg" width="400" height="400"></div>
@illustratordavid
illustratordavid / SnapSVGPlugin_moveToCenter
Created November 3, 2014 14:19
SnapSVG Plugin - Move element to centre of another element
Element.prototype.moveToCenter = function(centerTarget) {
var t = this.transform().localMatrix;
t.translate((centerTarget.getBBox().cx-(this.getBBox().width/2)),(centerTarget.getBBox().cy-(this.getBBox().height/2)));
this.transform(t);
}
@illustratordavid
illustratordavid / gist:6192100
Created August 9, 2013 08:42
cfm to js console.log
<script type="text/javascript">
console.log('cfm says <cfoutput>#tolog#</cfoutput>');
</script>