Usage
makeSVG({
width: 100,
height: 100,
layers: [
{
color: "#e22",
name: "Diamine Brilliant Red",
/* | |
* This work is free. You can redistribute it and/or modify it under the | |
* terms of the Do What The Fuck You Want To Public License, Version 2, | |
* as published by Sam Hocevar. See the COPYING file for more details. | |
*/ | |
/* | |
* Easing Functions - inspired from http://gizma.com/easing/ | |
* only considering the t value for the range [0, 1] => [0, 1] | |
*/ | |
EasingFunctions = { |
fn day1(input: &str) -> usize { | |
let digits = vec!["one", "two", "three", "four", "five", "six", "seven", "eight", "nine"]; | |
let digits_rev = vec!["eno", "owt", "eerht", "ruof", "evif", "xis", "neves", "thgie", "enin"]; | |
let values = vec!['1','2','3','4','5','6','7','8','9']; | |
input.lines().map(|line| { | |
let regular = line.chars().collect::<Vec<char>>(); | |
let reversed = line.chars().rev().collect::<Vec<char>>(); | |
let mut s = String::new(); | |
for (chars, digits) in vec![(regular, &digits), (reversed, &digits_rev)] { |
use std::f64::consts::PI; | |
use svg::node::element::path::Data; | |
use svg::node::element::{Group, Image, Path}; | |
fn heart_function(t: f64) -> (f64, f64) { | |
let x = 16.0 * f64::sin(t).powi(3); | |
let y = -13.0 * f64::cos(t) | |
+ 5.0 * f64::cos(2.0 * t) | |
+ 2.0 * f64::cos(3.0 * t) | |
+ f64::cos(4.0 * t); |
Usage
makeSVG({
width: 100,
height: 100,
layers: [
{
color: "#e22",
name: "Diamine Brilliant Red",
// more minimal version of https://github.com/olahol/scrollparent.js/blob/master/scrollparent.js | |
const regex = /(auto|scroll)/; | |
const style = (node, prop) => | |
getComputedStyle(node, null).getPropertyValue(prop); | |
const scroll = (node) => | |
regex.test( | |
style(node, "overflow") + | |
style(node, "overflow-y") + |
{ | |
"ease": [0.25, 0.1, 0.25, 1.0], | |
"linear": [0.00, 0.0, 1.00, 1.0], | |
"ease-in": [0.42, 0.0, 1.00, 1.0], | |
"ease-out": [0.00, 0.0, 0.58, 1.0], | |
"ease-in-out": [0.42, 0.0, 0.58, 1.0] | |
} |
#!/bin/sh | |
# usage: timelapse <inputvid> <outputvid> <N> | |
# where <N> is a number with which the video will speed up by 2^(N+1) | |
set -x | |
set -e | |
input=$1 | |
output=$2 | |
tmp=`mktemp -d` |
use instant::Instant; | |
use serde::ser::SerializeStruct; | |
use serde::{Serialize}; | |
use std::collections::HashMap; | |
// Helpers for measuring performance | |
struct Span { | |
label: String, | |
start: Instant, | |
stop: Instant, |
// need libs: rand + bs58 | |
use rand::rngs::StdRng; | |
fn rng_from_fxhash(hash: String) -> impl Rng { | |
let mut bs = [0; 32]; | |
let max_chars = 43; // hack to not overflow the bs array | |
bs58::decode( | |
hash.chars().skip(2).take(max_chars).collect::<String>(), | |
) | |
.into(&mut bs) |
The GL-Transitions.com initiative aims to build an Open Collection of GLSL Transitions. It aims to be highly community-driven and free-software.