jbox2d openGl use 悬浮气泡 碰撞
implementation 'com.github.zylfly:BubbleView:1.0.5'
allprojects {
repositories {
...
maven {
url "https://jitpack.io"
}
}
}
<com.zyl.bubblelibrary.BubbleView
android:id="@+id/bubbleView"
android:layout_width="match_parent"
android:layout_height="334dp" />
bubbleView
.addSmallBit(mImageReSmallId)
.addBigBit(mImageReBigId)
.addSetting()
.addBubbleType {
it.applyType = 0 //两种受力度模式(0或者1)
it.bigWhPx = 184.0f //大图的分辨率
it.smallWhPx = 114.0f//小图的分辨率
it.maxBallRadius = 2.0499995f //大球的半径
it.smallChangeBigValue = 2f //动画范围值
it.animTime = 0.05f //动画的快慢
}.addBubbleClick {
Toast.makeText(this, mImageReSmallId[it].notesExplain, Toast.LENGTH_SHORT).show()
}
override fun onResume() {
super.onResume()
bubbleView.onResume()
}
override fun onPause() {
super.onPause()
bubbleView.onPause()
}
override fun onDestroy() {
super.onDestroy()
bubbleView.destroy()
}