Class: $.AccelMagView

Inherits:
WatchUi.View show all

Overview

View class for the AccelMag. This class also implements the business logic

Constant Summary

Constant Variables

Type Name Value Since Description
Type _arrowLen 25.0
Type _hitForce 50.0
Type _incrFrict 15
Type _pcntFrict 99
Type _r 10
Type _velocityToPix 0.004
Type _wallLoss 80

Instance Member Summary collapse

Instance Method Summary collapse

Instance Attribute Details

var _accel as Lang.Array<Lang.Float>

var _dataTimer as Timer.Timer or Null

var _height as Lang.Numeric

var _mag as Lang.Array<Lang.Float>

var _width as Lang.Numeric

var _x as Lang.Numeric

var _xMult as Lang.Numeric

var _xVelocity as Lang.Numeric

var _y as Lang.Numeric

var _yMult as Lang.Numeric

var _yVelocity as Lang.Numeric

Instance Method Details

initialize()

Constructor

kickBall() as Void

Kick the ball

onHide() as Void

Called when this View is removed from the screen. Save the state of your app here.

onLayout(dc as Graphics.Dc)

Initialize members based on the screen resolution

Parameters:

  • dc —

    Draw context

onShow() as Void

Restore the state of the app and prepare the view to be shown

onUpdate(dc as Graphics.Dc) as Void

Update the view

Parameters:

  • dc —

    Device context

timerCallback() as Void

On a timer interval, read the accelerometer and update the ball position


Generated Oct 20, 2026, 8:20:22 AM