Skip to content

Instantly share code, notes, and snippets.

View actarian's full-sized avatar

Luca Zampetti actarian

View GitHub Profile
@actarian
actarian / modelViewMatrix.glsl
Created April 29, 2020 06:03
modelViewMatrix for vscode-glsl-canvas
mat4 rotate(float angle, vec3 axis) {
vec3 a = normalize(axis); float s = sin(angle); float c = cos(angle); float n = 1.0 - c;
return mat4(n * a.x * a.x + c, n * a.x * a.y - a.z * s, n * a.z * a.x + a.y * s, 0.0, n * a.x * a.y + a.z * s, n * a.y * a.y + c, n * a.y * a.z - a.x * s, 0.0, n * a.z * a.x - a.y * s, n * a.y * a.z + a.x * s, n * a.z * a.z + c, 0.0, 0.0, 0.0, 0.0, 1.0);
}
mat4 translate(vec3 t) {
return mat4(1.0, 0.0, 0.0, t.x, 0.0, 1.0, 0.0, t.y, 0.0, 0.0, 1.0, t.z, 0.0, 0.0, 0.0, 1.0);
}
mat4 scale(vec3 s) {
@actarian
actarian / rxcomp-form.component.js
Created December 16, 2019 21:41
RxComp - FormComponent
onInit() {
const form = new FormGroup({
firstName: null,
lastName: null,
email: null,
}, RequiredValidator());
form.changes$.subscribe((changes) => {
this.pushChanges();
});
@actarian
actarian / rxcomp-todo-item.component.meta.js
Created December 16, 2019 21:05
RxComp - TodoItemComponent Meta
TodoItemComponent.meta = {
selector: '[todo-item-component]',
inputs: ['item'],
outputs: ['toggle', 'remove'],
hosts: { host: HostFactory },
template: `
<button type="button" class="btn--toggle" (click)="onToggle(item)">
<div class="date" [innerHTML]="item.date | date : 'en-US' : { month: 'short', day: '2-digit', year: 'numeric' }"></div>
<div class="title" [innerHTML]="item.name"></div>
</button>
@actarian
actarian / rxcomp-core.module.js
Last active December 16, 2019 21:12
RxComp - CoreModule
const declarations = [
ClassDirective,
EventDirective,
ForStructure,
IfStructure,
InnerHtmlDirective,
StyleDirective,
JsonPipe
];
export default class CoreModule extends Module {}
@actarian
actarian / rxcomp-lifecycle.js
Created December 16, 2019 15:37
RxComp - LifeCycle Hooks
class MyComponent extends Component {
/**
* MyComponent instance has been initialized
* we can add custom properties to the instance
*/
onInit() {
// ...
}
@actarian
actarian / rxcomp-syntax.html
Created December 16, 2019 15:27
RxComp - Declarative Syntax
<li class="list__item" *for="let item of items" [class]="{ done: item.done }" [style]="{ background: background, color: foreground, '--accent': accent }" todo-item-component [item]="item" (toggle)="onToggleItem($event)" (remove)="onRemoveItem($event)">
<button type="button" class="btn--toggle" (click)="onToggle(item)">
<div class="date" [innerHTML]="item.date | date : 'en-US' : { month: 'short', day: '2-digit', year: 'numeric' }"></div>
<div class="title" [innerHTML]="item.name"></div>
</button>
<button type="button" class="btn--remove" (click)="onRemove(item)">
<i class="icon--remove"></i>
</button>
</li>
@actarian
actarian / rxcomp-todo-item.component.js
Created December 16, 2019 15:26
RxComp - TodoItemComponent
export default class TodoItemComponent extends Component {
onChanges(changes) {
this.color = color(changes.item.id);
}
onToggle($event) {
this.toggle.next($event);
}
@actarian
actarian / rxcomp-app.module.js
Created December 16, 2019 15:24
RxComp - AppModule
import { Browser, CoreModule, Module } from 'rxcomp';
export default class AppModule extends Module {}
AppModule.meta = {
imports: [
CoreModule
],
declarations: [
TodoItemComponent,
@actarian
actarian / ffmpeg-export-options.md
Last active February 4, 2021 08:24
FFMPEG alpha merge, color, clipping, jpg2000, webp, frame tiles

FFMPEG alpha merge, color, clipping, jpg2000, webp, frame tiles

sequence to jpeg2000

ffmpeg -i "c:\ffmpeg\in\hero\gbuffer_%05d.png" -pix_fmt yuv420p -vcodec jpeg2000 "c:\ffmpeg\out\hero\cover_%04d.jpeg"

sequence to webp

ffmpeg -i "c:\ffmpeg\in\hero\gbuffer_%05d.png" -pix_fmt yuv420p -codec libwebp "c:\ffmpeg\out\hero\cover_%04d.webp"


@actarian
actarian / GlslCanvas.js
Last active June 24, 2018 09:54
GlslCanvas unique uniform
/*
The MIT License (MIT)
Copyright (c) 2015 Patricio Gonzalez Vivo ( http://www.patriciogonzalezvivo.com )
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the 'Software'), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,