Skip to content

Instantly share code, notes, and snippets.

@tamask
tamask / vertex_data_map.py
Created May 7, 2012 11:48
Vertex Data Map (Blender)
import bpy
bl_info = {
'name': 'Vertex Data Map',
'author': 'Tamas Kemenczy',
'version': (0, 1),
'blender': (2, 6, 3),
'location': 'View3D > Specials > Vertex Data Map',
'description': 'Generate vertex data map UV texture',
'category': 'Mesh'
@tamask
tamask / set_loose_vertex_colors.py
Created May 11, 2012 00:30
Set Loose Vertex Colors (Blender)
import bpy
import mathutils
bl_info = {
'name': 'Set Loose Vertex Colors',
'author': 'Tamas Kemenczy',
'version': (0, 1),
'blender': (2, 6, 3),
'location': 'View3D > Specials > Set Loose Vertex Colors',
'description': 'Store loose vertex colors via vertex groups',
@tamask
tamask / map_loose_vertex_colors.py
Created May 13, 2012 14:40
Map Loose Vertex Colors (Blender)
import bpy
bl_info = {
'name': 'Map Loose Vertex Colors',
'author': 'Tamas Kemenczy',
'version': (0, 1),
'blender': (2, 6, 3),
'location': 'View3D > Specials > Map Loose Vertex Colors',
'description': 'Bake vertex colors to active uv texture image',
'category': 'Mesh'
@tamask
tamask / arc.js
Created August 19, 2012 19:32
SVG arc
function arc(x, y, rx, ry, from, to) {
var ar = from * Math.PI / 180;
var ax = x + rx * Math.cos(ar);
var ay = y + ry * Math.sin(ar);
var br = to * Math.PI / 180;
var bx = x + rx * Math.cos(br);
var by = y + ry * Math.sin(br);
var sweep = (to - from) > 180 ? 1 : 0;
@tamask
tamask / raphael.py
Created August 24, 2012 22:35
SVG to Raphael.js converter
import re
import sys
import json
import math
from lxml import etree
# TODO
# - text nodes
# - image nodes
# - transforms
var Preloader = function(sources, oncomplete, onload) {
this.init(sources, oncomplete, onload);
}
Preloader.prototype = {
init: function(sources, oncomplete, onload) {
this.sources = sources;
this.oncomplete = oncomplete
this.onload = onload;
this.images = [];
Boxfill = function(el) {
this.init(el);
};
Boxfill.prototype = {
init: function(el) {
this.el = el;
this.el.style.overflow = 'hidden';
if (!this.el.style.position)
@tamask
tamask / gist:3859647
Created October 9, 2012 15:47
raphael.js|py and image fallback recipe
$('.art').each(function() {
var el, im, width, height, paper;
width = $(this).data('width');
if (width)
width += 'px';
height = $(this).data('height');
if (height)
height += 'px';
if (window.Raphael && (Raphael.svg || Raphael.vml)) {
el = $('<div>').addClass('svg');
@tamask
tamask / vector2.js
Created December 7, 2012 16:48
Vector2
Vector2.prototype = {
init: function(x, y) {
this.x = x;
this.y = y;
},
copy: function() {
return new Vector2(this.x, this.y);
},
@tamask
tamask / acronym.py
Created December 14, 2012 17:43
acronym generator
#!/usr/bin/env python
import sys
last = ''
punc = ','
while True:
c = sys.stdin.read(1)
if c: