Skip to content

Instantly share code, notes, and snippets.

@gabrielflorit
Last active June 6, 2018 06:30
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 gabrielflorit/06a3fd9f826a7b1c7a0d8bdfcecb8093 to your computer and use it in GitHub Desktop.
Save gabrielflorit/06a3fd9f826a7b1c7a0d8bdfcecb8093 to your computer and use it in GitHub Desktop.
SCRIPT-8
// title: Trigo-8
/* eslint-disable no-global-assign */
initialState = {}
update = state => {}
draw = state => {
clear()
// origin
const o = { x: 64, y: 64 }
// radius
const r = 60
const rd = 0
// compute points
const points = range(0, 1, 0.1).map(i => {
const angle = i * 2 * Math.PI
const x = o.x + (r + rd * i) * Math.cos(angle)
const y = o.y + (r + rd * i) * Math.sin(angle)
return [x, y]
})
// // draw line
// polyStroke(points, 3)
// draw points
points.forEach(p => {
line(o.x, o.y, p[0], p[1], 4)
circFill(...p, 2, 0)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment