Skip to content

Instantly share code, notes, and snippets.

View fallenartist's full-sized avatar

Aleksander Lenart fallenartist

View GitHub Profile
@fallenartist
fallenartist / index.html
Last active August 8, 2017 18:55
D3 v4 Zoomable Treemap
<!DOCTYPE html>
<meta charset="utf-8">
<style>
*, *:before, *:after {
box-sizing: border-box;
}
html, body {
width: 100%;
height: 100%;
@fallenartist
fallenartist / isPointInPoly.js
Created February 24, 2016 16:20
JavaScript function checking if a point falls inside a polygon.
// +Jonas Raoni Soares Silva
// @http://jsfromhell.com/math/is-point-in-poly [rev. #0]
// usage:
// points = [ {x: X1, y: Y1}, {x: X2, y: Y2}, ... , {x: Xn, y: Yn} ];
// alert( isPointInPoly(points, {x: mouseX, y: mouseY}) ? "In" : "Out" );
function isPointInPoly(poly, pt){
for (var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i)
((poly[i].y <= pt.y && pt.y < poly[j].y) || (poly[j].y <= pt.y && pt.y < poly[i].y))
@fallenartist
fallenartist / CC4G.as
Created May 12, 2015 23:52
Code used in CC4G online invitation. More about the project: https://www.behance.net/gallery/26152353/CC4G-Invitation
//----------------------------------------------------------------------
//Instance of Symbol 46 MovieClip "btn_card_1" in Frame 3
//----------------------------------------------------------------------
onClipEvent (load) {
function giveScale(num) {
targetXscale = num;
targetYscale = num;
}
function givePos(numX, numY) {
targetXpos = numX;