Skip to content

Instantly share code, notes, and snippets.

@dacr
Last active August 18, 2023 07:29
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 dacr/f326b0d25d42d2835ecbc6fcd9a45db4 to your computer and use it in GitHub Desktop.
Save dacr/f326b0d25d42d2835ecbc6fcd9a45db4 to your computer and use it in GitHub Desktop.
Drawing circles using doodle library. / published by https://github.com/dacr/code-examples-manager #a493b4d0-3617-42d3-9433-1019f61112e7/f7e806716cac92a35dc8b2592e2c277b1e74ea06
// summary : Drawing circles using doodle library.
// keywords : scala, vector-graphics, doodle
// publish : gist
// authors : David Crosson
// license : Apache NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2)
// id : a493b4d0-3617-42d3-9433-1019f61112e7
// created-on : 2019-06-25T16:47:49Z
// managed-by : https://github.com/dacr/code-examples-manager
// run-with : scala-cli $file
// ---------------------
//> using scala "3.3.0"
//> using dep "org.creativescala::doodle:0.20.0"
// ---------------------
import doodle.image.*
import doodle.core.*
import doodle.syntax.*
import doodle.image.syntax.*
import doodle.syntax.all.*
import doodle.image.syntax.all.*
import doodle.java2d.*
import cats.effect.unsafe.implicits.global
val circle = Image.circle(500).noFill.strokeWidth(2)
val count=50
val circles = {
1.to(count)
.map(_.toDouble)
.map(f => circle.transform(Transform.translate(500d,0d)).scale(f / count, f / count))
.reduce((i1, i2) => i1.on(i2))
}
circles.draw()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment