This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Mover { | |
constructor({ mass = 1, size = 40 } = {}) { | |
this.mass = mass; | |
this.location = new Vector(); | |
this.velocity = new Vector(); | |
this.acceleration = new Vector(); | |
this.size = size; | |
} | |
applyForce = v => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Vector { | |
constructor(x, y) { | |
this.x = x || 0; | |
this.y = y || 0; | |
} | |
toString = () => `(${this.x}, ${this.y})`; | |
_limitApply = () => { | |
if (this.limitValue && this.mag() > this.limitValue) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// BEM Util | |
export function getModifiers(prefix, modifiers) { | |
if (!modifiers) return '' | |
const array = modifiers | |
.trim() | |
.split(' ') | |
.map(m => m.trim()) | |
.filter(Boolean) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// map value x in range [a,b] to [c,d] | |
function rangeMap(x, a, b, c, d) { | |
if (a === b) return c; | |
if (c === d) return c; | |
return (x - a) / (b - a) * (d - c) + c; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Burger from './Burger'; | |
const MyBurger = () => ( | |
<Burger title="My Burger"> | |
<Burger.Bun /> | |
<Burger.Salat /> | |
<Burger.Meat /> | |
<Burger.Bun /> | |
</Burger> | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(() => { | |
const root = typeof window !== 'undefined' ? window : global; | |
const rAF = root.requestAnimationFrame | |
? root.requestAnimationFrame.bind(root) | |
: callback => root.setTimeout(callback, 16); | |
const getNow = () => new Date().getTime(); | |
const tween = ({ duration = 300, update, complete } = {}) => { | |
const play = () => { | |
if (duration <= 0) return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(() => { | |
const rAF = window.requestAnimationFrame | |
? window.requestAnimationFrame.bind(window) | |
: callback => window.setTimeout(callback, 16); | |
const getNow = () => new Date().getTime(); | |
const tween = ({ duration = 1000 } = {}) => { | |
const start = ({ update, complete } = {}) => { | |
const play = () => { | |
if (duration <= 0) return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var feed = { | |
entries: [ | |
{ | |
title: 'title 1', | |
link: 'link 1', | |
author: 'author 1', | |
publishedDate: 'publishedDate 1', | |
categories: ['category 11', 'category 12'] | |
}, | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function(d, $) { | |
var stub = { | |
entries: [{ | |
title: 'title 1', | |
link: 'link 1', | |
author: 'author 1', | |
publishedDate: 'publishedDate 1', | |
categories: ['category 11', 'category 12'] | |
}, { | |
title: 'title 2', |
NewerOlder