Skip to content

Instantly share code, notes, and snippets.

View thelumiereguy's full-sized avatar

Piyush Pradeepkumar thelumiereguy

View GitHub Profile
@thelumiereguy
thelumiereguy / InfiniteSquareMandala.kt
Last active March 22, 2022 06:12
A example to animate and draw a square-based Mandala on Jetpack Compose's Canvas
import androidx.compose.animation.core.*
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
@thelumiereguy
thelumiereguy / CantorCirclePatternComposable.kt
Last active March 5, 2022 16:50
A Jetpack Compose based example to draw a modified Cantor Circle using recursion
const val MAX_ITERATIONS = 7f
@OptIn(ExperimentalGraphicsApi::class)
@Composable
fun CantorCirclePatternComposable(modifier: Modifier) {
BoxWithConstraints(modifier = Modifier) {
val frame by rememberInfiniteTransition().animateFloat(
@thelumiereguy
thelumiereguy / RippledLinesComposable
Last active February 15, 2022 17:21
A Jetpack Compose based example to draw grid of lines, and rotate them to achieve a ripple effect.
import androidx.compose.animation.core.*
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ExperimentalGraphicsApi
@thelumiereguy
thelumiereguy / Gridception.kt
Last active February 12, 2022 12:00
An example made with K5 Compose (Compose for Desktop) to draw nested grids, each shifted by a certain angle.
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.BlendMode
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ExperimentalGraphicsApi
import androidx.compose.ui.graphics.PointMode
import androidx.compose.ui.graphics.drawscope.translate
import dev.romainguy.kotlin.math.Float2
import dev.romainguy.kotlin.math.Mat2
import k5
import math.toDegrees
@thelumiereguy
thelumiereguy / TorusComposable.kt
Last active March 6, 2023 23:22
A Jetpack Compose based example to draw a Torus on canvas
package com.thelumiereguy.composeanimations.torus
import androidx.compose.animation.core.*
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
@thelumiereguy
thelumiereguy / GetRootElementTest.kt
Created January 2, 2022 05:23
A few tests where I use KtPsiFactory to create a PSI tree out of plain text
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import junit.framework.TestCase
import org.intellij.lang.annotations.Language
import org.jetbrains.kotlin.psi.*
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
@RunWith(JUnit4::class)
class GetRootElementTest : LightJavaCodeInsightFixtureTestCase() {