xxxxxxxxxx
527
var input, button, reset, greeting;
function setup() {
// create canvas
bg = loadImage("https://68.media.tumblr.com/3db21de869d8f243c4e458820ba78bce/tumblr_onni8vlNhF1vg4kuko1_1280.jpg");
createCanvas(850, 650);
resetSketch();
input = createInput();
input.position(25, 550);
button = createButton('submit');
button.position(input.x + input.width, 550);
button.mousePressed(greet);
greeting = createElement('h1', 'Daily Social Forecast!<br /><br />Type your name to begin.');
greeting.position(20, 5);
greeting.style("font-family", "monospace");
greeting.style("color", "#000");
greeting.style("font-size", "24pt");
var reset = createButton('reset')
reset.position(input.x + input.width *1.35, 550);
reset.mousePressed(resetSketch);
}
function resetSketch(){
removeElements();
input = createInput();
input.position(25, 550);
button = createButton('submit');
button.position(input.x + input.width, 550);
button.mousePressed(greet);
greeting = createElement('h1', 'Daily Social Forecast!<br /><br />Type your name to begin.');
greeting.position(20, 5);
greeting.style("font-family", "monospace");
greeting.style("color", "#000");
greeting.style("font-size", "24pt");
var reset = createButton('reset')
reset.position(input.x + input.width *1.35, 550);
reset.mousePressed(resetSketch);
}
function draw() {
background(bg);
textSize(12);
text("Image: CC0 liscence from pixabay.com", 625, 625);
fill(0);
}
function greet() {
var name = input.value();
var number1 = floor(random(0, 150));
var number2 = floor(random(0, 150));
var number3 = floor(random(0, 150));
var mediaPosts1 = postType[floor(random(postType.length))];
var mediaPosts2 = postType[floor(random(postType.length))];
var mediaPosts3 = postType[floor(random(postType.length))];
var mood = traits[floor(random(traits.length))];
var socialMedia1 = media[floor(random(media.length))];
var socialMedia2 = media[floor(random(media.length))];
greeting.html('Hello ' + name + '!<br /> <br /> It will be a(n) ' + mood +
' day!<br /> <br/>You will have:<br /><br /> ' + number1 +
' ' + mediaPosts1 + ', <br />' + number2 + ' ' + mediaPosts2 + '<br /> and ' + number3 +
' ' + mediaPosts3 + '!<br /><br /> Your activity on ' + socialMedia1 +
' looks Fortutitous!<br /> <br /> Avoid ' + socialMedia2 + ' today!');
input.value('');
}
var traits = [
"able",
"abnormal",
"absent-minded",
"above average",
"adventurous",
"affectionate",
"agile",
"agreeable",
"alert",
"amazing",
"ambitious",
"amiable",
"amusing",
"analytical",
"angelic",
"apathetic",
"apprehensive",
"ardent",
"artificial",
"artistic",
"assertive",
"attentive",
"average",
"awesome",
"awful",
"balanced",
"beautiful",
"below average",
"beneficent",
"blue",
"blunt",
"boisterous",
"brave",
"bright",
"brilliant",
"buff",
"callous",
"candid",
"cantankerous",
"capable",
"careful",
"careless",
"caustic",
"cautious",
"charming",
"childish",
"childlike",
"cheerful",
"chic",
"churlish",
"circumspect",
"civil",
"clean",
"clever",
"clumsy",
"coherent",
"cold",
"competent",
"composed",
"conceited",
"condescending",
"confident",
"confused",
"conscientious",
"considerate",
"content",
"cool",
"cool-headed",
"cooperative",
"cordial",
"courageous",
"cowardly",
"crabby",
"crafty",
"cranky",
"crass",
"critical",
"cruel",
"curious",
"cynical",
"dainty",
"decisive",
"deep",
"deferential",
"deft",
"delicate",
"demonic",
"dependent",
"delightful",
"demure",
"depressed",
"devoted",
"dextrous",
"diligent",
"direct",
"dirty",
"disagreeable",
"discerning",
"discreet",
"disruptive",
"distant",
"distraught",
"distrustful",
"dowdy",
"dramatic",
"dreary",
"drowsy",
"drugged",
"drunk",
"dull",
"dutiful",
"eager",
"earnest",
"easy-going",
"efficient",
"egotistical",
"elfin",
"emotional",
"energetic",
"enterprising",
"enthusiastic",
"evasive",
"even-tempered",
"exacting",
"excellent",
"excitable",
"experienced",
"fabulous",
"fastidious",
"ferocious",
"fervent",
"fiery",
"flabby",
"flaky",
"flashy",
"frank",
"friendly",
"funny",
"fussy",
"generous",
"gentle",
"gloomy",
"glutinous",
"good",
"grave",
"great",
"groggy",
"grouchy",
"guarded",
"hateful",
"hearty",
"helpful",
"hesitant",
"hot-headed",
"hypercritical",
"hysterical",
"idiotic",
"idle",
"illogical",
"imaginative",
"immature",
"immodest",
"impatient",
"imperturbable",
"impetuous",
"impractical",
"impressionable",
"impressive",
"impulsive",
"inactive",
"incisive",
"incompetent",
"inconsiderate",
"inconsistent",
"independent",
"indiscreet",
"indolent",
"indefatigable",
"industrious",
"inexperienced",
"insensitive",
"inspiring",
"intelligent",
"interesting",
"intolerant",
"inventive",
"irascible",
"irritable",
"irritating",
"jocular",
"jovial",
"joyous",
"judgmental",
"keen",
"kind",
"lame",
"lazy",
"lean",
"leery",
"lethargic",
"level-headed",
"listless",
"lithe",
"lively",
"local",
"logical",
"long-winded",
"lovable",
"love-lorn",
"lovely",
"maternal",
"mature",
"mean",
"meddlesome",
"mercurial",
"methodical",
"meticulous",
"mild",
"miserable",
"modest",
"moronic",
"morose",
"motivated",
"musical",
"naive",
"nasty",
"natural",
"naughty",
"negative",
"nervous",
"noisy",
"normal",
"nosy",
"numb",
"obliging",
"obnoxious",
"old-fashioned",
"one-sided",
"orderly",
"ostentatious",
"outgoing",
"outspoken",
"passionate",
"passive",
"paternal",
"paternalistic",
"patient",
"peaceful",
"peevish",
"pensive",
"persevering",
"persnickety",
"petulant",
"picky",
"plain",
"plain-speaking",
"playful",
"pleasant",
"plucky",
"polite",
"popular",
"positive",
"powerful",
"practical",
"prejudiced",
"pretty",
"proficient",
"proud",
"provocative",
"prudent",
"punctual",
"quarrelsome",
"querulous",
"quick",
"quick-tempered",
"quiet",
"realistic",
"reassuring",
"reclusive",
"reliable",
"reluctant",
"resentful",
"reserved",
"resigned",
"resourceful",
"respected",
"respectful",
"responsible",
"restless",
"revered",
"ridiculous",
"sad",
"sassy",
"saucy",
"sedate",
"self-assured",
"selfish",
"sensible",
"sensitive",
"sentimental",
"serene",
"serious",
"sharp",
"short-tempered",
"shrewd",
"shy",
"silly",
"sincere",
"sleepy",
"slight",
"sloppy",
"slothful",
"slovenly",
"slow",
"smart",
"snazzy",
"sneering",
"snobby",
"somber",
"sober",
"sophisticated",
"soulful",
"soulless",
"sour",
"spirited",
"spiteful",
"stable",
"staid",
"steady",
"stern",
"stoic",
"striking",
"strong",
"stupid",
"sturdy",
"subtle",
"sullen",
"sulky",
"supercilious",
"superficial",
"surly",
"suspicious",
"sweet",
"tactful",
"tactless",
"talented",
"testy",
"thinking",
"thoughtful",
"thoughtless",
"timid",
"tired",
"tolerant",
"touchy",
"tranquil",
"ugly",
"unaffected",
"unbalanced",
"uncertain",
"uncooperative",
"undependable",
"unemotional",
"unfriendly",
"unguarded",
"unhelpful",
"unimaginative",
"unmotivated",
"unpleasant",
"unpopular",
"unreliable",
"unsophisticated",
"unstable",
"unsure",
"unthinking",
"unwilling",
"venal",
"versatile",
"vigilant",
"warm",
"warmhearted",
"wary",
"watchful",
"weak",
"well-behaved",
"well-developed",
"well-intentioned",
"well-respected",
"well-rounded",
"willing",
"wonderful",
"volcanic",
"vulnerable",
"zealous"
];
var media = [
"Facebook",
"Tumblr",
"Twitter",
"YouTube",
"Instagram",
"Snapchat",
"Tindr",
"Skype",
"Discord",
"WhatsApp",
"Slack",
"LinkedIn",
"Steam",
"Twitch",
"Pinterest",
];
var postType = [
"Facebook posts",
"Facebook comments",
"Facebook likes",
"Twitter posts",
"Retweets",
"YouTube uploads",
"YouTube comments",
"Instagram posts",
"Instagram comments",
"Snaps",
"Swipes Left",
"Swipes Right",
"Emails",
"Skype messages",
"Discord messages",
"WhatsApp messages",
"Slack messages",
"LinkedIn messages",
"LinkedIn replies",
"Pins",
"Tumblr posts",
"Tumblr likes",
"Tumblr reblogs",
"Tumblr asks",
"Tumblr replies",
"Instagram shares",
"Twitch messages",
"Steam messages",
];