Last active
February 3, 2026 20:24
-
-
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/498fccf6b06b821a8c268d9e9754d4730fb0efbb
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
| // summary : Drawing circles using doodle library. | |
| // keywords : scala, vector-graphics, doodle | |
| // publish : gist | |
| // authors : David Crosson | |
| // license : Apache License Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) | |
| // 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.4.2" | |
| //> using dep "org.creativescala::doodle:0.25.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