Project-2 Cell Phone Paint

by Mishugana @ 11:04 pm 14 April 2010

Cell Phone paint

createEmptyMovieClip(“pen_mc”,5);
pen_mc.lineStyle(0,0×000000,100);
pen_mc.moveTo(120,160);
var maxBatteryLevel:Number = fscommand2(“GetMaxBatteryLevel”)
var signalStrength:Number;
var hours:Number;
var minutes:Number;

_root.onEnterFrame = function ()
{
getPhoneData();
loadVariables(“accelerometer://data”, _root);
if(isCharging == 1)
{
blueee= random(3);
}

pen_mc.lineStyle(((hours*60)/50),RGBToHex(signalStrength,accY+1000/8,minutes),batteryLevel/blueee);
pen_mc.lineTo(-(-120+accX/4),160+accY/6);
}

function getPhoneData(){

getBatteryLevel();                        // get the battery level

getTime();                                // get hours and minutes

getSignalStrength();                    // get signal strength
}

function getBatteryLevel(){

isCharging = fscommand2(“GetPowerSource”);                            // check if it’s charging or not

var tempLevel:Number = fscommand2(“GetBatteryLevel”);                // get the current battery level

batteryLevel = (Math.round(tempLevel / maxBatteryLevel * 99)+1);        // convert it in a 1 to 5 scale
}

function getTime() {

minutes = fscommand2(“GetTimeMinutes”);                                // get the minutes

hours = fscommand2(“GetTimeHours”);                                    // get the hours
}
function getSignalStrength(){
signalStrength = Math.round(fscommand2(“GetSignalLevel”)*40)+1;
}
function RGBToHex (r, g, b ){
var hex = r << 16 ^ g << 8 ^ b;
return hex;
}

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2016 Special Topics in Interactive Art & Computational Design | powered by WordPress with Barecity