From 66b979fc84b3b0206a0ded4f76b41092db424107 Mon Sep 17 00:00:00 2001 From: Edwin Jakobs Date: Tue, 7 Apr 2020 21:05:08 +0200 Subject: [PATCH] Add orx-shade-styles demo --- orx-shade-styles/build.gradle | 15 ++++++++++++++ .../src/demo/kotlin/DemoRadialGradient01.kt | 20 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 orx-shade-styles/src/demo/kotlin/DemoRadialGradient01.kt diff --git a/orx-shade-styles/build.gradle b/orx-shade-styles/build.gradle index 7afc9b60..37ffbeab 100644 --- a/orx-shade-styles/build.gradle +++ b/orx-shade-styles/build.gradle @@ -1,3 +1,18 @@ +sourceSets { + demo { + java { + srcDirs = ["src/demo/kotlin"] + compileClasspath += main.getCompileClasspath() + runtimeClasspath += main.getRuntimeClasspath() + } + } +} dependencies { api project(":orx-parameters") + + demoImplementation("org.openrndr:openrndr-core:$openrndrVersion") + demoRuntimeOnly("org.openrndr:openrndr-gl3:$openrndrVersion") + demoRuntimeOnly("org.openrndr:openrndr-gl3-natives-$openrndrOS:$openrndrVersion") + demoImplementation(sourceSets.getByName("main").output) + } \ No newline at end of file diff --git a/orx-shade-styles/src/demo/kotlin/DemoRadialGradient01.kt b/orx-shade-styles/src/demo/kotlin/DemoRadialGradient01.kt new file mode 100644 index 00000000..1beb3c01 --- /dev/null +++ b/orx-shade-styles/src/demo/kotlin/DemoRadialGradient01.kt @@ -0,0 +1,20 @@ +import org.openrndr.application +import org.openrndr.color.ColorRGBa + +import org.openrndr.extra.shadestyles.radialGradient +import kotlin.math.cos + +fun main() { + application { + program { + extend { + drawer.shadeStyle = radialGradient( + ColorRGBa.PINK, + ColorRGBa.PINK.toHSVa().shiftHue(180.0).scaleValue(0.5).toRGBa(), + exponent = cos(seconds)*0.5+0.5 + ) + drawer.rectangle(120.0, 40.0, 400.0, 400.0) + } + } + } +} \ No newline at end of file