const iPhoneFramePallete = {frame:"#111122", button:"#eeeeee"}
{base:"#CAE7ED", upper:"#CAE7ED", lower:"#FFFBD5", chat:"#FFFBBD", text:"#6B8A87", upperTxt:"#49809E"},
const JapaneseSyllabaryHiragana = "あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをんがぎぐげござじずぜぞだぢづでどばびぶべぼぱぴぷぺぽぁぃぅぇぉっゃゅょ";
const HiraganaArr = [...JapaneseSyllabaryHiragana];
const JapaneseSyllabaryKatakana = "アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲンガギグゲゴザジズゼゾダヂヅデドバビブベボパピプペポァィゥェォッャュョ"
const KatakanaArr = [...JapaneseSyllabaryKatakana];
const LanguageShape = [0, 1, 2, 3, 4, 10, 11, 12, 13, 14, 20, 21, 22, 23, 24, 30, 31, 32, 33, 34, 40, 41, 42, 43, 44, 50, 51, 52, 53, 54, 60, 61, 62, 63, 64, 70, 72, 74, 80, 81, 82, 83, 84, 90, 91, 93, 94, 100, 110, 111, 112, 113, 114, 120, 121, 122, 123, 124, 130, 131, 132, 133, 134, 140, 141, 142, 143, 144, 150, 151, 152, 153, 154, 160, 161, 162, 163, 164, 172, 180, 182, 184];
let upperPartsNumArr = [];
let lowerPartsNumArr = [];
const ChatTxtArr = ["こんにちは", "おはよう", "さようなら", "こんばんは", "たのしいです", "なんでやねん", "さむいです"]
const person = ["me", "you"];
const animetionCount = 40;
let backgroundAnimations = [];
font = loadFont("SawarabiGothic-Regular.ttf");
colorPallete = random(colorPalletes);
for(let i = 0; i < 20; i ++){
upperPartsNumArr.push(i);
for(let i = 0; i < 5; i ++){
lowerPartsNumArr.push(i);
upperPartsNumArr = shuffle(upperPartsNumArr);
lowerPartsNumArr = shuffle(lowerPartsNumArr);
for(let i = 0; i < animetionCount; i ++){
backgroundAnimations.push(new BackgroundAnimation());
background(colorPallete.base);
for(let i in backgroundAnimations){
backgroundAnimations[i].draw();
if (frameCount % 200 == 100) {
for (let i in chatBubbles) {
chatBubbles.push(new ChatBubble(random(person), random(ChatTxtArr), colorPallete.text, colorPallete.chat));
for (let i in chatBubbles) {
chatBubbles[i].draw(isChange);
if (chatBubbles[i].position.y < 0) {
chatBubbles.splice(i, 1);
(upperFrameColor = colorPallete.upper),
(lowerFrameColor = colorPallete.lower),
(chatBoxColor = colorPallete.text),
(addressName = "Click, and you'll change languages"),
(addressNameTextColor = colorPallete.upperTxt),
(chatBoxText = "- - - - - -"),
(chatBoxTextColor = colorPallete.chat)
drawingiPhoneFrame((frameColor = iPhoneFramePallete.frame), (buttonColor = iPhoneFramePallete.button));
circle(mouseX, mouseY, width/30)
function drawingUpperPart(partNum, x, y, s) {
switch (partNum % partsCount) {
line(x + s / 10, y + s / 4, x + (s * 9) / 10, y + s / 4);
line(x + s / 2, y + s / 4, x + s / 2, y + s / 8);
line(x + s / 10, y + s / 4, x + (s * 9) / 10, y + s / 4);
line(x + s / 2, y + (s * 3) / 8, x + s / 2, y + s / 8);
line(x + s / 10, y + s / 4, x + s / 2, y + s / 8);
line(x + (s * 9) / 10, y + s / 4, x + s / 2, y + s / 8);
line(x + s / 10, y + s / 4, x + s / 2, y + (s * 3) / 8);
line(x + (s * 9) / 10, y + s / 4, x + s / 2, y + (s * 3) / 8);
line(x + s / 10, y + s / 4, x + s / 2, y + s / 8);
line(x + (s * 9) / 10, y + s / 4, x + s / 2, y + s / 8);
line(x + s / 2, y + (s * 3) / 8, x + s / 2, y + s / 8);
line(x + s / 10, y + s / 4, x + s / 2, y + (s * 3) / 8);
line(x + (s * 9) / 10, y + s / 4, x + s / 2, y + (s * 3) / 8);
line(x + s / 2, y + (s * 3) / 8, x + s / 2, y + s / 8);
line(x + s / 10, y + s / 4, x + (s * 9) / 10, y + s / 4);
line(x + s / 4, y + s / 4, x + s / 4, y + s / 8);
line(x + (s * 3) / 4, y + s / 4, x + (s * 3) / 4, y + s / 8);
line(x + s / 10, y + s / 4, x + (s * 9) / 10, y + s / 4);
line(x + s / 4, y + (s * 3) / 8, x + s / 4, y + s / 8);
line(x + (s * 3) / 4, y + (s * 3) / 8, x + (s * 3) / 4, y + s / 8);
line(x + s / 10, y + s / 4, x + s / 2, y + s / 8);
line(x + (s * 9) / 10, y + s / 4, x + s / 2, y + s / 8);
line(x + s / 4, y + (s * 3) / 8, x + s / 4, y + s / 8);
line(x + (s * 3) / 4, y + (s * 3) / 8, x + (s * 3) / 4, y + s / 8);
line(x + s / 10, y + s / 4, x + s / 2, y + (s * 3) / 8);
line(x + (s * 9) / 10, y + s / 4, x + s / 2, y + (s * 3) / 8);
line(x + s / 4, y + (s * 3) / 8, x + s / 4, y + s / 8);
line(x + (s * 3) / 4, y + (s * 3) / 8, x + (s * 3) / 4, y + s / 8);
line(x + s / 10, y + (s * 2) / 10, x + (s * 9) / 10, y + (s * 2) / 10);
line(x + s / 10, y + (s * 3) / 10, x + (s * 9) / 10, y + (s * 3) / 10);
line(x + s / 10, y + (s * 2) / 10, x + (s * 9) / 10, y + (s * 2) / 10);
line(x + s / 10, y + (s * 3) / 10, x + (s * 9) / 10, y + (s * 3) / 10);
line(x + s / 2, y + (s * 3) / 8, x + s / 2, y + s / 8);
line(x + s / 10, y + (s * 2) / 10, x + (s * 9) / 10, y + (s * 2) / 10);
line(x + s / 10, y + (s * 3) / 10, x + (s * 9) / 10, y + (s * 3) / 10);
line(x + s / 4, y + (s * 3) / 8, x + s / 4, y + s / 8);
line(x + (s * 3) / 4, y + (s * 3) / 8, x + (s * 3) / 4, y + s / 8);
line(x + s / 10, y + s / 4, x + (s * 9) / 10, y + s / 4);
line(x + s / 4, y + s / 4, x + (s * 3) / 4, y + s / 8);
line(x + s / 10, y + s / 4, x + (s * 9) / 10, y + s / 4);
line(x + s / 4, y + (s * 3) / 8, x + (s * 3) / 4, y + s / 8);
line(x + s / 10, y + s / 4, x + s / 2, y + s / 8);
line(x + (s * 9) / 10, y + s / 4, x + s / 2, y + s / 8);
line(x + s / 4, y + (s * 3) / 8, x + (s * 3) / 4, y + s / 8);
line(x + s / 10, y + s / 4, x + s / 2, y + (s * 3) / 8);
line(x + (s * 9) / 10, y + s / 4, x + s / 2, y + (s * 3) / 8);
line(x + s / 4, y + (s * 3) / 8, x + (s * 3) / 4, y + s / 8);
line(x + s / 10, y + s / 4, x + (s * 9) / 10, y + s / 4);
line(x + (s * 3) / 4, y + s / 4, x + s / 4, y + s / 8);
line(x + s / 10, y + s / 4, x + (s * 9) / 10, y + s / 4);
line(x + (s * 3) / 4, y + (s * 3) / 8, x + s / 4, y + s / 8);
line(x + s / 10, y + s / 4, x + s / 2, y + s / 8);
line(x + (s * 9) / 10, y + s / 4, x + s / 2, y + s / 8);
line(x + (s * 3) / 4, y + (s * 3) / 8, x + s / 4, y + s / 8);
line(x + s / 10, y + s / 4, x + s / 2, y + (s * 3) / 8);
line(x + (s * 9) / 10, y + s / 4, x + s / 2, y + (s * 3) / 8);
line(x + (s * 3) / 4, y + (s * 3) / 8, x + s / 4, y + s / 8);
function drawingLowerPart(partNum, x, y, s) {
switch (partNum % partsCount) {
rect(x + s / 10, y + s / 2, (s * 8) / 10, s / 3);
rect(x + s / 10, y + s / 2, (s * 8) / 10, s / 3);
rect(x + (s * 2) / 10, y + s / 2, (s * 6) / 10, s / 3);
line(x + s / 10, y + (s * 3) / 4, x + (s * 9) / 10, y + (s * 3) / 4);
line(x + s / 10, y + (s * 3) / 4, x + (s * 9) / 10, y + (s * 3) / 4);
line(x + s / 2, y + (s * 5) / 8, x + s / 2, y + (s * 7) / 8);
function toTenthRank(num){
function languageShapeArr(word, originalLanguageArr, languageShape){
const wordArr = [...word];
let index = originalLanguageArr.indexOf(wordArr[i]);
returnWordArr.push(languageShape[index])
constructor(person, chatTxt, textColor, chatColor) {
this.position = createVector(width / 2, height * 0.83);
this.size = createVector(width * 0.6, height * 0.05);
this.round = height * 0.015;
this.chatSounrceTxt = chatTxt;
this.chatChangeArr = languageShapeArr(this.chatSounrceTxt, HiraganaArr, LanguageShape);
this.textColor = textColor;
this.chatColor = chatColor;
this.position.y -= this.size.y * 1.5;
const iconDist = width*0.4;
circle(this.position.x+iconDist, this.position.y, this.size.y*0.7);
triangle(this.position.x+iconDist*0.85, this.position.y, this.position.x + this.size.x/3 , this.position.y - this.size.y/3, this.position.x + this.size.x/3, this.position.y + this.size.y/3);
circle(this.position.x-iconDist, this.position.y, this.size.y*0.7);
triangle(this.position.x-iconDist*0.85, this.position.y, this.position.x - this.size.x/3 , this.position.y - this.size.y/3, this.position.x - this.size.x/3, this.position.y + this.size.y/3)
for(let i in this.chatChangeArr){
drawingUpperPart(toTenthRank(this.chatChangeArr[i]), this.position.x-this.size.x*0.41 + height * 0.03 * i, this.position.y-this.size.y*0.23, height * 0.025);
drawingLowerPart(toOneRank(this.chatChangeArr[i]), this.position.x-this.size.x*0.41 + height * 0.03 * i, this.position.y-this.size.y*0.23, height * 0.025);
text(this.chatSounrceTxt, this.position.x-this.size.x*0.4, this.position.y+this.size.y*0.1)
function drawingiPhoneFrame(frameColor, buttonColor) {
strokeWeight(width * 0.1);
rect(0, 0, width, height);
rect(0, 0, width, height * 0.07);
rect(0, height * 0.93, width, height * 0.07);
circle(width / 2, height * 0.965, height * 0.05);
function drawingChatFrame(
rect(0, height * 0.07, width, height * 0.07);
rect(0, height * 0.88, width, height * 0.05);
fill(addressNameTextColor);
textSize(height * 0.022);
text(addressName, width / 2, height * 0.112);
textSize(height * 0.015);
text(chatBoxText, width * 0.2, height * 0.91);
class BackgroundAnimation{
this.position = createVector(random(width), random(-150, -100));
this.velocity = createVector(0, random(0.1, 1));
this.rotateSpeed = random([-1, 1]) * random(100, 300);
this.size = random(5, 10);
this.color = random(240, 255)
this.position.add(this.velocity);
if(this.position.y > height + 200){
this.position.y = random(-200, -100);
translate(this.position.x, this.position.y);
rotate(frameCount/this.rotateSpeed);
rect(0, 0, this.size, this.size);