Last active
May 25, 2024 10:19
-
-
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/6adff53d849507c0cbbfb7bbd769c6441e7aa79d
This file contains 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 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.4.2" | |
//> 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