| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520 |
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
- <title>高精车牌在线物理渲染器 (移动端)</title>
- <!-- Google Fonts for premium typography -->
- <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@800;900&family=Oswald:wght@600;700&family=Montserrat:wght@800&display=swap" rel="stylesheet">
- <style>
- :root {
- --bg-color: #080c14;
- --panel-bg: rgba(17, 24, 39, 0.95);
- --panel-border: rgba(255, 255, 255, 0.08);
- --text-color: #f8fafc;
- --accent-color: #3b82f6;
- --accent-glow: rgba(59, 130, 246, 0.3);
-
- /* Default Plate Color Styles (Blue) */
- --plate-bg: linear-gradient(135deg, #0d58ca 0%, #003692 50%, #002d7c 100%);
- --plate-border: #ffffff;
- --plate-text: #ffffff;
- --plate-text-shadow: -0.5px -0.5px 0px rgba(255, 255, 255, 0.6),
- 0.8px 0.8px 0px rgba(0, 0, 0, 0.9),
- 1.5px 1.5px 2px rgba(0, 0, 0, 0.7);
- --plate-border-shadow: inset 0 2px 4px rgba(255,255,255,0.4),
- inset 0 -2px 4px rgba(0,0,0,0.6),
- 0 4px 8px rgba(0,0,0,0.5);
- }
- * {
- box-sizing: border-box;
- margin: 0;
- padding: 0;
- user-select: none;
- -webkit-user-select: none;
- -webkit-tap-highlight-color: transparent;
- }
- body {
- font-family: 'Noto Sans SC', sans-serif;
- background-color: var(--bg-color);
- color: var(--text-color);
- height: 100dvh;
- display: flex;
- flex-direction: column;
- overflow: hidden;
- background-image:
- radial-gradient(circle at 50% 15%, rgba(29, 78, 216, 0.15) 0%, transparent 60%);
- }
- /* 3D SHOWCASE REGION (TOP 35%) */
- .showcase-container {
- height: 35dvh;
- min-height: 200px;
- position: relative;
- background-color: #03070c;
- border-bottom: 1px solid var(--panel-border);
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 16px;
- perspective: 800px;
- z-index: 10;
- box-shadow: 0 4px 20px rgba(0,0,0,0.5);
- }
- /* Spotlight effect */
- .spotlight {
- position: absolute;
- width: 250px;
- height: 250px;
- border-radius: 50%;
- background: radial-gradient(circle, rgba(59, 130, 246, 0.1) 0%, transparent 70%);
- pointer-events: none;
- z-index: 0;
- }
- /* Floating action tip */
- .fullscreen-tip {
- position: absolute;
- bottom: 10px;
- left: 50%;
- transform: translateX(-50%);
- display: flex;
- align-items: center;
- gap: 6px;
- background: rgba(0, 0, 0, 0.6);
- backdrop-filter: blur(8px);
- -webkit-backdrop-filter: blur(8px);
- border: 1px solid rgba(255, 255, 255, 0.1);
- padding: 4px 12px;
- border-radius: 20px;
- font-size: 0.7rem;
- color: #94a3b8;
- pointer-events: none;
- z-index: 5;
- letter-spacing: 0.5px;
- }
- /* Scale holder wrapper */
- .plate-wrapper {
- width: 100%;
- max-width: 420px;
- z-index: 1;
- transition: transform 0.1s ease-out;
- transform-style: preserve-3d;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- /* LICENSE PLATE MAIN STYLING */
- .plate {
- aspect-ratio: 440 / 140; /* Standard ratio */
- background: var(--plate-bg);
- border-radius: 0.22em;
- position: relative;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0 0.45em;
- box-sizing: border-box;
- box-shadow:
- 0 15px 35px rgba(0,0,0,0.7),
- var(--plate-border-shadow);
- overflow: hidden;
- transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
- transform-style: preserve-3d;
- }
- /* Special overrides during html2canvas rendering to prevent 3D clipping */
- .plate.rendering {
- transform: none !important;
- box-shadow: var(--plate-border-shadow) !important;
- }
- .plate.rendering .plate-char {
- transform: none !important;
- }
- /* Metal texture overlay */
- .plate::after {
- content: '';
- position: absolute;
- inset: 0;
- background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
- opacity: 0.04;
- mix-blend-mode: overlay;
- pointer-events: none;
- z-index: 2;
- }
- /* Plate outer border */
- .plate-border-outer {
- position: absolute;
- inset: 0.08em;
- border: 0.05em solid var(--plate-border);
- border-radius: 0.16em;
- pointer-events: none;
- z-index: 3;
- box-shadow:
- inset 0 1px 1px rgba(255,255,255,0.4),
- 0 1px 1px rgba(0,0,0,0.5);
- }
- /* Plate inner parallel line */
- .plate-border-inner {
- position: absolute;
- inset: 0.18em;
- border: 0.025em solid var(--plate-border);
- border-radius: 0.1em;
- pointer-events: none;
- z-index: 3;
- }
- /* Screws (4 corner screws) */
- .screw {
- position: absolute;
- width: 0.32em;
- height: 0.32em;
- background: radial-gradient(circle, #f0f0f0 0%, #c8c8c8 45%, #6e6e6e 85%, #444 100%);
- border-radius: 50%;
- box-shadow:
- inset 0 1px 1px rgba(255,255,255,0.8),
- 0 1px 2px rgba(0,0,0,0.6);
- z-index: 4;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .screw-cap {
- font-size: 0.12em;
- font-weight: 900;
- color: rgba(0, 0, 0, 0.65);
- text-shadow: 0.5px 0.5px 0px rgba(255, 255, 255, 0.4);
- transform: scale(0.9);
- }
- .screw.top-left { top: 3.5%; left: 24.5%; }
- .screw.top-right { top: 3.5%; right: 24.5%; }
- .screw.bottom-left { bottom: 3.5%; left: 24.5%; }
- .screw.bottom-right { bottom: 3.5%; right: 24.5%; }
- /* Glossy reflection effect */
- .plate-gloss {
- position: absolute;
- inset: 0;
- background: linear-gradient(135deg,
- rgba(255, 255, 255, 0.18) 0%,
- rgba(255, 255, 255, 0.06) 35%,
- transparent 35.1%,
- transparent 100%
- );
- pointer-events: none;
- z-index: 5;
- transition: all 0.1s ease;
- }
- /* Plate Content Layout */
- .plate-content {
- display: flex;
- align-items: center;
- width: 100%;
- height: 100%;
- z-index: 3;
- position: relative;
- justify-content: center;
- padding-top: 0.1em;
- }
- .char-group-left {
- display: flex;
- align-items: center;
- gap: 0.1em;
- }
- .char-group-right {
- display: flex;
- align-items: center;
- gap: 0.06em;
- }
- .plate-char {
- font-family: 'Oswald', 'Noto Sans SC', sans-serif;
- font-weight: 800;
- font-size: 1.95em;
- color: var(--plate-text);
- text-shadow: var(--plate-text-shadow);
- line-height: 1;
- display: inline-block;
- transform: translateZ(10px);
- letter-spacing: -0.05em;
- }
- /* Province character squish */
- .plate-char.province {
- font-family: 'Noto Sans SC', sans-serif;
- font-weight: 900;
- font-size: 1.85em;
- margin-right: 0.05em;
- }
- .plate-char.city {
- font-family: 'Montserrat', sans-serif;
- font-weight: 800;
- font-size: 1.9em;
- }
- /* Divider */
- .char-divider {
- width: 0.8em;
- display: flex;
- align-items: center;
- justify-content: center;
- position: relative;
- height: 100%;
- }
- .dot {
- width: 0.22em;
- height: 0.22em;
- background-color: var(--plate-text);
- border-radius: 50%;
- box-shadow:
- -0.5px -0.5px 0px rgba(255, 255, 255, 0.7),
- 0.5px 0.5px 0px rgba(0, 0, 0, 0.8),
- 1px 1px 2px rgba(0,0,0,0.5);
- display: inline-block;
- }
- /* New Energy Logo in Center */
- .nev-logo {
- display: none;
- width: 0.68em;
- height: 0.68em;
- z-index: 6;
- filter: drop-shadow(1px 1px 1px rgba(0,0,0,0.3));
- }
- /* Active NEV style adjusts layout */
- .plate.nev {
- aspect-ratio: 480 / 140; /* NEV standard size */
- background: linear-gradient(to bottom, #ffffff 20%, #e8f9ed 45%, #15b043 100%);
- }
- .plate.nev .dot {
- display: none;
- }
- .plate.nev .nev-logo {
- display: block;
- }
- /* Special Red characters for Police/Embassy */
- .char-special-red {
- color: #e11d48 !important;
- text-shadow:
- -0.5px -0.5px 0px rgba(255, 255, 255, 0.8),
- 0.8px 0.8px 0px rgba(0, 0, 0, 0.9),
- 1.5px 1.5px 2px rgba(0, 0, 0, 0.7) !important;
- }
- /* Dirt / Grunge Worn Effect */
- .plate-dirt {
- position: absolute;
- inset: 0;
- background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.05' numOctaves='3' result='noise'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.85 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
- opacity: 0;
- mix-blend-mode: multiply;
- pointer-events: none;
- z-index: 4;
- transition: opacity 0.3s;
- }
- /* CONTROL PANEL (BOTTOM 65%) */
- .control-panel {
- height: 65dvh;
- background: var(--panel-bg);
- border-top: 1px solid var(--panel-border);
- border-radius: 24px 24px 0 0;
- padding: 20px 16px;
- overflow-y: auto;
- -webkit-overflow-scrolling: touch;
- display: flex;
- flex-direction: column;
- gap: 20px;
- z-index: 20;
- box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.5);
- padding-bottom: calc(20px + env(safe-area-inset-bottom));
- }
- .section-title {
- font-size: 0.95rem;
- font-weight: 800;
- color: #cbd5e1;
- border-left: 4px solid var(--accent-color);
- padding-left: 8px;
- margin-bottom: 10px;
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .form-group {
- display: flex;
- flex-direction: column;
- gap: 6px;
- }
- .plate-input-wrapper {
- display: flex;
- gap: 8px;
- }
- /* Input styling */
- .province-trigger {
- width: 58px;
- height: 48px;
- background: rgba(255, 255, 255, 0.05);
- border: 1px solid rgba(255, 255, 255, 0.1);
- border-radius: 10px;
- color: #ffffff;
- font-size: 1.25rem;
- font-weight: 900;
- display: flex;
- align-items: center;
- justify-content: center;
- cursor: pointer;
- transition: all 0.2s ease;
- }
- .province-trigger:active {
- background: rgba(255, 255, 255, 0.12);
- border-color: var(--accent-color);
- }
- .text-input-field {
- flex: 1;
- height: 48px;
- background: rgba(255, 255, 255, 0.05);
- border: 1px solid rgba(255, 255, 255, 0.1);
- border-radius: 10px;
- color: #ffffff;
- font-size: 1.2rem;
- font-family: 'Oswald', sans-serif;
- font-weight: 700;
- padding: 0 14px;
- letter-spacing: 2px;
- text-transform: uppercase;
- outline: none;
- transition: all 0.2s ease;
- }
- .text-input-field:focus {
- border-color: var(--accent-color);
- background: rgba(255, 255, 255, 0.08);
- }
- /* Suffix buttons */
- .suffix-list {
- display: flex;
- flex-wrap: wrap;
- gap: 6px;
- }
- .suffix-btn {
- background: rgba(255, 255, 255, 0.04);
- border: 1px solid rgba(255, 255, 255, 0.06);
- color: #94a3b8;
- padding: 6px 12px;
- border-radius: 8px;
- font-size: 0.8rem;
- font-weight: 700;
- cursor: pointer;
- transition: all 0.15s;
- }
- .suffix-btn:active {
- background: rgba(255, 255, 255, 0.12);
- color: #ffffff;
- border-color: var(--accent-color);
- }
- /* Color cards layout */
- .color-selector {
- display: flex;
- overflow-x: auto;
- gap: 10px;
- padding-bottom: 6px;
- -webkit-overflow-scrolling: touch;
- scrollbar-width: none; /* Firefox */
- }
- .color-selector::-webkit-scrollbar {
- display: none; /* Chrome/Safari */
- }
- .color-tab {
- flex-shrink: 0;
- width: 110px;
- height: 64px;
- border-radius: 12px;
- border: 2px solid transparent;
- cursor: pointer;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- font-size: 0.75rem;
- font-weight: 800;
- gap: 4px;
- position: relative;
- overflow: hidden;
- box-shadow: 0 4px 10px rgba(0,0,0,0.3);
- transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
- }
- .color-tab::before {
- content: '';
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- height: 35%;
- background: linear-gradient(rgba(255, 255, 255, 0.15), transparent);
- pointer-events: none;
- }
- .color-tab.active {
- border-color: #ffffff;
- box-shadow: 0 0 12px rgba(255, 255, 255, 0.15);
- transform: scale(1.02);
- }
- /* Presets definition */
- .color-tab.preset-blue {
- background: linear-gradient(135deg, #0d58ca 0%, #002d7c 100%);
- color: #ffffff;
- }
- .color-tab.preset-green {
- background: linear-gradient(to bottom, #ffffff 30%, #15b043 100%);
- color: #0a0f1d;
- border: 1px solid rgba(0,0,0,0.08);
- }
- .color-tab.preset-yellow {
- background: linear-gradient(135deg, #ffcf33 0%, #ffb800 100%);
- color: #0a0f1d;
- }
- .color-tab.preset-white {
- background: #ffffff;
- color: #0a0f1d;
- border: 1px solid #ddd;
- }
- .color-tab.preset-black {
- background: #1e1e1e;
- color: #ffffff;
- border: 1px solid rgba(255,255,255,0.08);
- }
- /* Sliders */
- .sliders-group {
- display: flex;
- flex-direction: column;
- gap: 10px;
- background: rgba(255, 255, 255, 0.02);
- border: 1px solid rgba(255, 255, 255, 0.04);
- border-radius: 12px;
- padding: 12px;
- }
- .slider-row {
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .slider-label {
- font-size: 0.78rem;
- color: #94a3b8;
- font-weight: 600;
- }
- .switch {
- position: relative;
- display: inline-block;
- width: 40px;
- height: 22px;
- }
- .switch input {
- opacity: 0;
- width: 0;
- height: 0;
- }
- .slider-round {
- position: absolute;
- cursor: pointer;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background-color: rgba(255, 255, 255, 0.1);
- transition: .2s;
- border-radius: 22px;
- }
- .slider-round:before {
- position: absolute;
- content: "";
- height: 16px;
- width: 16px;
- left: 3px;
- bottom: 3px;
- background-color: white;
- transition: .2s;
- border-radius: 50%;
- }
- input:checked + .slider-round {
- background-color: var(--accent-color);
- }
- input:checked + .slider-round:before {
- transform: translateX(18px);
- }
- .range-slider {
- width: 100%;
- -webkit-appearance: none;
- background: rgba(255, 255, 255, 0.1);
- height: 4px;
- border-radius: 2px;
- outline: none;
- margin-top: 4px;
- }
- .range-slider::-webkit-slider-thumb {
- -webkit-appearance: none;
- width: 14px;
- height: 14px;
- border-radius: 50%;
- background: var(--accent-color);
- cursor: pointer;
- box-shadow: 0 0 6px var(--accent-color);
- }
- /* Buttons block */
- .actions-group {
- display: flex;
- gap: 10px;
- margin-top: 8px;
- }
- .btn {
- flex: 1;
- height: 48px;
- border-radius: 12px;
- font-size: 0.92rem;
- font-weight: 800;
- border: none;
- outline: none;
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 8px;
- cursor: pointer;
- transition: all 0.2s ease;
- }
- .btn-primary {
- background: var(--accent-color);
- color: #ffffff;
- box-shadow: 0 4px 15px var(--accent-glow);
- }
- .btn-primary:active {
- background: #2563eb;
- transform: translateY(1px);
- }
- .btn-secondary {
- background: rgba(255, 255, 255, 0.05);
- color: #cbd5e1;
- border: 1px solid rgba(255, 255, 255, 0.08);
- }
- .btn-secondary:active {
- background: rgba(255, 255, 255, 0.08);
- }
- /* NATIVE-LIKE BOTTOM SHEET FOR PROVINCES */
- .bottom-sheet {
- position: fixed;
- left: 0;
- right: 0;
- bottom: 0;
- background: rgba(13, 17, 28, 0.95);
- backdrop-filter: blur(25px);
- -webkit-backdrop-filter: blur(25px);
- border-top: 1px solid var(--panel-border);
- border-radius: 24px 24px 0 0;
- z-index: 100;
- transform: translateY(100%);
- transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
- box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.8);
- padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
- }
- .bottom-sheet.active {
- transform: translateY(0);
- }
- .sheet-overlay {
- position: fixed;
- inset: 0;
- background: rgba(0,0,0,0.6);
- z-index: 99;
- opacity: 0;
- pointer-events: none;
- transition: opacity 0.3s ease;
- backdrop-filter: blur(4px);
- -webkit-backdrop-filter: blur(4px);
- }
- .sheet-overlay.active {
- opacity: 1;
- pointer-events: auto;
- }
- .sheet-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 16px;
- }
- .sheet-header h3 {
- font-size: 1.05rem;
- font-weight: 800;
- color: #ffffff;
- }
- .sheet-close-btn {
- background: rgba(255, 255, 255, 0.05);
- border: none;
- color: #94a3b8;
- width: 32px;
- height: 32px;
- border-radius: 50%;
- font-size: 1.2rem;
- display: flex;
- align-items: center;
- justify-content: center;
- cursor: pointer;
- }
- .province-grid {
- display: grid;
- grid-template-columns: repeat(6, 1fr);
- gap: 8px;
- max-height: 40vh;
- overflow-y: auto;
- -webkit-overflow-scrolling: touch;
- padding-bottom: 10px;
- }
- .province-btn {
- background: rgba(255, 255, 255, 0.04);
- border: 1px solid rgba(255, 255, 255, 0.06);
- border-radius: 8px;
- height: 44px;
- color: #ffffff;
- font-size: 1.1rem;
- font-weight: 800;
- cursor: pointer;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .province-btn:active {
- background: var(--accent-color);
- border-color: var(--accent-color);
- transform: scale(0.95);
- }
- /* FULLSCREEN OVERLAY FOR ORIENTED PREVIEW */
- .fullscreen-overlay {
- position: fixed;
- inset: 0;
- background: #000000;
- z-index: 1000;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- opacity: 0;
- pointer-events: none;
- transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
- }
- .fullscreen-overlay.active {
- opacity: 1;
- pointer-events: auto;
- }
- .fullscreen-close-btn {
- position: absolute;
- top: max(20px, env(safe-area-inset-top));
- right: max(20px, env(safe-area-inset-right));
- width: 40px;
- height: 40px;
- border-radius: 50%;
- background: rgba(255, 255, 255, 0.15);
- border: 1px solid rgba(255, 255, 255, 0.25);
- color: #ffffff;
- font-size: 1.5rem;
- display: flex;
- align-items: center;
- justify-content: center;
- cursor: pointer;
- z-index: 1020;
- backdrop-filter: blur(10px);
- -webkit-backdrop-filter: blur(10px);
- }
- .fullscreen-tip-top {
- position: absolute;
- top: max(20px, env(safe-area-inset-top));
- left: 50%;
- transform: translateX(-50%);
- background: rgba(0, 0, 0, 0.7);
- border: 1px solid rgba(255, 255, 255, 0.1);
- padding: 6px 16px;
- border-radius: 20px;
- font-size: 0.75rem;
- color: #ffffff;
- pointer-events: none;
- z-index: 1010;
- letter-spacing: 0.5px;
- white-space: nowrap;
- }
- .fullscreen-image-container {
- width: 90vw;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .fullscreen-image-container img {
- width: 100%;
- height: auto;
- border-radius: 1.5vw;
- box-shadow: 0 20px 50px rgba(0,0,0,0.8);
- max-height: 85vh;
- object-fit: contain;
- }
- /* Portrait layout: rotate 90deg to simulate landscape */
- @media (orientation: portrait) {
- .fullscreen-image-container {
- width: 90dvh;
- transform: rotate(90deg);
- transform-origin: center center;
- }
- .fullscreen-image-container img {
- max-width: 82dvh;
- max-height: 82dvw;
- }
- .fullscreen-tip-top {
- top: auto;
- bottom: max(20px, env(safe-area-inset-bottom));
- }
- }
- /* Landscape adjustments for tiny screens */
- @media (orientation: landscape) and (max-height: 480px) {
- .fullscreen-tip-top {
- top: max(10px, env(safe-area-inset-top));
- }
- .fullscreen-image-container img {
- max-height: 90vh;
- }
- }
- /* Toast notification styling */
- .toast {
- position: fixed;
- bottom: 40px;
- left: 50%;
- transform: translateX(-50%) translateY(100px);
- background: #0f172a;
- border: 1px solid var(--accent-color);
- color: #ffffff;
- padding: 10px 20px;
- border-radius: 10px;
- box-shadow: 0 10px 20px rgba(0,0,0,0.4), 0 0 10px var(--accent-glow);
- z-index: 1000;
- font-size: 0.8rem;
- font-weight: 700;
- transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
- pointer-events: none;
- white-space: nowrap;
- }
- .toast.active {
- transform: translateX(-50%) translateY(0);
- }
- </style>
- </head>
- <body>
- <!-- 3D PREVIEW STAGE (TOP) -->
- <div class="showcase-container" id="showcase-container">
- <div class="spotlight"></div>
- <div class="fullscreen-tip">
- <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" style="vertical-align: middle; margin-top:-2px;"><path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"/></svg>
- <span>点击车牌全屏横屏展示</span>
- </div>
-
- <div class="plate-wrapper" id="plate-wrapper" style="cursor: pointer;">
- <!-- Real physical plate -->
- <div class="plate" id="license-plate">
- <!-- Mounting bolts -->
- <div class="screw top-left"><div class="screw-cap">粤</div></div>
- <div class="screw top-right"><div class="screw-cap">粤</div></div>
- <div class="screw bottom-left"><div class="screw-cap">粤</div></div>
- <div class="screw bottom-right"><div class="screw-cap">粤</div></div>
-
- <!-- Double borders -->
- <div class="plate-border-outer"></div>
- <div class="plate-border-inner"></div>
-
- <!-- Texture/Shader effects -->
- <div class="plate-gloss" id="plate-gloss-layer"></div>
- <div class="plate-dirt" id="plate-dirt-layer"></div>
-
- <!-- Dynamic text container -->
- <div class="plate-content" id="plate-content-box"></div>
- </div>
- </div>
- </div>
- <!-- CONTROL PANEL (BOTTOM) -->
- <div class="control-panel">
- <!-- Section 1: Number Input -->
- <div class="form-group">
- <div class="section-title">
- <span>1. 车牌号码输入</span>
- </div>
- <div class="plate-input-wrapper">
- <button class="province-trigger" id="province-trigger">粤</button>
- <input type="text" class="text-input-field" id="plate-input" value="B88888" placeholder="输入字母和数字" maxlength="6" autocomplete="off" spellcheck="false">
- </div>
- </div>
- <!-- Suffix Shortcuts -->
- <div class="form-group" style="margin-top: -6px;">
- <div class="suffix-list">
- <button class="suffix-btn">警</button>
- <button class="suffix-btn">学</button>
- <button class="suffix-btn">挂</button>
- <button class="suffix-btn">港</button>
- <button class="suffix-btn">澳</button>
- <button class="suffix-btn">领</button>
- </div>
- </div>
- <!-- Section 2: Color selector -->
- <div class="form-group">
- <div class="section-title">
- <span>2. 车牌颜色类型</span>
- </div>
- <div class="color-selector">
- <div class="color-tab preset-blue active" data-preset="blue">
- <span>🔵 蓝底白字</span>
- </div>
- <div class="color-tab preset-green" data-preset="green">
- <span>🟢 渐变绿底黑字</span>
- </div>
- <div class="color-tab preset-yellow" data-preset="yellow">
- <span>🟡 黄底黑字</span>
- </div>
- <div class="color-tab preset-white" data-preset="white">
- <span>⚪ 白底黑字</span>
- </div>
- <div class="color-tab preset-black" data-preset="black">
- <span>⚫ 黑底白字</span>
- </div>
- </div>
- </div>
- <!-- Section 3: Physical Customizations -->
- <div class="form-group">
- <div class="section-title">
- <span>3. 物理材质微调</span>
- </div>
-
- <div class="sliders-group">
- <div class="slider-row">
- <span class="slider-label">固定防盗螺丝螺帽</span>
- <label class="switch">
- <input type="checkbox" id="screw-toggle" checked>
- <span class="slider-round"></span>
- </label>
- </div>
- </div>
- <div class="sliders-group">
- <div class="slider-row">
- <span class="slider-label">3D 字符凹凸力度: <span id="emboss-val">70%</span></span>
- </div>
- <input type="range" class="range-slider" id="emboss-slider" min="10" max="100" value="70">
- </div>
- <div class="sliders-group">
- <div class="slider-row">
- <span class="slider-label">漆面反光高光强度: <span id="gloss-val">100%</span></span>
- </div>
- <input type="range" class="range-slider" id="gloss-slider" min="0" max="100" value="100">
- </div>
- <div class="sliders-group">
- <div class="slider-row">
- <span class="slider-label">表面泥渍/陈旧磨损: <span id="dirt-val">0%</span></span>
- </div>
- <input type="range" class="range-slider" id="dirt-slider" min="0" max="80" value="0">
- </div>
- </div>
- <!-- Actions -->
- <div class="actions-group">
- <button class="btn btn-secondary" id="action-fullscreen">
- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"/></svg>
- 全屏预览
- </button>
- <button class="btn btn-primary" id="action-download">
- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"/></svg>
- 导出高清图
- </button>
- </div>
- </div>
- <!-- PROVINCE BOTTOM SHEET -->
- <div class="sheet-overlay" id="sheet-overlay"></div>
- <div class="bottom-sheet" id="province-sheet">
- <div class="sheet-header">
- <h3>选择省份简称</h3>
- <button class="sheet-close-btn" id="sheet-close">×</button>
- </div>
- <div class="province-grid" id="province-grid"></div>
- </div>
- <!-- FULLSCREEN OVERLAY PREVIEW -->
- <div class="fullscreen-overlay" id="fullscreen-overlay">
- <button class="fullscreen-close-btn" id="fullscreen-close-btn">×</button>
- <div class="fullscreen-tip-top">
- <span>💡 长按图片保存至手机相册 | 点击任意区域返回</span>
- </div>
- <div class="fullscreen-image-container" id="fullscreen-image-container">
- <img src="" alt="车牌高精渲染" id="fullscreen-plate-img">
- </div>
- </div>
- <!-- TOAST NOTIFICATION -->
- <div class="toast" id="toast">图片渲染生成中...</div>
- <!-- html2canvas library for DOM rendering -->
- <script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
- <script>
- // --- State Management ---
- let currentProvince = "粤";
- let activePreset = "blue";
-
- // --- DOM Elements ---
- const provinceTrigger = document.getElementById("province-trigger");
- const plateInput = document.getElementById("plate-input");
- const provinceSheet = document.getElementById("province-sheet");
- const sheetOverlay = document.getElementById("sheet-overlay");
- const sheetClose = document.getElementById("sheet-close");
- const provinceGrid = document.getElementById("province-grid");
- const licensePlate = document.getElementById("license-plate");
- const plateWrapper = document.getElementById("plate-wrapper");
- const showcaseContainer = document.getElementById("showcase-container");
- const contentBox = document.getElementById("plate-content-box");
- const screwToggle = document.getElementById("screw-toggle");
-
- const embossSlider = document.getElementById("emboss-slider");
- const glossSlider = document.getElementById("gloss-slider");
- const dirtSlider = document.getElementById("dirt-slider");
- const embossVal = document.getElementById("emboss-val");
- const glossVal = document.getElementById("gloss-val");
- const dirtVal = document.getElementById("dirt-val");
-
- const actionFullscreen = document.getElementById("action-fullscreen");
- const actionDownload = document.getElementById("action-download");
- const toast = document.getElementById("toast");
-
- const fullscreenOverlay = document.getElementById("fullscreen-overlay");
- const fullscreenCloseBtn = document.getElementById("fullscreen-close-btn");
- const fullscreenPlateImg = document.getElementById("fullscreen-plate-img");
- const fullscreenImageContainer = document.getElementById("fullscreen-image-container");
- // --- Data Lists ---
- const provinces = [
- "京", "津", "冀", "晋", "蒙", "辽", "吉", "黑", "沪", "苏",
- "浙", "皖", "闽", "赣", "鲁", "豫", "鄂", "湘", "粤", "桂",
- "琼", "渝", "川", "贵", "云", "藏", "陕", "甘", "青", "宁",
- "新", "港", "澳", "学", "警", "使", "领"
- ];
- const presets = {
- blue: {
- bg: "linear-gradient(135deg, #0d58ca 0%, #003692 50%, #002d7c 100%)",
- border: "#ffffff",
- text: "#ffffff",
- textShadow: (intensity) => `
- -0.5px -0.5px 0px rgba(255, 255, 255, ${0.4 + intensity * 0.4}),
- 0.8px 0.8px 0px rgba(0, 0, 0, ${0.6 + intensity * 0.3}),
- 1.5px 1.5px ${1.5 + intensity * 1.5}px rgba(0, 0, 0, 0.7)
- `,
- borderShadow: "inset 0 2px 3px rgba(255,255,255,0.4), inset 0 -2px 3px rgba(0,0,0,0.6), 0 3px 6px rgba(0,0,0,0.4)"
- },
- green: {
- bg: "linear-gradient(to bottom, #ffffff 20%, #e8f9ed 45%, #15b043 100%)",
- border: "#111111",
- text: "#111111",
- textShadow: (intensity) => `
- -0.4px -0.4px 0px rgba(0, 0, 0, 0.25),
- 0.6px 0.6px 0px rgba(255, 255, 255, 0.8),
- 1px 1px 1.5px rgba(0, 0, 0, 0.25)
- `,
- borderShadow: "inset 0 1px 2px rgba(255,255,255,0.8), inset 0 -1.5px 2px rgba(0,0,0,0.2), 0 3px 5px rgba(0,0,0,0.3)"
- },
- yellow: {
- bg: "linear-gradient(135deg, #ffcf33 0%, #ffb800 100%)",
- border: "#111111",
- text: "#111111",
- textShadow: (intensity) => `
- -0.4px -0.4px 0px rgba(0, 0, 0, 0.35),
- 0.6px 0.6px 0px rgba(255, 255, 255, 0.85),
- 1.2px 1.2px 1.8px rgba(0, 0, 0, 0.3)
- `,
- borderShadow: "inset 0 1.5px 2px rgba(255,255,255,0.7), inset 0 -1.5px 2px rgba(0,0,0,0.4), 0 3px 5px rgba(0,0,0,0.4)"
- },
- white: {
- bg: "#ffffff",
- border: "#e11d48", // Police red border
- text: "#111111",
- textShadow: (intensity) => `
- -0.3px -0.3px 0px rgba(0, 0, 0, 0.15),
- 0.6px 0.6px 0px rgba(0, 0, 0, 0.15),
- 1px 1px 1.5px rgba(0, 0, 0, 0.1)
- `,
- borderShadow: "inset 0 1px 2px rgba(255,255,255,0.8), inset 0 -1.5px 2px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.2)"
- },
- black: {
- bg: "linear-gradient(135deg, #222222 0%, #111111 100%)",
- border: "#ffffff",
- text: "#ffffff",
- textShadow: (intensity) => `
- -0.5px -0.5px 0px rgba(255, 255, 255, 0.4),
- 0.8px 0.8px 0px rgba(0, 0, 0, 0.95),
- 1.5px 1.5px 2px rgba(0, 0, 0, 0.7)
- `,
- borderShadow: "inset 0 2px 3px rgba(255,255,255,0.2), inset 0 -2px 3px rgba(0,0,0,0.8), 0 3px 6px rgba(0,0,0,0.5)"
- }
- };
- // --- Core Functions ---
- // Sets font size to width / 10 to ensure it is always larger than mobile min-size limits.
- function adjustPlateFontSize() {
- const width = plateWrapper.clientWidth || plateWrapper.offsetWidth;
- if (width > 0) {
- licensePlate.style.fontSize = (width / 10) + "px";
- licensePlate.style.width = width + "px";
- const ratio = activePreset === "green" ? (140 / 480) : (140 / 440);
- licensePlate.style.height = (width * ratio) + "px";
- }
- }
- function showToast(msg, duration = 2000) {
- toast.textContent = msg;
- toast.classList.add("active");
- setTimeout(() => {
- toast.classList.remove("active");
- }, duration);
- }
- // Initialize bottom sheet buttons
- function initProvinceSheet() {
- provinces.forEach(prov => {
- const btn = document.createElement("button");
- btn.className = "province-btn";
- btn.textContent = prov;
- btn.onclick = () => {
- currentProvince = prov;
- provinceTrigger.textContent = prov;
- document.querySelectorAll(".screw-cap").forEach(cap => cap.textContent = prov);
- closeProvinceSheet();
- updatePlate();
- };
- provinceGrid.appendChild(btn);
- });
- }
- function openProvinceSheet() {
- provinceSheet.classList.add("active");
- sheetOverlay.classList.add("active");
- }
- function closeProvinceSheet() {
- provinceSheet.classList.remove("active");
- sheetOverlay.classList.remove("active");
- }
- // Filters non-standard characters (only allowing alphanumeric + valid plate Chinese characters)
- function formatInput(text) {
- return text.toUpperCase()
- .replace(/[^A-Z0-9京津冀晋蒙辽吉黑沪苏浙皖闽赣鲁豫鄂湘粤桂琼渝川贵云藏陕甘青宁新港澳使领警学挂]/g, "")
- .replace(/[IO]/g, ""); // standard plate ban on I and O
- }
- function applyStyles() {
- const preset = presets[activePreset];
- const intensity = parseInt(embossSlider.value) / 100;
- const gloss = parseInt(glossSlider.value) / 100;
- const dirt = parseInt(dirtSlider.value) / 100;
- embossVal.textContent = Math.round(intensity * 100) + "%";
- glossVal.textContent = Math.round(gloss * 100) + "%";
- dirtVal.textContent = Math.round(dirt * 100) + "%";
- // Set variables
- document.documentElement.style.setProperty("--plate-bg", preset.bg);
- document.documentElement.style.setProperty("--plate-border", preset.border);
- document.documentElement.style.setProperty("--plate-text", preset.text);
- document.documentElement.style.setProperty("--plate-text-shadow", preset.textShadow(intensity));
- document.documentElement.style.setProperty("--plate-border-shadow", preset.borderShadow);
- // Toggle screws
- document.querySelectorAll(".screw").forEach(screw => {
- screw.style.display = screwToggle.checked ? "flex" : "none";
- });
- // Adjust specific border settings for Police White plate
- if (activePreset === "white") {
- document.documentElement.style.setProperty("--plate-border", "#e11d48");
- }
- // Adjust textures opacity
- document.getElementById("plate-gloss-layer").style.opacity = gloss * 0.22;
- document.getElementById("plate-dirt-layer").style.opacity = dirt;
- }
- function updatePlate() {
- applyStyles();
- let textVal = formatInput(plateInput.value);
-
- // Auto-detect and strip starting province if user typed it
- if (textVal.length > 0) {
- const firstChar = textVal.charAt(0);
- const startingProvinces = ["京", "津", "冀", "晋", "蒙", "辽", "吉", "黑", "沪", "苏", "浙", "皖", "闽", "赣", "鲁", "豫", "鄂", "湘", "粤", "桂", "琼", "渝", "川", "贵", "云", "藏", "陕", "甘", "青", "宁", "新", "使"];
- if (startingProvinces.includes(firstChar)) {
- currentProvince = firstChar;
- provinceTrigger.textContent = firstChar;
- document.querySelectorAll(".screw-cap").forEach(cap => cap.textContent = firstChar);
- textVal = textVal.slice(1);
- }
- }
- const maxChars = (activePreset === "green") ? 7 : 6;
- if (textVal.length > maxChars) {
- textVal = textVal.slice(0, maxChars);
- }
- plateInput.value = textVal;
- plateInput.maxLength = maxChars;
- if (activePreset === "green") {
- licensePlate.classList.add("nev");
- } else {
- licensePlate.classList.remove("nev");
- }
- const cityChar = textVal.charAt(0) || "B";
- const remainder = textVal.slice(1);
- contentBox.innerHTML = "";
- // Group Left
- const leftGroup = document.createElement("div");
- leftGroup.className = "char-group-left";
-
- const provSpan = document.createElement("span");
- provSpan.className = "plate-char province";
- provSpan.textContent = currentProvince;
- leftGroup.appendChild(provSpan);
- const citySpan = document.createElement("span");
- citySpan.className = "plate-char city";
- citySpan.textContent = cityChar;
- leftGroup.appendChild(citySpan);
- contentBox.appendChild(leftGroup);
- // Middle Divider
- const divider = document.createElement("div");
- divider.className = "char-divider";
-
- const dot = document.createElement("span");
- dot.className = "dot";
- divider.appendChild(dot);
- // NEV Leaf SVG
- const svgNS = "http://www.w3.org/2000/svg";
- const nevLogo = document.createElementNS(svgNS, "svg");
- nevLogo.setAttribute("class", "nev-logo");
- nevLogo.setAttribute("viewBox", "0 0 100 100");
-
- const circle = document.createElementNS(svgNS, "circle");
- circle.setAttribute("cx", "50"); circle.setAttribute("cy", "50"); circle.setAttribute("r", "44");
- circle.setAttribute("fill", "none"); circle.setAttribute("stroke", "#19af46"); circle.setAttribute("stroke-width", "5");
- nevLogo.appendChild(circle);
- const leaf = document.createElementNS(svgNS, "path");
- leaf.setAttribute("d", "M 50 30 Q 30 30 30 50 Q 48 50 50 40 Q 70 40 70 50 Q 52 50 50 40");
- leaf.setAttribute("fill", "none"); leaf.setAttribute("stroke", "#19af46"); leaf.setAttribute("stroke-width", "5");
- nevLogo.appendChild(leaf);
- const plug = document.createElementNS(svgNS, "rect");
- plug.setAttribute("x", "43"); plug.setAttribute("y", "58"); plug.setAttribute("width", "14"); plug.setAttribute("height", "10"); plug.setAttribute("rx", "1"); plug.setAttribute("fill", "#19af46");
- nevLogo.appendChild(plug);
- const prong1 = document.createElementNS(svgNS, "line");
- prong1.setAttribute("x1", "47"); prong1.setAttribute("y1", "52"); prong1.setAttribute("x2", "47"); prong1.setAttribute("y2", "58"); prong1.setAttribute("stroke", "#19af46"); prong1.setAttribute("stroke-width", "3");
- nevLogo.appendChild(prong1);
- const prong2 = document.createElementNS(svgNS, "line");
- prong2.setAttribute("x1", "53"); prong2.setAttribute("y1", "52"); prong2.setAttribute("x2", "53"); prong2.setAttribute("y2", "58"); prong2.setAttribute("stroke", "#19af46"); prong2.setAttribute("stroke-width", "3");
- nevLogo.appendChild(prong2);
- const wire = document.createElementNS(svgNS, "path");
- wire.setAttribute("d", "M 50 68 L 50 78 L 62 78");
- wire.setAttribute("fill", "none"); wire.setAttribute("stroke", "#19af46"); wire.setAttribute("stroke-width", "4");
- nevLogo.appendChild(wire);
- divider.appendChild(nevLogo);
- contentBox.appendChild(divider);
- // Group Right
- const rightGroup = document.createElement("div");
- rightGroup.className = "char-group-right";
- const paddedRemainder = remainder.padEnd(maxChars - 1, "8");
- for (let i = 0; i < paddedRemainder.length; i++) {
- const char = paddedRemainder.charAt(i);
- const charSpan = document.createElement("span");
- charSpan.className = "plate-char";
- charSpan.textContent = char;
- if ((char === "警" || char === "使" || char === "领" || char === "学") && activePreset === "white") {
- charSpan.classList.add("char-special-red");
- }
- rightGroup.appendChild(charSpan);
- }
- contentBox.appendChild(rightGroup);
- adjustPlateFontSize();
- }
- // --- Touch 3D Tilt Orbit Effect ---
- let touchStartX = 0;
- let touchStartY = 0;
- let isDragging = false;
- showcaseContainer.addEventListener("touchstart", (e) => {
- if (e.touches.length === 1) {
- const touch = e.touches[0];
- touchStartX = touch.clientX;
- touchStartY = touch.clientY;
- isDragging = false;
- }
- });
- showcaseContainer.addEventListener("touchmove", (e) => {
- if (e.touches.length === 1) {
- const touch = e.touches[0];
- const deltaX = Math.abs(touch.clientX - touchStartX);
- const deltaY = Math.abs(touch.clientY - touchStartY);
- if (deltaX > 6 || deltaY > 6) {
- isDragging = true;
- }
- // Prevent page scroll when rotating plate
- e.preventDefault();
-
- const rect = showcaseContainer.getBoundingClientRect();
- const x = touch.clientX - rect.left;
- const y = touch.clientY - rect.top;
- const xOffset = (x / rect.width) - 0.5;
- const yOffset = (y / rect.height) - 0.5;
- const rotateY = xOffset * 16;
- const rotateX = -yOffset * 16;
- plateWrapper.style.transform = `rotateX(${rotateX}deg) rotateY(${rotateY}deg) scale(1.04)`;
- const glossLayer = document.getElementById("plate-gloss-layer");
- glossLayer.style.background = `linear-gradient(${135 + rotateY}deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.05) ${35 + xOffset * 10}%, transparent 35.1%, transparent 100%)`;
- }
- }, { passive: false });
- showcaseContainer.addEventListener("touchend", () => {
- plateWrapper.style.transform = "rotateX(0deg) rotateY(0deg) scale(1)";
- const glossLayer = document.getElementById("plate-gloss-layer");
- glossLayer.style.background = `linear-gradient(135deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.06) 35%, transparent 35.1%, transparent 100%)`;
- });
- // Mouse support for desktop testing
- showcaseContainer.addEventListener("mousemove", (e) => {
- const rect = showcaseContainer.getBoundingClientRect();
- const x = e.clientX - rect.left;
- const y = e.clientY - rect.top;
- const xOffset = (x / rect.width) - 0.5;
- const yOffset = (y / rect.height) - 0.5;
- const rotateY = xOffset * 16;
- const rotateX = -yOffset * 16;
- plateWrapper.style.transform = `rotateX(${rotateX}deg) rotateY(${rotateY}deg) scale(1.04)`;
- });
- showcaseContainer.addEventListener("mouseleave", () => {
- plateWrapper.style.transform = "rotateX(0deg) rotateY(0deg) scale(1)";
- });
- // --- Fullscreen and Render Exporter ---
- function renderToCanvas(callback) {
- plateWrapper.style.transform = "rotateX(0deg) rotateY(0deg) scale(1)";
- licensePlate.classList.add("rendering");
- adjustPlateFontSize();
- setTimeout(() => {
- html2canvas(licensePlate, {
- scale: 3.5, // Ultra crisp HD
- backgroundColor: null,
- useCORS: true,
- allowTaint: false,
- logging: false
- }).then(canvas => {
- licensePlate.classList.remove("rendering");
- adjustPlateFontSize();
- callback(canvas);
- }).catch(err => {
- console.error("html2canvas generation error", err);
- licensePlate.classList.remove("rendering");
- adjustPlateFontSize();
- showToast("❌ 渲染失败,请重试");
- });
- }, 250);
- }
- function triggerFullscreen() {
- showToast("📸 正在高精物理渲染号牌...");
- renderToCanvas(canvas => {
- const imgData = canvas.toDataURL("image/png");
- fullscreenPlateImg.src = imgData;
- fullscreenOverlay.classList.add("active");
- showToast("🎉 渲染成功!长按车牌可保存至相册");
- });
- }
- function downloadImage() {
- showToast("📸 正在高精物理渲染号牌...");
- renderToCanvas(canvas => {
- const link = document.createElement("a");
- const plateNumber = currentProvince + formatInput(plateInput.value);
- link.download = `${plateNumber}_${activePreset}_license_plate.png`;
- link.href = canvas.toDataURL("image/png");
- link.click();
- showToast("🎉 高清车牌图片导出成功!");
- });
- }
- // --- Event Setup ---
- provinceTrigger.onclick = openProvinceSheet;
- sheetClose.onclick = closeProvinceSheet;
- sheetOverlay.onclick = closeProvinceSheet;
- plateInput.addEventListener("input", updatePlate);
- // Quick Suffix buttons
- document.querySelectorAll(".suffix-btn").forEach(btn => {
- btn.onclick = () => {
- const val = plateInput.value;
- const max = (activePreset === "green") ? 7 : 6;
- if (val.length < max) {
- plateInput.value += btn.textContent;
- } else {
- plateInput.value = val.slice(0, max - 1) + btn.textContent;
- }
- updatePlate();
- };
- });
- // Color Presets tabs
- document.querySelectorAll(".color-tab").forEach(tab => {
- tab.onclick = () => {
- document.querySelector(".color-tab.active").classList.remove("active");
- tab.classList.add("active");
- activePreset = tab.dataset.preset;
- updatePlate();
- };
- });
- // Sliders updates
- [embossSlider, glossSlider, dirtSlider].forEach(slider => {
- slider.addEventListener("input", updatePlate);
- });
- screwToggle.addEventListener("change", updatePlate);
- // Click plate trigger fullscreen
- showcaseContainer.addEventListener("click", () => {
- if (!isDragging) {
- triggerFullscreen();
- }
- isDragging = false;
- });
- actionFullscreen.onclick = triggerFullscreen;
- actionDownload.onclick = downloadImage;
- // Fullscreen close
- fullscreenCloseBtn.onclick = (e) => {
- e.stopPropagation();
- fullscreenOverlay.classList.remove("active");
- };
- fullscreenOverlay.onclick = () => {
- fullscreenOverlay.classList.remove("active");
- };
- fullscreenPlateImg.onclick = (e) => {
- e.stopPropagation();
- };
- // Resize layout handler
- window.addEventListener("resize", adjustPlateFontSize);
- // --- Bootstrap Init ---
- initProvinceSheet();
- updatePlate();
-
- document.addEventListener("DOMContentLoaded", adjustPlateFontSize);
- window.addEventListener("load", adjustPlateFontSize);
- </script>
- </body>
- </html>
|