Skip to content

Instantly share code, notes, and snippets.

View 5AbhishekSaxena's full-sized avatar
Tryin'

Abhishek Saxena 5AbhishekSaxena

Tryin'
View GitHub Profile
@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
)
)
@KlassenKonstantin
KlassenKonstantin / ClippedForeground.kt
Last active May 6, 2024 04:06
evervault.com inspired animation
import androidx.compose.foundation.layout.Box
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.drawWithContent
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.BlendMode
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.nativeCanvas
@Composable
import android.annotation.SuppressLint
import androidx.compose.animation.animateColor
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.AnimationVector1D
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.tween
import androidx.compose.animation.core.updateTransition
import androidx.compose.foundation.Image
import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.foundation.layout.fillMaxSize
@c5inco
c5inco / SwipeableCards.kt
Last active April 21, 2024 13:06
Jetpack Compose implementation of inspiration: https://twitter.com/philipcdavis/status/1534192823792128000
package des.c5inco.cardswipecompose
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.CubicBezierEasing
import androidx.compose.animation.core.LinearOutSlowInEasing
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.calculateTargetValue
import androidx.compose.animation.core.keyframes
import androidx.compose.animation.splineBasedDecay
@antocara
antocara / gist:5fb2904df2c7de34ebe9
Last active September 16, 2023 06:22
Convert View to Bitmap Android
private void savedBitmapFromViewToFile(){
//inflate layout
View layout = LayoutInflater.from(this).inflate(R.layout.activity_main, null, false);
RelativeLayout mContImage = (RelativeLayout) layout.findViewById(R.id.image_cont);
//reference View with image
mContImage.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
Bitmap bitmap = Bitmap.createBitmap(mContImage.getMeasuredWidth(), mContImage.getMeasuredHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
mContImage.layout(0, 0, mContImage.getMeasuredWidth(), mContImage.getMeasuredHeight());