Skip to content

Instantly share code, notes, and snippets.

Avatar
💪
Hustling

Damanpreet Singh damanpreetsb

💪
Hustling
View GitHub Profile
View JSXExample.jsx
const element = <h1>JSX is cool</h1>;
ReactDOM.render(element, document.getElementById('root'));
View App.css
.header {
padding: 20px;
background-color: #f1f1f1;
text-align: center;
font-size: 26px;
}
View RenderComponent.jsx
ReactDOM.render(
<h1>Hello, world!</h1>,
document.getElementById('root')
);
View MainComponent.jsx
ReactDOM.render(<AppComponent name="John Cena"/>, document.getElementById('app'));
View AppComponent.jsx
class AppComponent extends React.Component {
render() {
return (
<div>
<h1>{this.props.name}</h1>
</div>
);
}
}
View SharedElementTransition.kt
customiseButton.setOnClickListener {
val intent = Intent(this, CustomiseActivity::class.java)
val options = ActivityOptionsCompat
.makeSceneTransitionAnimation(
this,
pizzaImageView as View,
"pizza")
startActivity(intent, options.toBundle())
}
View styles.xml
<item name="android:windowContentTransitions">true</item>
View PlayAnimationsTogether.kt
AnimatorSet().apply {
play(fadeCheese).with(fadeCrust).with(fadeInPizza).with(scaleUpPizzaX).with(scaleUpPizzaY).with(translatePizzaY)
}
View TranslatePizzaYAnimation.kt
val translatePizzaY = ObjectAnimator.ofFloat(pizzaImageView, "translationY", 0f, -360f)
View ScaleUpPizzaYAnimation.kt
val scaleUpPizzaY = ObjectAnimator.ofFloat(pizzaImageView, "scaleY", 0f, 14f)