Skip to content

Instantly share code, notes, and snippets.

View ardakazanci's full-sized avatar
:bowtie:
E=mc^2

Arda K. ardakazanci

:bowtie:
E=mc^2
View GitHub Profile
@ardakazanci
ardakazanci / TextTweern.kt
Created July 20, 2024 08:15
Text Tween Animation
val colors = listOf(
Color(0xFFF3C623),
Color(0xFFF2AAAA),
Color(0xFFF37121),
Color(0xFFF2AAAA),
Color(0xFF8FC0A9),
Color(0xFF84A9AC),
Color(0xFFD54062),
Color(0xFF8FC0A9)
)
@ardakazanci
ardakazanci / ShaderBrush.kt
Created July 14, 2024 06:56
Jetpack Compose in ShaderBrush
@Composable
fun Modifier.starBackgroundAnimated(): Modifier {
val image = ImageBitmap.imageResource(R.drawable.bg_image)
val transition = rememberInfiniteTransition(label = "")
val offset by transition.animateFloat(
initialValue = 0f,
targetValue = image.width.toFloat(),
animationSpec = infiniteRepeatable(
animation = tween(durationMillis = 10000, easing = LinearEasing),
repeatMode = RepeatMode.Reverse
import androidx.compose.animation.core.tween
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.gestures.AnchoredDraggableState
import androidx.compose.foundation.gestures.DraggableAnchors
import androidx.compose.foundation.gestures.Orientation
import androidx.compose.foundation.gestures.anchoredDraggable
import androidx.compose.foundation.gestures.animateTo
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
@ardakazanci
ardakazanci / AnimatedTextSwitcher.kt
Created June 11, 2024 17:02
Animated Text in Jetpack Compose
@Composable
fun AnimatedTextSwitcher() {
var isYellowBoxVisibility by remember { mutableStateOf(true) }
LaunchedEffect(Unit) {
while (true) {
delay(3000)
isYellowBoxVisibility = !isYellowBoxVisibility
}
}
@ardakazanci
ardakazanci / AutoResizeText.kt
Created June 9, 2024 17:00
Auto Resize Text in Jetpack Compose
@Composable
fun AutoTextSizeCard() {
var textLength by remember { mutableStateOf(50) }
val baseText = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. "
val longText = baseText.repeat(textLength / baseText.length + 1).substring(0, textLength)
Card(
modifier = Modifier
.fillMaxWidth()
@ardakazanci
ardakazanci / ChoasLinesShader.metal
Created May 22, 2024 16:40 — forked from realvjy/ChoasLinesShader.metal
Choas Lines - Metal Shader
// Lines
float hash( float n ) {
return fract(sin(n)*753.5453123);
}
// Slight modification of iq's noise function.
float noise(vector_float2 x )
{
vector_float2 p = floor(x);
vector_float2 f = fract(x);
@ardakazanci
ardakazanci / Place.kt
Created May 19, 2024 09:08 — forked from vishal2376/Place.kt
Image Reflection with cool animation using Jetpack Compose
data class Place(
val name: String,
val resId: Int
)
@ardakazanci
ardakazanci / RulerView.kt
Created April 28, 2024 06:15
RulerView - Jetpack Compose
@Composable
fun RulerView(
startValue: Int,
endValue: Int,
step: Int
) {
val density = LocalDensity.current
val scrollState = rememberScrollState()
val sectionWidth = 80.dp
var sliderValue by remember { mutableFloatStateOf(0.5f) }
@ardakazanci
ardakazanci / Bar.kt
Created April 24, 2024 15:49
Bar with JetpackCompose
data class BarDataM(val value: Float, val label: String)
@Composable
fun BarChartComponent(
bars: List<BarDataM>,
barWidth: Dp,
spaceBetweenBars: Dp,
animateChart: Boolean
) {
var selectedBar by remember { mutableIntStateOf(-1) }
@ardakazanci
ardakazanci / FlipCard.kt
Created April 21, 2024 10:27
Flip Card with Jetpack Compose
@Composable
fun FlipActionScreen() {
var flippedState by remember { mutableStateOf(false) }
val rotationY by animateFloatAsState(
targetValue = if (flippedState) 180f else 0f,
animationSpec = spring(
dampingRatio = Spring.DampingRatioHighBouncy,
stiffness = Spring.StiffnessVeryLow
)
)