Skip to content

Instantly share code, notes, and snippets.

@LucasBadico
Created June 19, 2018 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LucasBadico/a28253af04884c2d9065f270eed34cb9 to your computer and use it in GitHub Desktop.
Save LucasBadico/a28253af04884c2d9065f270eed34cb9 to your computer and use it in GitHub Desktop.
Combine of composer
// essa funcao receber n numeros of shapes
// cada shape com posicao e seu centro
// e devolvera um array bidimencional
const dot = [
[1]
]
const square = [
[1, 1 ],
[1, 1],
]
function combine(...pecas){
return [
[
// a combinacao dos shapes de dentro das pecas
]
]
}
const p1 = {
shape: dot,
center: [0, 0],
position: [0, 0]
}
const p2 = {
shape: dot,
center: [0, 0],
position: [0, 1]
}
const p3 = {
shape: dot,
center: [0, 0],
position: [1, 0]
}
const p4 = {
shape: dot,
center: [0, 0],
position: [0, 1]
}
combine(p1, p2,p3, p4) = square
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment