diff --git a/build.gradle b/build.gradle index c5e05130..6c5615cd 100644 --- a/build.gradle +++ b/build.gradle @@ -128,25 +128,26 @@ allprojects { } - task collectScreenshots { doFirst { def demoProjects = project.subprojects.findAll { it.sourceSets.hasProperty("demo") } - for (sub in demoProjects) { if (sub.name == "orx-rabbit-control") continue if (sub.name == "orx-runway") continue - def set = sub.sourceSets.demo def ucl = new URLClassLoader(set.runtimeClasspath.collect { it.toURI().toURL() } as URL[]) + + def runDemos = [] + for (x in set.output) { if (x.exists()) { for (y in x.listFiles()) { def name = y.name if (!name.contains('$') && name.contains(".class")) { - def klass = ucl.loadClass(y.name.replace(".class", "")) + def klassName = y.name.replace(".class", "") + def klass = ucl.loadClass(klassName) try { def mainMethod = klass.getMethod("main") javaexec { @@ -158,6 +159,7 @@ task collectScreenshots { jvmArgs += "-Dorg.openrndr.exceptions=JVM" executable = "./build-tools/xvfb-java.sh" } + runDemos.add(klassName) } catch (e) { // skip? } @@ -165,6 +167,23 @@ task collectScreenshots { } } } + runDemos = runDemos.sort() + def readme = sub.file("README.md") + if (readme.exists()) { + def lines = readme.readLines() + def screenshotsLine = lines.findIndexOf { it == "" } + if (screenshotsLine != -1) { + lines = lines.subList(0, screenshotsLine) + } + lines.add("") + lines.add("## Demos") + for (demo in runDemos) { + lines.add("[${demo}](src/demo/kotlin/${demo}.kt)") + lines.add("![${demo}](https://raw.githubusercontent.com/openrndr/orx/media/${sub.name}/images/${demo}.png)") + } + readme.delete() + readme.write(lines.join("\n")) + } } } } diff --git a/orx-easing/README.md b/orx-easing/README.md index b6b9294f..f2929f89 100644 --- a/orx-easing/README.md +++ b/orx-easing/README.md @@ -30,6 +30,7 @@ Using the `Easing` enumeration val et = Easing.QuadIn.function(t, 0.0, 1.0, 1.0) ``` -## Demos -[DemoEasings01Kt](src/demo/kotlin/DemoEasings01.kt) -![Screenshot](images/DemoEasings01Kt.png) \ No newline at end of file + +# Demos +[DemoEasings01Kt](src/demo/kotlin/DemoEasings01Kt.kt) +![DemoEasings01Kt](https://raw.githubusercontent.com/openrndr/orx/media/orx-easing/images/DemoEasings01Kt.png) \ No newline at end of file diff --git a/orx-fx/README.md b/orx-fx/README.md index b5621048..e1f0344d 100644 --- a/orx-fx/README.md +++ b/orx-fx/README.md @@ -95,3 +95,11 @@ All distortion effects are opacity preserving - `FlipVertically` - flips the source input vertically. + +# Demos +[DemoFluidDistort01Kt](src/demo/kotlin/DemoFluidDistort01Kt.kt) +![DemoFluidDistort01Kt](https://raw.githubusercontent.com/openrndr/orx/media/orx-fx/images/DemoFluidDistort01Kt.png) \ No newline at end of file diff --git a/orx-gui/README.md b/orx-gui/README.md index 3cf2213e..d6a0a0d1 100644 --- a/orx-gui/README.md +++ b/orx-gui/README.md @@ -161,3 +161,15 @@ import org.openrndr.extra.parameters.DoubleParameter ## Credits `orx-gui` is based on a proof-of-concept by [Ricardo Matias](https://github.com/ricardomatias/) + +# Demos +[DemoOptions01Kt](src/demo/kotlin/DemoOptions01Kt.kt) +![DemoOptions01Kt](https://raw.githubusercontent.com/openrndr/orx/media/orx-gui/images/DemoOptions01Kt.png) +[DemoSimple01Kt](src/demo/kotlin/DemoSimple01Kt.kt) +![DemoSimple01Kt](https://raw.githubusercontent.com/openrndr/orx/media/orx-gui/images/DemoSimple01Kt.png) \ No newline at end of file diff --git a/orx-keyframer/README.md b/orx-keyframer/README.md index 8aab66de..38e85ce1 100644 --- a/orx-keyframer/README.md +++ b/orx-keyframer/README.md @@ -133,3 +133,31 @@ Supported functions in expressions: [Parameters and prototypes](src/demo/resources/demo-full-01.json) + +# Demos +[DemoFull01Kt](src/demo/kotlin/DemoFull01Kt.kt) +![DemoFull01Kt](https://raw.githubusercontent.com/openrndr/orx/media/orx-keyframer/images/DemoFull01Kt.png) +[DemoScrub01Kt](src/demo/kotlin/DemoScrub01Kt.kt) +![DemoScrub01Kt](https://raw.githubusercontent.com/openrndr/orx/media/orx-keyframer/images/DemoScrub01Kt.png) +[DemoSimple01Kt](src/demo/kotlin/DemoSimple01Kt.kt) +![DemoSimple01Kt](https://raw.githubusercontent.com/openrndr/orx/media/orx-keyframer/images/DemoSimple01Kt.png) +[DemoSimple02Kt](src/demo/kotlin/DemoSimple02Kt.kt) +![DemoSimple02Kt](https://raw.githubusercontent.com/openrndr/orx/media/orx-keyframer/images/DemoSimple02Kt.png) +[DemoSimpleExpressions01Kt](src/demo/kotlin/DemoSimpleExpressions01Kt.kt) +![DemoSimpleExpressions01Kt](https://raw.githubusercontent.com/openrndr/orx/media/orx-keyframer/images/DemoSimpleExpressions01Kt.png) +[DemoSimpleRepetitions01Kt](src/demo/kotlin/DemoSimpleRepetitions01Kt.kt) +![DemoSimpleRepetitions01Kt](https://raw.githubusercontent.com/openrndr/orx/media/orx-keyframer/images/DemoSimpleRepetitions01Kt.png) \ No newline at end of file diff --git a/orx-mesh-generators/README.md b/orx-mesh-generators/README.md index 0d470a51..76d1d5fe 100644 --- a/orx-mesh-generators/README.md +++ b/orx-mesh-generators/README.md @@ -43,3 +43,31 @@ fun boxMesh( depthSegments: Int = 1, invert: Boolean = false): VertexBuffer ``` + +# Demos +[DemoBoxKt](src/demo/kotlin/DemoBoxKt.kt) +![DemoBoxKt](https://raw.githubusercontent.com/openrndr/orx/media/orx-mesh-generators/images/DemoBoxKt.png) +[DemoComplex01Kt](src/demo/kotlin/DemoComplex01Kt.kt) +![DemoComplex01Kt](https://raw.githubusercontent.com/openrndr/orx/media/orx-mesh-generators/images/DemoComplex01Kt.png) +[DemoComplex02Kt](src/demo/kotlin/DemoComplex02Kt.kt) +![DemoComplex02Kt](https://raw.githubusercontent.com/openrndr/orx/media/orx-mesh-generators/images/DemoComplex02Kt.png) +[DemoComplex03Kt](src/demo/kotlin/DemoComplex03Kt.kt) +![DemoComplex03Kt](https://raw.githubusercontent.com/openrndr/orx/media/orx-mesh-generators/images/DemoComplex03Kt.png) +[DemoComplex04Kt](src/demo/kotlin/DemoComplex04Kt.kt) +![DemoComplex04Kt](https://raw.githubusercontent.com/openrndr/orx/media/orx-mesh-generators/images/DemoComplex04Kt.png) +[DemoComplex05Kt](src/demo/kotlin/DemoComplex05Kt.kt) +![DemoComplex05Kt](https://raw.githubusercontent.com/openrndr/orx/media/orx-mesh-generators/images/DemoComplex05Kt.png) \ No newline at end of file diff --git a/orx-noise/README.md b/orx-noise/README.md index c0a3e4c9..7bd0cc1f 100644 --- a/orx-noise/README.md +++ b/orx-noise/README.md @@ -159,3 +159,19 @@ val v6 = billow(seed, x, y, z, ::perlinLinear, octaves, lacunarity, gain) val v7 = billow(seed, x, y, z, ::perlinLinear, octaves, lacunarity, gain) val v8 = billow(seed, x, y, z, ::perlinLinear, octaves, lacunarity, gain) ``` + +# Demos +[DemoGradientPerturb2DKt](src/demo/kotlin/DemoGradientPerturb2DKt.kt) +![DemoGradientPerturb2DKt](https://raw.githubusercontent.com/openrndr/orx/media/orx-noise/images/DemoGradientPerturb2DKt.png) +[DemoGradientPerturb3DKt](src/demo/kotlin/DemoGradientPerturb3DKt.kt) +![DemoGradientPerturb3DKt](https://raw.githubusercontent.com/openrndr/orx/media/orx-noise/images/DemoGradientPerturb3DKt.png) +[DemoPoissonDiskSamplingKt](src/demo/kotlin/DemoPoissonDiskSamplingKt.kt) +![DemoPoissonDiskSamplingKt](https://raw.githubusercontent.com/openrndr/orx/media/orx-noise/images/DemoPoissonDiskSamplingKt.png) \ No newline at end of file diff --git a/orx-shade-styles/README.md b/orx-shade-styles/README.md new file mode 100644 index 00000000..4d29326d --- /dev/null +++ b/orx-shade-styles/README.md @@ -0,0 +1,9 @@ +# orx-shade-styles + +# Demos +[DemoRadialGradient01Kt](src/demo/kotlin/DemoRadialGradient01Kt.kt) +![DemoRadialGradient01Kt](https://raw.githubusercontent.com/openrndr/orx/media/orx-shade-styles/images/DemoRadialGradient01Kt.png) \ No newline at end of file diff --git a/orx-time-operators/README.md b/orx-time-operators/README.md index a9227389..80a838f0 100644 --- a/orx-time-operators/README.md +++ b/orx-time-operators/README.md @@ -40,3 +40,15 @@ drawer.circle(0.0, 0.0, size.sine(freq, phase)) ``` + +# Demos +[DemoEnvelopeKt](src/demo/kotlin/DemoEnvelopeKt.kt) +![DemoEnvelopeKt](https://raw.githubusercontent.com/openrndr/orx/media/orx-time-operators/images/DemoEnvelopeKt.png) +[DemoLFOKt](src/demo/kotlin/DemoLFOKt.kt) +![DemoLFOKt](https://raw.githubusercontent.com/openrndr/orx/media/orx-time-operators/images/DemoLFOKt.png) \ No newline at end of file diff --git a/orx-timer/README.md b/orx-timer/README.md index f56cf7f3..c4402c19 100644 --- a/orx-timer/README.md +++ b/orx-timer/README.md @@ -36,4 +36,20 @@ Note that drawing inside the `repeat` action has no effect. Have a look at the d * [Simple `repeat` demonstration](src/demo/kotlin/DemoRepeat01.kt) * [A `repeat` demonstration with drawing](src/demo/kotlin/DemoRepeat02.kt) - * [Simple `timeOut` demonstration](src/demo/kotlin/DemoTimeOut01.kt) \ No newline at end of file + * [Simple `timeOut` demonstration](src/demo/kotlin/DemoTimeOut01.kt) + +# Demos +[DemoRepeat01Kt](src/demo/kotlin/DemoRepeat01Kt.kt) +![DemoRepeat01Kt](https://raw.githubusercontent.com/openrndr/orx/media/orx-timer/images/DemoRepeat01Kt.png) +[DemoRepeat02Kt](src/demo/kotlin/DemoRepeat02Kt.kt) +![DemoRepeat02Kt](https://raw.githubusercontent.com/openrndr/orx/media/orx-timer/images/DemoRepeat02Kt.png) +[DemoTimeOut01Kt](src/demo/kotlin/DemoTimeOut01Kt.kt) +![DemoTimeOut01Kt](https://raw.githubusercontent.com/openrndr/orx/media/orx-timer/images/DemoTimeOut01Kt.png) \ No newline at end of file