Skip to content

Instantly share code, notes, and snippets.

View damanpreetsb's full-sized avatar
💪
Hustling

Damanpreet Singh damanpreetsb

💪
Hustling
View GitHub Profile
const element = <h1>JSX is cool</h1>;
ReactDOM.render(element, document.getElementById('root'));
.header {
padding: 20px;
background-color: #f1f1f1;
text-align: center;
font-size: 26px;
}
ReactDOM.render(
<h1>Hello, world!</h1>,
document.getElementById('root')
);
ReactDOM.render(<AppComponent name="John Cena"/>, document.getElementById('app'));
class AppComponent extends React.Component {
render() {
return (
<div>
<h1>{this.props.name}</h1>
</div>
);
}
}
val anim = ValueAnimator.ofInt(pizzaCheeseImageView.measuredHeight, height)
anim.addUpdateListener { valueAnimator ->
val value = valueAnimator.animatedValue as Int
val layoutParams = pizzaCheeseImageView.layoutParams
layoutParams.height = value
pizzaCheeseImageView.layoutParams = layoutParams
}
anim.duration = 300
anim.start()
val anim = ValueAnimator.ofInt(pizzaCrustImageView.measuredHeight, height)
anim.addUpdateListener { valueAnimator ->
val value = valueAnimator.animatedValue as Int
val layoutParams = pizzaCrustImageView.layoutParams
layoutParams.height = value
pizzaCrustImageView.layoutParams = layoutParams
pizzaCrustImageView.radius = value.div(2).toFloat()
}
anim.duration = 300
anim.start()
AnimatorSet().apply { play(scaleDownX).with(scaleDownY).with(rotateBox).before(translateX) }
val translateX = ObjectAnimator.ofFloat(backCoverImageView, "translationX", 0f, 1000f)
val rotateBox = ObjectAnimator.ofFloat(backCoverImageView, "rotation", 0f, -45f)