{"id":7604,"date":"2026-11-26T17:33:55","date_gmt":"2026-11-26T14:33:55","guid":{"rendered":"https:\/\/hjart.art\/?page_id=7604"},"modified":"2026-11-26T18:27:37","modified_gmt":"2026-11-26T15:27:37","slug":"color-lens","status":"publish","type":"page","link":"https:\/\/hjart.art\/color-lens-%D8%A7%D9%84%D8%B9%D8%AF%D8%B3%D8%A9-%D8%A7%D9%84%D9%84%D9%88%D9%86%D9%8A%D8%A9","title":{"rendered":"Double exposure red and blue lens"},"content":{"rendered":"<div id=\"color-lens\" style=\"background:#000;color:#fff;min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:space-between;padding:16px;box-sizing:border-box;font-family:Tahoma,Arial,sans-serif;\">\n<style>\nbody.page-id-7604 .entry-title,body.page-id-7604 .wp-block-post-title{font-size:18px!important;line-height:1.35!important;font-weight:500!important;margin:12px 0!important;text-align:center!important;}\n#color-lens #lens-canvas{width:100%;height:calc(100vh - 190px);display:block;border-radius:16px;background:#111}\n#color-lens #lens-video{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}\n#color-lens .controls{display:flex;gap:18px;justify-content:center;padding:16px 0}\n#color-lens button{border:0;color:white;font-size:16px;font-weight:700;cursor:pointer;line-height:1.35}\n#color-lens .color-button{width:66px;height:66px;border-radius:50%;font-size:20px}\n#color-lens .red{background:#e52d32} #color-lens .blue{background:#2465e8} #color-lens .off{background:#444}\n#color-lens .message{color:#bbb;text-align:center;font-size:13px;line-height:1.65;margin:8px;white-space:pre-line}\n#color-lens #start-camera{padding:13px 22px;border-radius:12px;background:#fff;color:#111;margin:12px auto;font-size:15px;line-height:1.5}\n<\/style>\n<div style=\"width:100%;flex:1;position:relative\">\n<video id=\"lens-video\" autoplay playsinline muted><\/video><br \/>\n<canvas id=\"lens-canvas\"><\/canvas>\n<\/div>\n<p><button id=\"start-camera\" type=\"button\" onclick=\"window.startLensCamera()\">\u062a\u0634\u063a\u064a\u0644 \u0627\u0644\u0639\u062f\u0633\u0629<br \/><span style=\"font-size:14px;font-weight:400\">Start Lens<\/span><\/button><\/p>\n<p id=\"lens-message\" class=\"message\">\u0627\u0636\u063a\u0637 \u062a\u0634\u063a\u064a\u0644 \u0627\u0644\u0639\u062f\u0633\u0629 \u062b\u0645 \u0648\u0627\u0641\u0642 \u0639\u0644\u0649 \u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u0627\u0644\u0643\u0627\u0645\u064a\u0631\u0627<br \/><span>Tap Start Lens and allow camera access<\/span><\/p>\n<div class=\"controls\">\n<button class=\"color-button red\" type=\"button\" aria-label=\"\u0645\u0631\u0634\u062d \u0623\u062d\u0645\u0631 Red filter\" onclick=\"window.setLensColor('red')\">R<span style=\"display:block;font-size:12px;font-weight:400;line-height:1.3\">\u0623\u062d\u0645\u0631 \/ Red<\/span><\/button><br \/>\n<button class=\"color-button blue\" type=\"button\" aria-label=\"\u0645\u0631\u0634\u062d \u0623\u0632\u0631\u0642 Blue filter\" onclick=\"window.setLensColor('blue')\">B<span style=\"display:block;font-size:12px;font-weight:400;line-height:1.3\">\u0623\u0632\u0631\u0642 \/ Blue<\/span><\/button><br \/>\n<button class=\"color-button off\" type=\"button\" aria-label=\"\u0625\u064a\u0642\u0627\u0641 \u0627\u0644\u0645\u0631\u0634\u062d Off\" onclick=\"window.setLensColor('off')\">\u25c9<span style=\"display:block;font-size:12px;font-weight:400;line-height:1.3\">\u0625\u064a\u0642\u0627\u0641 \/ Off<\/span><\/button>\n<\/div>\n<p><script>\n(function(){\n const root=document.getElementById('color-lens'),video=root.querySelector('#lens-video'),canvas=root.querySelector('#lens-canvas'),msg=root.querySelector('#lens-message'),startBtn=root.querySelector('#start-camera');\n const ctx=canvas.getContext('2d',{willReadFrequently:true}); let mode='red',stream=null,raf=null,started=false;\n window.setLensColor=function(color){mode=color;};\n function render(){\n  if(video.readyState>=2){\n   const box=canvas.getBoundingClientRect(),vw=video.videoWidth,vh=video.videoHeight;\n   if(vw&&vh&&box.width&&box.height){\n    const w=vw,h=vh;\n    if(canvas.width!==w||canvas.height!==h){canvas.width=w;canvas.height=h;}\n    const cover=Math.max(w\/vw,h\/vh),sw=w\/cover,sh=h\/cover,sx=(vw-sw)\/2,sy=(vh-sh)\/2;\n    ctx.drawImage(video,sx,sy,sw,sh,0,0,w,h);\n    if(mode!=='off'){\n     const img=ctx.getImageData(0,0,w,h),d=img.data;\n     for(let i=0;i<d.length;i+=4){\n      if(mode==='red'){d[i+1]*=0.15;d[i+2]*=0.15;}\n      else if(mode==='blue'){d[i]*=0.35;d[i+1]*=0.45;d[i]=(d[i]-128)*1.08+132;d[i+1]=(d[i+1]-128)*1.08+132;d[i+2]=(d[i+2]-128)*1.08+132;d[i]=Math.max(0,Math.min(255,d[i]));d[i+1]=Math.max(0,Math.min(255,d[i+1]));d[i+2]=Math.max(0,Math.min(255,d[i+2]));}\n     }\n     ctx.putImageData(img,0,0);\n    }\n   }\n  }\n  raf=requestAnimationFrame(render);\n }\n window.startLensCamera=async function(){\n  if(started)return;\n  if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){msg.textContent='\u0627\u0644\u0645\u062a\u0635\u0641\u062d \u0644\u0627 \u064a\u062f\u0639\u0645 \u062a\u0634\u063a\u064a\u0644 \u0627\u0644\u0643\u0627\u0645\u064a\u0631\u0627.\\nBrowser does not support camera access.';return;}\n  startBtn.disabled=true;startBtn.textContent='\u062c\u0627\u0631\u064d \u062a\u0634\u063a\u064a\u0644 \u0627\u0644\u0643\u0627\u0645\u064a\u0631\u0627\u2026\\nStarting camera\u2026';\n  try{\n   stream=await navigator.mediaDevices.getUserMedia({video:{facingMode:{ideal:'environment'},width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30,max:30}},audio:false});\n   video.srcObject=stream;await video.play();started=true;startBtn.style.display='none';\n   msg.textContent='\u0627\u062e\u062a\u0631 \u0627\u0644\u0645\u0631\u0634\u062d \u0623\u0648 \u0623\u0648\u0642\u0641\u0647\\nChoose a filter or turn it off';\n   if(!raf)render();\n  }catch(e){\n   startBtn.disabled=false;startBtn.textContent='\u0625\u0639\u0627\u062f\u0629 \u0645\u062d\u0627\u0648\u0644\u0629 \u062a\u0634\u063a\u064a\u0644 \u0627\u0644\u0639\u062f\u0633\u0629\\nRetry Camera';\n   msg.textContent='\u0644\u0645 \u064a\u062a\u0645 \u0627\u0644\u0633\u0645\u0627\u062d \u0628\u0627\u0644\u0643\u0627\u0645\u064a\u0631\u0627. \u062a\u062d\u0642\u0642 \u0645\u0646 \u0625\u0630\u0646 \u0627\u0644\u0643\u0627\u0645\u064a\u0631\u0627 \u0641\u064a \u0627\u0644\u0645\u062a\u0635\u0641\u062d \u062b\u0645 \u0623\u0639\u062f \u0627\u0644\u0645\u062d\u0627\u0648\u0644\u0629.\\nCamera access denied. Check browser permissions and try again.';\n  }\n };\n})();\n<\/script><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u0639\u062f\u0633\u0629 \u0631\u0642\u0645\u064a\u0629 \u0628\u0633\u064a\u0637\u0629 \u0644\u0639\u0631\u0636 \u0627\u0644\u0643\u0627\u0645\u064a\u0631\u0627 \u0628\u0645\u0631\u0634\u062d \u0623\u062d\u0645\u0631 \u0623\u0648 \u0623\u0632\u0631\u0642 \u0623\u0648 \u062f\u0648\u0646 \u0645\u0631\u0634\u062d.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":"","_yoast_wpseo_title":"","_yoast_wpseo_metadesc":"","_yoast_wpseo_focuskw":"","rank_math_title":"","rank_math_description":"","rank_math_focus_keyword":""},"blocksy_meta":"","featured_image_urls_v2":{"full":"","thumbnail":"","medium":"","medium_large":"","large":"","1536x1536":"","2048x2048":""},"post_excerpt_stackable_v2":"<p>\u0639\u062f\u0633\u0629 \u0631\u0642\u0645\u064a\u0629 \u0628\u0633\u064a\u0637\u0629 \u0644\u0639\u0631\u0636 \u0627\u0644\u0643\u0627\u0645\u064a\u0631\u0627 \u0628\u0645\u0631\u0634\u062d \u0623\u062d\u0645\u0631 \u0623\u0648 \u0623\u0632\u0631\u0642 \u0623\u0648 \u062f\u0648\u0646 \u0645\u0631\u0634\u062d.<\/p>\n","category_list_v2":"","author_info_v2":{"name":"hjart.art","url":"https:\/\/hjart.art\/?author=1"},"comments_num_v2":"0 comments","_links":{"self":[{"href":"https:\/\/hjart.art\/index.php?rest_route=\/wp\/v2\/pages\/7604"}],"collection":[{"href":"https:\/\/hjart.art\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/hjart.art\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/hjart.art\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hjart.art\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7604"}],"version-history":[{"count":44,"href":"https:\/\/hjart.art\/index.php?rest_route=\/wp\/v2\/pages\/7604\/revisions"}],"predecessor-version":[{"id":7648,"href":"https:\/\/hjart.art\/index.php?rest_route=\/wp\/v2\/pages\/7604\/revisions\/7648"}],"wp:attachment":[{"href":"https:\/\/hjart.art\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7604"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}