function canvas(el, store, fn) {
	if (!el) {
		el = document.createElement('canvas')
		document.body.appendChild(el)
	}

	el.style.transform = 'translate3d(0,0,0)'

	const ctx = el.getContext('2d')

	store.ctx = ctx

	let current = performance.now()
	const loop = () => {
		store.dt = performance.now() - current
		current = performance.now()

		fn()
		requestAnimationFrame(loop)
	}

	loop()
}

export default canvas
