(function() { 'use strict'; // Face shapes (8 options) var FACE_SHAPES = [ { id: 'round', name: 'Round', widthRatio: 1.0, heightRatio: 1.0, jawCurve: 0.9 }, { id: 'oval', name: 'Oval', widthRatio: 0.85, heightRatio: 1.1, jawCurve: 0.7 }, { id: 'square', name: 'Square', widthRatio: 1.0, heightRatio: 0.95, jawCurve: 0.3 }, { id: 'heart', name: 'Heart', widthRatio: 0.9, heightRatio: 1.05, jawCurve: 0.8, chinPoint: 0.6 }, { id: 'long', name: 'Long', widthRatio: 0.8, heightRatio: 1.2, jawCurve: 0.5 }, { id: 'wide', name: 'Wide', widthRatio: 1.15, heightRatio: 0.9, jawCurve: 0.6 }, { id: 'angular', name: 'Angular', widthRatio: 0.95, heightRatio: 1.0, jawCurve: 0.2, cheekbones: 0.7 }, { id: 'soft', name: 'Soft', widthRatio: 1.05, heightRatio: 1.0, jawCurve: 0.95 } ]; // Skin tones (20 options - full diversity) var SKIN_TONES = [ { id: 'fair1', hex: '#FFECD1', name: 'Porcelain' }, { id: 'fair2', hex: '#FFE4C4', name: 'Ivory' }, { id: 'fair3', hex: '#FFDAB9', name: 'Peach' }, { id: 'fair4', hex: '#FFD5B5', name: 'Cream' }, { id: 'light1', hex: '#F5D0A9', name: 'Light Beige' }, { id: 'light2', hex: '#E8C49A', name: 'Warm Beige' }, { id: 'light3', hex: '#DEB887', name: 'Sand' }, { id: 'medium1', hex: '#D4A373', name: 'Golden' }, { id: 'medium2', hex: '#C9A06A', name: 'Honey' }, { id: 'medium3', hex: '#BC8F5F', name: 'Caramel' }, { id: 'medium4', hex: '#B07D4B', name: 'Toffee' }, { id: 'tan1', hex: '#A67B5B', name: 'Tan' }, { id: 'tan2', hex: '#996B4D', name: 'Bronze' }, { id: 'tan3', hex: '#8B6D4C', name: 'Cinnamon' }, { id: 'brown1', hex: '#7D5A3C', name: 'Chestnut' }, { id: 'brown2', hex: '#6F4E37', name: 'Cocoa' }, { id: 'brown3', hex: '#5D4532', name: 'Espresso' }, { id: 'dark1', hex: '#4E3B2D', name: 'Mocha' }, { id: 'dark2', hex: '#3D2B1F', name: 'Ebony' }, { id: 'dark3', hex: '#2C1F15', name: 'Onyx' } ]; // Eye shapes (12 options) var EYE_SHAPES = [ { id: 'round', name: 'Round', width: 0.15, height: 0.12, curve: 1.0 }, { id: 'almond', name: 'Almond', width: 0.18, height: 0.08, curve: 0.6 }, { id: 'oval', name: 'Oval', width: 0.16, height: 0.10, curve: 0.8 }, { id: 'narrow', name: 'Narrow', width: 0.20, height: 0.06, curve: 0.4 }, { id: 'wide', name: 'Wide', width: 0.19, height: 0.11, curve: 0.7 }, { id: 'droopy', name: 'Droopy', width: 0.17, height: 0.09, curve: 0.5, droop: 0.3 }, { id: 'upturned', name: 'Upturned', width: 0.17, height: 0.09, curve: 0.6, upturn: 0.3 }, { id: 'cat', name: 'Cat', width: 0.18, height: 0.07, curve: 0.4, upturn: 0.5 }, { id: 'sleepy', name: 'Sleepy', width: 0.16, height: 0.07, curve: 0.5, lidDroop: 0.4 }, { id: 'surprised', name: 'Surprised', width: 0.16, height: 0.14, curve: 1.0 }, { id: 'angry', name: 'Angry', width: 0.17, height: 0.08, curve: 0.5, innerAngle: -0.2 }, { id: 'happy', name: 'Happy', width: 0.17, height: 0.08, curve: 0.7, squint: 0.3 } ]; // Eye colors (16 options) var EYE_COLORS = [ { id: 'brown', hex: '#634e34', name: 'Brown' }, { id: 'darkBrown', hex: '#3d2314', name: 'Dark Brown' }, { id: 'hazel', hex: '#8b7355', name: 'Hazel' }, { id: 'green', hex: '#3d7a3d', name: 'Green' }, { id: 'blue', hex: '#4682b4', name: 'Blue' }, { id: 'lightBlue', hex: '#87ceeb', name: 'Light Blue' }, { id: 'gray', hex: '#708090', name: 'Gray' }, { id: 'amber', hex: '#b8860b', name: 'Amber' }, { id: 'violet', hex: '#8b008b', name: 'Violet' }, { id: 'emerald', hex: '#50c878', name: 'Emerald' }, { id: 'iceBlue', hex: '#a5d8e6', name: 'Ice Blue' }, { id: 'gold', hex: '#daa520', name: 'Gold' }, { id: 'red', hex: '#8b0000', name: 'Red' }, { id: 'black', hex: '#1a1a1a', name: 'Black' }, { id: 'honey', hex: '#c9a06a', name: 'Honey' }, { id: 'turquoise', hex: '#40e0d0', name: 'Turquoise' } ]; // Eyebrow shapes (10 options) var EYEBROW_SHAPES = [ { id: 'natural', name: 'Natural', thickness: 0.5, arch: 0.3 }, { id: 'arched', name: 'Arched', thickness: 0.5, arch: 0.6 }, { id: 'straight', name: 'Straight', thickness: 0.5, arch: 0.0 }, { id: 'thick', name: 'Thick', thickness: 0.8, arch: 0.3 }, { id: 'thin', name: 'Thin', thickness: 0.25, arch: 0.3 }, { id: 'angry', name: 'Angry', thickness: 0.5, arch: 0.2, innerAngle: -0.4 }, { id: 'worried', name: 'Worried', thickness: 0.5, arch: 0.4, innerAngle: 0.3 }, { id: 'bushy', name: 'Bushy', thickness: 0.9, arch: 0.2, wild: true }, { id: 'sleek', name: 'Sleek', thickness: 0.3, arch: 0.5 }, { id: 'curved', name: 'Curved', thickness: 0.5, arch: 0.7 } ]; // Nose shapes (8 options) var NOSE_SHAPES = [ { id: 'button', name: 'Button', width: 0.12, length: 0.15 }, { id: 'pointed', name: 'Pointed', width: 0.10, length: 0.22 }, { id: 'roman', name: 'Roman', width: 0.14, length: 0.25, bridge: 0.6 }, { id: 'snub', name: 'Snub', width: 0.13, length: 0.12, upturn: 0.4 }, { id: 'wide', name: 'Wide', width: 0.18, length: 0.18 }, { id: 'narrow', name: 'Narrow', width: 0.08, length: 0.20 }, { id: 'aquiline', name: 'Aquiline', width: 0.12, length: 0.24, bridge: 0.8 }, { id: 'flat', name: 'Flat', width: 0.16, length: 0.10 } ]; // Mouth shapes (10 options) var MOUTH_SHAPES = [ { id: 'smile', name: 'Smile', width: 0.25, curve: 0.3 }, { id: 'neutral', name: 'Neutral', width: 0.22, curve: 0 }, { id: 'grin', name: 'Grin', width: 0.30, curve: 0.5, showTeeth: true }, { id: 'smirk', name: 'Smirk', width: 0.22, curve: 0.2, asymmetric: true }, { id: 'pout', name: 'Pout', width: 0.20, curve: -0.2, lipFullness: 0.8 }, { id: 'open', name: 'Open', width: 0.24, curve: 0.1, openness: 0.3 }, { id: 'small', name: 'Small', width: 0.16, curve: 0.1 }, { id: 'wide', name: 'Wide', width: 0.32, curve: 0.1 }, { id: 'thin', name: 'Thin', width: 0.24, curve: 0, lipFullness: 0.3 }, { id: 'full', name: 'Full', width: 0.26, curve: 0.15, lipFullness: 0.9 } ]; // Ear shapes (6 options) var EAR_SHAPES = [ { id: 'normal', name: 'Normal', size: 1.0, angle: 0 }, { id: 'small', name: 'Small', size: 0.7, angle: 0 }, { id: 'large', name: 'Large', size: 1.3, angle: 0 }, { id: 'pointed', name: 'Pointed', size: 1.0, angle: 0, pointed: true }, { id: 'round', name: 'Round', size: 1.0, angle: 0, roundness: 0.9 }, { id: 'flat', name: 'Flat', size: 0.9, angle: 15 } ]; // Hair styles (30 options) var HAIR_STYLES = [ { id: 'short-messy', name: 'Short Messy', length: 'short', coverage: 0.3 }, { id: 'short-neat', name: 'Short Neat', length: 'short', coverage: 0.25 }, { id: 'short-curly', name: 'Short Curly', length: 'short', coverage: 0.35 }, { id: 'medium-straight', name: 'Medium Straight', length: 'medium', coverage: 0.5 }, { id: 'medium-wavy', name: 'Medium Wavy', length: 'medium', coverage: 0.55 }, { id: 'long-straight', name: 'Long Straight', length: 'long', coverage: 0.7 }, { id: 'long-wavy', name: 'Long Wavy', length: 'long', coverage: 0.75 }, { id: 'ponytail', name: 'Ponytail', length: 'medium', coverage: 0.4 }, { id: 'pigtails', name: 'Pigtails', length: 'medium', coverage: 0.45 }, { id: 'bun', name: 'Bun', length: 'long', coverage: 0.35 }, { id: 'mohawk', name: 'Mohawk', length: 'short', coverage: 0.2 }, { id: 'afro', name: 'Afro', length: 'medium', coverage: 0.8 }, { id: 'buzz', name: 'Buzz Cut', length: 'short', coverage: 0.15 }, { id: 'bald', name: 'Bald', length: 'none', coverage: 0 }, { id: 'sidepart', name: 'Side Part', length: 'short', coverage: 0.3 }, { id: 'spiky', name: 'Spiky', length: 'short', coverage: 0.35, spikes: true }, { id: 'slicked', name: 'Slicked Back', length: 'short', coverage: 0.25 }, { id: 'bob', name: 'Bob', length: 'medium', coverage: 0.5 }, { id: 'pixie', name: 'Pixie', length: 'short', coverage: 0.35 }, { id: 'braids', name: 'Braids', length: 'long', coverage: 0.6 }, { id: 'dreads', name: 'Dreads', length: 'long', coverage: 0.7 }, { id: 'undercut', name: 'Undercut', length: 'short', coverage: 0.25, sides: 'shaved' }, { id: 'fauxhawk', name: 'Faux Hawk', length: 'short', coverage: 0.3 }, { id: 'mullet', name: 'Mullet', length: 'medium', coverage: 0.45, backLength: 'long' }, { id: 'bowl', name: 'Bowl Cut', length: 'medium', coverage: 0.55 }, { id: 'combover', name: 'Comb Over', length: 'short', coverage: 0.2 }, { id: 'bangs', name: 'Bangs', length: 'medium', coverage: 0.5, bangs: true }, { id: 'sidesweep', name: 'Side Sweep', length: 'medium', coverage: 0.45 }, { id: 'topknot', name: 'Top Knot', length: 'long', coverage: 0.3 }, { id: 'cornrows', name: 'Cornrows', length: 'medium', coverage: 0.4 } ]; // Hair colors (20 options) var HAIR_COLORS = [ { id: 'black', hex: '#1a1a1a', name: 'Black' }, { id: 'darkBrown', hex: '#2c1810', name: 'Dark Brown' }, { id: 'brown', hex: '#4a3728', name: 'Brown' }, { id: 'lightBrown', hex: '#7a5a3a', name: 'Light Brown' }, { id: 'auburn', hex: '#8b4513', name: 'Auburn' }, { id: 'ginger', hex: '#b5651d', name: 'Ginger' }, { id: 'strawberry', hex: '#c67171', name: 'Strawberry' }, { id: 'blonde', hex: '#d4b896', name: 'Blonde' }, { id: 'platinum', hex: '#e8e4c9', name: 'Platinum' }, { id: 'white', hex: '#f0f0f0', name: 'White' }, { id: 'gray', hex: '#808080', name: 'Gray' }, { id: 'red', hex: '#cc0000', name: 'Red' }, { id: 'blue', hex: '#0066cc', name: 'Blue' }, { id: 'purple', hex: '#7b2d8e', name: 'Purple' }, { id: 'green', hex: '#228b22', name: 'Green' }, { id: 'pink', hex: '#ff69b4', name: 'Pink' }, { id: 'teal', hex: '#008b8b', name: 'Teal' }, { id: 'orange', hex: '#ff6600', name: 'Orange' }, { id: 'silver', hex: '#c0c0c0', name: 'Silver' }, { id: 'rainbow', hex: 'linear-gradient(90deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #8b00ff)', name: 'Rainbow', isGradient: true } ]; // Facial hair (10 options) var FACIAL_HAIR = [ { id: 'none', name: 'None' }, { id: 'stubble', name: 'Stubble', density: 0.3, length: 0.1 }, { id: 'goatee', name: 'Goatee', coverage: 'chin', length: 0.4 }, { id: 'mustache', name: 'Mustache', coverage: 'upper-lip', length: 0.3, style: 'classic' }, { id: 'fullBeard', name: 'Full Beard', coverage: 'full', length: 0.7 }, { id: 'shortBeard', name: 'Short Beard', coverage: 'full', length: 0.3 }, { id: 'soulPatch', name: 'Soul Patch', coverage: 'chin-center', length: 0.3 }, { id: 'mutton', name: 'Mutton Chops', coverage: 'sides', length: 0.5 }, { id: 'handlebar', name: 'Handlebar', coverage: 'upper-lip', length: 0.4, style: 'handlebar' }, { id: 'vandyke', name: 'Van Dyke', coverage: 'chin-mustache', length: 0.5 } ]; // Body types (6 options) var BODY_TYPES = [ { id: 'slim', name: 'Slim', widthRatio: 0.8, heightRatio: 1.0 }, { id: 'average', name: 'Average', widthRatio: 1.0, heightRatio: 1.0 }, { id: 'athletic', name: 'Athletic', widthRatio: 1.1, heightRatio: 1.0 }, { id: 'stocky', name: 'Stocky', widthRatio: 1.2, heightRatio: 0.95 }, { id: 'tall', name: 'Tall', widthRatio: 0.95, heightRatio: 1.15 }, { id: 'short', name: 'Short', widthRatio: 1.0, heightRatio: 0.85 } ]; // Clothing styles (4 options) var CLOTHING_STYLES = [ { id: 'casual', name: 'Casual', hasCollar: false, sleeveLength: 'short' }, { id: 'sporty', name: 'Sporty', hasCollar: false, sleeveLength: 'short', hasStripes: true }, { id: 'formal', name: 'Formal', hasCollar: true, sleeveLength: 'long' }, { id: 'scifi', name: 'Sci-Fi', hasCollar: true, sleeveLength: 'long', hasGlow: true } ]; // Preset colors for clothing var CLOTHING_COLORS = [ '#e74c3c', '#e67e22', '#f1c40f', '#2ecc71', '#1abc9c', '#3498db', '#9b59b6', '#34495e', '#95a5a6', '#ecf0f1', '#c0392b', '#d35400', '#f39c12', '#27ae60', '#16a085', '#2980b9', '#8e44ad', '#2c3e50', '#7f8c8d', '#bdc3c7' ]; // 10 Default guest avatars var GUEST_AVATARS = [ { id: 'guest_1', name: 'Guest Blue', base: { faceShape: 'round', skinTone: 'medium1', eyes: { shape: 'round', color: 'blue' }, eyebrows: 'natural', nose: 'button', mouth: 'smile', ears: 'normal', hair: { style: 'short-messy', color: 'darkBrown' }, facialHair: 'none', body: { type: 'average' }, clothing: { style: 'casual', shirtColor: '#3498db', pantsColor: '#2c3e50' } } }, { id: 'guest_2', name: 'Guest Red', base: { faceShape: 'oval', skinTone: 'light2', eyes: { shape: 'almond', color: 'brown' }, eyebrows: 'arched', nose: 'pointed', mouth: 'neutral', ears: 'normal', hair: { style: 'long-straight', color: 'black' }, facialHair: 'none', body: { type: 'slim' }, clothing: { style: 'casual', shirtColor: '#e74c3c', pantsColor: '#34495e' } } }, { id: 'guest_3', name: 'Guest Green', base: { faceShape: 'square', skinTone: 'tan1', eyes: { shape: 'narrow', color: 'darkBrown' }, eyebrows: 'thick', nose: 'wide', mouth: 'grin', ears: 'large', hair: { style: 'buzz', color: 'black' }, facialHair: 'stubble', body: { type: 'athletic' }, clothing: { style: 'sporty', shirtColor: '#2ecc71', pantsColor: '#2c3e50' } } }, { id: 'guest_4', name: 'Guest Purple', base: { faceShape: 'heart', skinTone: 'fair2', eyes: { shape: 'wide', color: 'green' }, eyebrows: 'curved', nose: 'snub', mouth: 'small', ears: 'small', hair: { style: 'bob', color: 'auburn' }, facialHair: 'none', body: { type: 'average' }, clothing: { style: 'casual', shirtColor: '#9b59b6', pantsColor: '#7f8c8d' } } }, { id: 'guest_5', name: 'Guest Orange', base: { faceShape: 'long', skinTone: 'brown1', eyes: { shape: 'oval', color: 'amber' }, eyebrows: 'straight', nose: 'roman', mouth: 'full', ears: 'normal', hair: { style: 'afro', color: 'black' }, facialHair: 'goatee', body: { type: 'tall' }, clothing: { style: 'casual', shirtColor: '#e67e22', pantsColor: '#34495e' } } }, { id: 'guest_6', name: 'Guest Teal', base: { faceShape: 'soft', skinTone: 'dark1', eyes: { shape: 'happy', color: 'darkBrown' }, eyebrows: 'natural', nose: 'flat', mouth: 'wide', ears: 'round', hair: { style: 'dreads', color: 'black' }, facialHair: 'none', body: { type: 'stocky' }, clothing: { style: 'casual', shirtColor: '#1abc9c', pantsColor: '#2c3e50' } } }, { id: 'guest_7', name: 'Guest Gray', base: { faceShape: 'angular', skinTone: 'light3', eyes: { shape: 'cat', color: 'gray' }, eyebrows: 'sleek', nose: 'narrow', mouth: 'smirk', ears: 'pointed', hair: { style: 'undercut', color: 'platinum' }, facialHair: 'none', body: { type: 'slim' }, clothing: { style: 'scifi', shirtColor: '#95a5a6', pantsColor: '#34495e' } } }, { id: 'guest_8', name: 'Guest Yellow', base: { faceShape: 'wide', skinTone: 'medium3', eyes: { shape: 'surprised', color: 'hazel' }, eyebrows: 'worried', nose: 'button', mouth: 'open', ears: 'normal', hair: { style: 'spiky', color: 'blonde' }, facialHair: 'none', body: { type: 'short' }, clothing: { style: 'casual', shirtColor: '#f1c40f', pantsColor: '#7f8c8d' } } }, { id: 'guest_9', name: 'Guest Navy', base: { faceShape: 'oval', skinTone: 'tan2', eyes: { shape: 'droopy', color: 'brown' }, eyebrows: 'bushy', nose: 'aquiline', mouth: 'neutral', ears: 'flat', hair: { style: 'combover', color: 'gray' }, facialHair: 'fullBeard', body: { type: 'stocky' }, clothing: { style: 'formal', shirtColor: '#2c3e50', pantsColor: '#1a1a2e' } } }, { id: 'guest_10', name: 'Guest Pink', base: { faceShape: 'round', skinTone: 'fair3', eyes: { shape: 'round', color: 'lightBlue' }, eyebrows: 'thin', nose: 'snub', mouth: 'pout', ears: 'small', hair: { style: 'pigtails', color: 'strawberry' }, facialHair: 'none', body: { type: 'average' }, clothing: { style: 'casual', shirtColor: '#ff69b4', pantsColor: '#bdc3c7' } } } ]; // Helper function to find item by ID function findById(array, id) { for (var i = 0; i < array.length; i++) { if (array[i].id === id) { return array[i]; } } return null; } // Public API window.AvatarData = { FACE_SHAPES: FACE_SHAPES, SKIN_TONES: SKIN_TONES, EYE_SHAPES: EYE_SHAPES, EYE_COLORS: EYE_COLORS, EYEBROW_SHAPES: EYEBROW_SHAPES, NOSE_SHAPES: NOSE_SHAPES, MOUTH_SHAPES: MOUTH_SHAPES, EAR_SHAPES: EAR_SHAPES, HAIR_STYLES: HAIR_STYLES, HAIR_COLORS: HAIR_COLORS, FACIAL_HAIR: FACIAL_HAIR, BODY_TYPES: BODY_TYPES, CLOTHING_STYLES: CLOTHING_STYLES, CLOTHING_COLORS: CLOTHING_COLORS, GUEST_AVATARS: GUEST_AVATARS, // Helper methods getFaceShape: function(id) { return findById(FACE_SHAPES, id); }, getSkinTone: function(id) { return findById(SKIN_TONES, id); }, getEyeShape: function(id) { return findById(EYE_SHAPES, id); }, getEyeColor: function(id) { return findById(EYE_COLORS, id); }, getEyebrowShape: function(id) { return findById(EYEBROW_SHAPES, id); }, getNoseShape: function(id) { return findById(NOSE_SHAPES, id); }, getMouthShape: function(id) { return findById(MOUTH_SHAPES, id); }, getEarShape: function(id) { return findById(EAR_SHAPES, id); }, getHairStyle: function(id) { return findById(HAIR_STYLES, id); }, getHairColor: function(id) { return findById(HAIR_COLORS, id); }, getFacialHair: function(id) { return findById(FACIAL_HAIR, id); }, getBodyType: function(id) { return findById(BODY_TYPES, id); }, getClothingStyle: function(id) { return findById(CLOTHING_STYLES, id); }, getRandomGuestAvatar: function() { return GUEST_AVATARS[Math.floor(Math.random() * GUEST_AVATARS.length)]; }, createDefaultAvatar: function() { return { faceShape: 'round', skinTone: 'medium1', eyes: { shape: 'round', color: 'brown' }, eyebrows: 'natural', nose: 'button', mouth: 'smile', ears: 'normal', hair: { style: 'short-neat', color: 'brown' }, facialHair: 'none', body: { type: 'average' }, clothing: { style: 'casual', shirtColor: '#3498db', pantsColor: '#2c3e50' } }; } }; })();