Apps Home
|
My Uploads
|
Create an App
LucyHitachi
Author:
frenchy4lucy
Description
Source Code
Launch App
Current Users
Created by:
Frenchy4lucy
App Images
var BACKGROUND_IMAGE= 'fb2d46b5-9032-4070-b197-4574072a83a3'; var STATUS = "OFF"; var LEVEL = 0; var TIMER = 0; var LABEL_COLOR = "black"; var VALUE_COLOR = "pink"; var FONT_SIZE = 12; var displayStatus = function() { return TIMER > 0 ? "ON" : "OFF"; }; var getLevel = function() { var level = Math.ceil(TIMER / 10); if (level > 7) level = 7; return level; }; var displayLevelLabel = function() { var levelLabels = { "0": "OFF", "1": "VERY SLOW (1)", "2": "SLOW (2)", "3": "MEDIUM (3)", "4": "MEDIUM+ (4)", "5": "FAST (5)", "6": "VERY FAST (6)", "7": "ULTRA FAST (7)"}; return levelLabels[getLevel()]; } var displayRemaningTime = function() { var remaingTime = TIMER + " second"; if (TIMER > 1) remaingTime += "s"; return remaingTime; }; var updateTimer = function(seconds) { TIMER += seconds; }; var setInterval = function(callback, duration) { var tick = function() { callback(); cb.setTimeout(tick, duration); }; tick(); }; var OFF = true; setInterval(function() { if (TIMER > 0) { OFF = false; TIMER--; } if (TIMER == 10) { cb.sendNotice("The Hitachi is about to stop. Will you be the one keeping it on?..", "", "#fff", "#c8d", "bold", ""); } if (TIMER == 0 && !OFF) { cb.sendNotice("The Hitachi has stopped. Tip if you want to turn it on again!", "", "#fff", "#c8d", "bold", ""); OFF = true; } cb.drawPanel(); }, 1000); cb.onTip(function (tip) { var additionalTime= Math.round(parseInt(tip['amount']) / 20); updateTimer(additionalTime); cb.sendNotice(tip["from_user"] + " tipped " + tip['amount'] + " and added " + additionalTime+ " seconds to the timer. Thank you!", "", "#c8d", "#fff", "bold", ""); cb.sendNotice("The Hitachi will be set to " + displayLevelLabel() + ".", "", "#fff", "#c8d", "bold", ""); }); cb.onDrawPanel(function(user) { return { "template": "image_template", "layers": [ {'type': 'image', 'fileID': BACKGROUND_IMAGE}, { 'type': 'text', 'text': "Status :", 'top': 15, 'left': 98, 'font-size': FONT_SIZE, 'color': "black", }, { 'type': 'text', 'text': "Level :", 'top': 31, 'left': 98, 'font-size': FONT_SIZE, 'color': LABEL_COLOR , }, { 'type': 'text', 'text': "Timer :", 'top': 46, 'left': 98, 'font-size': FONT_SIZE, 'color': LABEL_COLOR , }, { 'type': 'text', 'text': displayStatus(), 'top': 15, 'left': 150, 'font-size': FONT_SIZE, 'color': VALUE_COLOR , }, { 'type': 'text', 'text': displayLevelLabel(), 'top': 31, 'left': 150, 'font-size': FONT_SIZE, 'color': VALUE_COLOR , }, { 'type': 'text', 'text': displayRemaningTime(), 'top': 46, 'left': 150, 'font-size': FONT_SIZE, 'color': VALUE_COLOR , }, ], }; }); cb.drawPanel();
© Copyright Chaturbate 2011- 2025. All Rights Reserved.