@ -89,7 +89,7 @@ class CanvasPendulum @JvmOverloads constructor(
var gravity = 0.981f
var gravity = 0.981f
var damping = 0.996f
var damping = 0.996f
if ( mPendulum . stopPosition . x > canvas . width / 4. toFloat ( ) & & mPendulum . stopPosition . x < = canvas . width * 0.75 . toFloat ( ) ) {
if ( mPendulum . stopPosition . x > canvas . width / 4f & & mPendulum . stopPosition . x < = canvas . width * 0.75f ) {
gravity = 1.981f
gravity = 1.981f
if ( mPendulum . stopPosition . x > canvas . width / 3. toFloat ( ) & & mPendulum . stopPosition . x < = canvas . width / 1.5 . toFloat ( ) ) {
if ( mPendulum . stopPosition . x > canvas . width / 3. toFloat ( ) & & mPendulum . stopPosition . x < = canvas . width / 1.5 . toFloat ( ) ) {
@ -128,18 +128,13 @@ class CanvasPendulum @JvmOverloads constructor(
//Origin transition
//Origin transition
mPendulum . stopPosition . x + = mPendulum . startPosition . x
mPendulum . stopPosition . x + = mPendulum . startPosition . x
}
}
}
}
fun startMagnet ( magnet : Boolean ) {
fun startMagnet ( magnet : Boolean ) {
//println("startMagnet")
//println(magnet)
mPendulum . magneticField = magnet
mPendulum . magneticField = magnet
}
}
fun stopMagnet ( magnet : Boolean ) {
fun stopMagnet ( magnet : Boolean ) {
//println("stopMagnet")
//println(magnet)
mPendulum . magneticField = magnet
mPendulum . magneticField = magnet
}
}