diff --git a/src/main/kotlin/com/theapache64/klokk/movement/RippleMatrixGenerator.kt b/src/main/kotlin/com/theapache64/klokk/movement/RippleMatrixGenerator.kt index f42fa7d..286bd11 100644 --- a/src/main/kotlin/com/theapache64/klokk/movement/RippleMatrixGenerator.kt +++ b/src/main/kotlin/com/theapache64/klokk/movement/RippleMatrixGenerator.kt @@ -1,17 +1,19 @@ package com.theapache64.klokk.movement import com.theapache64.klokk.COLUMNS +import com.theapache64.klokk.ROWS import com.theapache64.klokk.model.ClockData import com.theapache64.klokk.movement.core.MatrixGenerator import com.theapache64.klokk.movement.core.Movement +import kotlin.math.ceil /** * A ripple matrix with 4x4 mirrored-flipped-matrix */ class RippleMatrixGenerator(data: Movement.Ripple) : MatrixGenerator(data) { companion object { - private const val ROW_CLOCK_COUNT = 4 - private const val COLUMN_CLOCK_COUNT = 8 + private const val ROW_CLOCK_COUNT = ROWS / 2 + private val COLUMN_CLOCK_COUNT = ceil(COLUMNS / 2.toDouble()).toInt() private val rows = mutableListOf>().apply { val startOne = 45f @@ -20,7 +22,7 @@ class RippleMatrixGenerator(data: Movement.Ripple) : MatrixGenerator().apply { generateRow( startNeedleOneDegree = startOne, @@ -41,7 +43,7 @@ class RippleMatrixGenerator(data: Movement.Ripple) : MatrixGenerator().apply { generateRow( startNeedleOneDegree = startOne, @@ -126,7 +128,7 @@ class RippleMatrixGenerator(data: Movement.Ripple) : MatrixGenerator> { return mutableListOf>().apply { - repeat(4) { rowIndex -> + repeat(ROW_CLOCK_COUNT) { rowIndex -> val list = when (ripple.to) { Movement.Ripple.To.START -> mergeHorizontally(grid00, grid01, rowIndex) Movement.Ripple.To.END -> mergeHorizontallyAndFlip(grid00, grid01, rowIndex) @@ -136,7 +138,7 @@ class RippleMatrixGenerator(data: Movement.Ripple) : MatrixGenerator + repeat(ROW_CLOCK_COUNT) { i -> val list = when (ripple.to) { Movement.Ripple.To.START -> mergeHorizontally(grid10, grid11, i) Movement.Ripple.To.END -> mergeHorizontallyAndFlip(grid10, grid11, i) diff --git a/src/main/kotlin/com/theapache64/klokk/movement/core/Movement.kt b/src/main/kotlin/com/theapache64/klokk/movement/core/Movement.kt index d2dd147..c2f41ec 100644 --- a/src/main/kotlin/com/theapache64/klokk/movement/core/Movement.kt +++ b/src/main/kotlin/com/theapache64/klokk/movement/core/Movement.kt @@ -10,7 +10,7 @@ import java.util.* /** * Dynamic animation can't be supported until this fixed -> https://issuetracker.google.com/issues/183220315 */ -const val DEFAULT_ANIMATION_DURATION = 4500 +const val DEFAULT_ANIMATION_DURATION = 1000 sealed class Movement(