Last active
September 28, 2024 08:58
-
-
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/a59c7c00680d49a73dc7427656c7d6f48d6ac7b2
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 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.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