collectScreenshots: drop @see... lines

otherwise images are duplicated in README.md
This commit is contained in:
Abe Pazos
2025-08-28 23:42:49 +02:00
parent 927dc8eb98
commit 420bf723e7
5 changed files with 44 additions and 8 deletions

View File

@@ -43,7 +43,7 @@ abstract class CollectScreenshotsTask @Inject constructor() : DefaultTask() {
"preload class not found: '${preloadClass.absolutePath}'"
}
// Execute demos
// Execute demos and produce PNG files
inputChanges.getFileChanges(inputDir).forEach { change ->
if (change.fileType == FileType.DIRECTORY) return@forEach
if (change.file.extension == "class") {
@@ -98,7 +98,7 @@ abstract class CollectScreenshotsTask @Inject constructor() : DefaultTask() {
}
}
// List found PNG images.
// List produced PNG images.
// Only executed if there are changes in the inputDir.
val demoImageBaseNames = outputDir.get().asFile.listFiles { file: File ->
file.extension == "png"
@@ -135,10 +135,14 @@ abstract class CollectScreenshotsTask @Inject constructor() : DefaultTask() {
val main = codeLines.indexOfFirst { it.startsWith("fun main") }
if ((start < end) && (end < main)) {
codeLines.subList(start + 1, end).joinToString("\n") {
it.trimStart(' ', '*')
codeLines.subList(start + 1, end).joinToString("\n") { line ->
val trimmed = line.trimStart(' ', '*')
if(trimmed.startsWith("@see")) "" else trimmed
}
} else ""
} else {
println("/** comment */ missing in $projectPath/$ktFilePath")
""
}
} else ""
readmeLines.add(

View File

@@ -8,6 +8,14 @@ import org.openrndr.shape.Circle
import kotlin.math.cos
import kotlin.math.sin
/**
* Demonstrates how to use `adjustContour` to select and modify three vertices
* in a circular contour. In OPENRNDR circles contain 4 cubic bézier
* segments connecting 4 vertices.
*
* On every animation frame the circular contour is created and transformed
* using sines, cosines and the variable `seconds` for an animated effect.
*/
fun main() = application {
configure {
width = 800

View File

@@ -8,6 +8,10 @@ import org.openrndr.shape.Circle
import kotlin.math.cos
import kotlin.math.sin
/**
* Demonstrates how to use `adjustContour` to select and remove vertex 0
* from a circular contour, then select and animate the position and scale the new vertex 0.
*/
fun main() = application {
configure {
width = 800
@@ -22,8 +26,6 @@ fun main() = application {
selectVertex(0)
vertex.moveBy(Vector2(cos(seconds) * 40.0, sin(seconds * 0.43) * 40.0))
vertex.scale(cos(seconds * 2.0) * 2.0)
}
drawer.stroke = ColorRGBa.RED
drawer.contour(contour)

View File

@@ -7,6 +7,18 @@ import org.openrndr.math.Vector2
import kotlin.math.cos
import kotlin.math.sin
/**
* Demonstrates how to select and alter the edges of a rectangle.
*
* The rectangle is a scaled-down version window bounds.
*
* By default, the edges of a rectangular contour are linear, so the `edge.toCubic()` method
* is called to make it possible to bend them.
*
* Then various edges are selected one by one and transformed over time using operations like
* scale, rotate, splitAt and moveBy.
*
*/
fun main() = application {
configure {
width = 800
@@ -23,13 +35,14 @@ fun main() = application {
selectEdge(0)
edge.scale(0.5, 0.5)
edge.rotate(cos(seconds * 0.5) * 30.0)
selectEdge(1)
edge.toCubic()
edge.splitAt(0.5)
edge.moveBy(Vector2(cos(seconds * 10.0) * 40.0, 0.0))
//edge.next?.select()
selectEdge(3)
edge.moveBy(Vector2(0.0, sin(seconds * 10.0) * 40.0))

View File

@@ -6,6 +6,15 @@ import org.openrndr.extra.shapes.adjust.adjustContour
import org.openrndr.shape.Circle
import kotlin.math.cos
/**
* Demonstrates an `adjustContour` animated effect where edge 0 of a contour
* is replaced by a point sampled on that edge. The specific edge point oscillates between
* 0.0 (at the start) and 1.0 (at the end) using a cosine and the `seconds` variable.
*
* The base contour used for the effect alternates every second
* between a rectangular and a circular contour.
*
*/
fun main() = application {
configure {
width = 800