Skip to content

Commit

Permalink
◀️ backup
Browse files Browse the repository at this point in the history
  • Loading branch information
theapache64 committed Mar 25, 2021
1 parent e5af342 commit 991f830
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -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<Movement.Ripple>(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<List<ClockData>>().apply {
val startOne = 45f
Expand All @@ -20,7 +22,7 @@ class RippleMatrixGenerator(data: Movement.Ripple) : MatrixGenerator<Movement.Ri
val endOne = 135f
val endTwo = 135f // [last,last]

repeat(4) {
repeat(ROW_CLOCK_COUNT) {
val row = mutableListOf<ClockData>().apply {
generateRow(
startNeedleOneDegree = startOne,
Expand All @@ -41,7 +43,7 @@ class RippleMatrixGenerator(data: Movement.Ripple) : MatrixGenerator<Movement.Ri
val endOne = 360f
val endTwo = 360f // [last,last]

repeat(4) {
repeat(ROW_CLOCK_COUNT) {
val row = mutableListOf<ClockData>().apply {
generateRow(
startNeedleOneDegree = startOne,
Expand Down Expand Up @@ -126,7 +128,7 @@ class RippleMatrixGenerator(data: Movement.Ripple) : MatrixGenerator<Movement.Ri
fun getRippleMatrix(ripple: Movement.Ripple): List<List<ClockData>> {
return mutableListOf<List<ClockData>>().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)
Expand All @@ -136,7 +138,7 @@ class RippleMatrixGenerator(data: Movement.Ripple) : MatrixGenerator<Movement.Ri
add(list)
}

repeat(4) { i ->
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 991f830

Please sign in to comment.