[orx-shade-styles] Write comments on demos
This commit is contained in:
@@ -12,6 +12,17 @@ import org.openrndr.math.transforms.transform
|
||||
import kotlin.math.PI
|
||||
import kotlin.math.cos
|
||||
|
||||
/**
|
||||
* Animated demonstration on how to use the `clip` shade style to mask-out
|
||||
* part of an image (or anything else drawn while the shade style is active).
|
||||
* The clipping uses different fit modes on each row, and different aspect
|
||||
* ratios in each column.
|
||||
*
|
||||
* This example uses a rotating `star`-shaped clipping with 24 sides.
|
||||
* Other available clipping shapes are `circle`, `rectangle`, `line` and `ellipse`.
|
||||
*
|
||||
* Press a mouse button to toggle the `feather` property between 0.0 and 0.5.
|
||||
*/
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
@@ -31,7 +42,7 @@ fun main() = application {
|
||||
for ((index, cell) in grid.flatten().withIndex()) {
|
||||
|
||||
drawer.shadeStyle = clip {
|
||||
clipFit = FillFit.entries[index/3]
|
||||
clipFit = FillFit.entries[index / 3]
|
||||
feather = gf
|
||||
|
||||
clipTransform = transform {
|
||||
@@ -43,12 +54,13 @@ fun main() = application {
|
||||
star {
|
||||
radius = 0.5
|
||||
center = Vector2(0.5, 0.5)
|
||||
sharpness = cos( 2 * PI * index / 9.0 + seconds) * 0.25 + 0.5
|
||||
sharpness = cos(2 * PI * index / 9.0 + seconds) * 0.25 + 0.5
|
||||
sides = 24
|
||||
}
|
||||
}
|
||||
|
||||
val acell = when(val i = index%3) {
|
||||
// Use sub() on squares to create vertical or horizontal rectangles
|
||||
val acell = when (val i = index % 3) {
|
||||
1 -> cell.sub(0.0..0.5, 0.0..1.0)
|
||||
2 -> cell.sub(0.0..1.0, 0.0..0.5)
|
||||
else -> cell
|
||||
|
||||
Reference in New Issue
Block a user