{"version":"1.0","provider_name":"T\u00f5ll portfoolio | eng","provider_url":"https:\/\/robintoll24.thkit.ee\/wp\/eng","author_name":"admin","author_url":"https:\/\/robintoll24.thkit.ee\/wp\/eng\/author\/admin\/","title":"JS: canvas drawing - T\u00f5ll portfoolio | eng","type":"rich","width":600,"height":338,"html":"<blockquote class=\"wp-embedded-content\" data-secret=\"kRLyFtcVih\"><a href=\"https:\/\/robintoll24.thkit.ee\/wp\/eng\/js-canvas-joonistamine\/\">JS: canvas drawing<\/a><\/blockquote><iframe sandbox=\"allow-scripts\" security=\"restricted\" src=\"https:\/\/robintoll24.thkit.ee\/wp\/eng\/js-canvas-joonistamine\/embed\/#?secret=kRLyFtcVih\" width=\"600\" height=\"338\" title=\"&#8220;JS: canvas drawing&#8221; &#8212; T\u00f5ll portfoolio | eng\" data-secret=\"kRLyFtcVih\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" class=\"wp-embedded-content\"><\/iframe><script type=\"text\/javascript\">\n\/* <![CDATA[ *\/\n\/*! This file is auto-generated *\/\n!function(d,l){\"use strict\";l.querySelector&&d.addEventListener&&\"undefined\"!=typeof URL&&(d.wp=d.wp||{},d.wp.receiveEmbedMessage||(d.wp.receiveEmbedMessage=function(e){var t=e.data;if((t||t.secret||t.message||t.value)&&!\/[^a-zA-Z0-9]\/.test(t.secret)){for(var s,r,n,a=l.querySelectorAll('iframe[data-secret=\"'+t.secret+'\"]'),o=l.querySelectorAll('blockquote[data-secret=\"'+t.secret+'\"]'),c=new RegExp(\"^https?:$\",\"i\"),i=0;i<o.length;i++)o[i].style.display=\"none\";for(i=0;i<a.length;i++)s=a[i],e.source===s.contentWindow&&(s.removeAttribute(\"style\"),\"height\"===t.message?(1e3<(r=parseInt(t.value,10))?r=1e3:~~r<200&&(r=200),s.height=r):\"link\"===t.message&&(r=new URL(s.getAttribute(\"src\")),n=new URL(t.value),c.test(n.protocol))&&n.host===r.host&&l.activeElement===s&&(d.top.location.href=t.value))}},d.addEventListener(\"message\",d.wp.receiveEmbedMessage,!1),l.addEventListener(\"DOMContentLoaded\",function(){for(var e,t,s=l.querySelectorAll(\"iframe.wp-embedded-content\"),r=0;r<s.length;r++)(t=(e=s[r]).getAttribute(\"data-secret\"))||(t=Math.random().toString(36).substring(2,12),e.src+=\"#?secret=\"+t,e.setAttribute(\"data-secret\",t)),e.contentWindow.postMessage({message:\"ready\",secret:t},\"*\")},!1)))}(window,document);\n\/\/# sourceURL=https:\/\/robintoll24.thkit.ee\/wp\/eng\/wp-includes\/js\/wp-embed.min.js\n\/* ]]> *\/\n<\/script>\n","description":"Joonistamine JS-ga R: R: R: Lipud canvas#tahvel{ background-color: rosybrown; border: 1px solid black; } canvas#lipp{ border: 1px solid grey; } function eestilipp(){ const lipp=document.getElementById(&#8220;lipp&#8221;); if(lipp.getContext){ let l=lipp.getContext(&#8220;2d&#8221;); l.fillStyle=&#8221;blue&#8221;; l.fillRect(0,0,330,70); l.fillStyle=&#8221;black&#8221;; l.fillRect(0,70,330,70); l.fillStyle=&#8221;white&#8221;; l.fillRect(0,140,330,70); } } function Itaalialipp(){ const lipp=document.getElementById(&#8220;lipp&#8221;); if(lipp.getContext){ let l=lipp.getContext(&#8220;2d&#8221;); l.fillStyle=&#8221;green&#8221;; l.fillRect(0,0,110,210); l.fillStyle=&#8221;white&#8221;; l.fillRect(110,0,220,210); l.fillStyle=&#8221;red&#8221;; l.fillRect(220,0,330,210); } } function RootsiLipp(){ const lipp=document.getElementById(&#8220;lipp&#8221;); if(lipp.getContext){ let l=lipp.getContext(&#8220;2d&#8221;); l.fillStyle=&#8221;darkblue&#8221;; l.fillRect(0,0,330,320); l.fillStyle=&#8221;yellow&#8221;; l.fillRect(105,0,50,220); l.fillStyle=&#8221;yellow&#8221;; l.fillRect(0,80,330,50); } } function Mehiko(){ const lipp=document.getElementById(&#8220;lipp&#8221;); if(lipp.getContext){ let l=lipp.getContext(&#8220;2d&#8221;); l.fillStyle=&#8221;green&#8221;; l.fillRect(0,0,90,220); l.fillStyle=&#8221;white&#8221;; l.fillRect(110,0,280,210); l.fillStyle=&#8221;red&#8221;; l.fillRect(245,0,330,220); const fail=new Image; fail.src=&#8221;https:\/\/robintoll24.thkit.ee\/wp\/wp-content\/uploads\/2025\/10\/mehiko.png&#8221;; fail.onload = () =&gt; { l.drawImage(fail, 45,10,250,200); } } } function sirgeJoon(){ const tahvel=document.getElementById(&#8220;tahvel&#8221;); if(tahvel.getContext){ let t=tahvel.getContext(&#8220;2d&#8221;); t.beginPath(); t.strokeStyle=&#8221;red&#8221;; t.lineWidth = 1; t.moveTo(20,80); t.lineTo(50,100); t.stroke(); } } function kolmnurk(){ const tahvel=document.getElementById(&#8220;tahvel&#8221;); if(tahvel.getContext){ let t=tahvel.getContext(&#8220;2d&#8221;); t.beginPath(); t.strokeStyle=&#8221;red&#8221;; t.lineWidth = &#8220;red&#8221;; t.moveTo(50,100); t.lineTo(150,100); t.lineTo(150,200); t.lineTo(50,100); t.stroke(); t.fill(); } } function puhasta(){ const tahvel=document.getElementById(&#8220;tahvel&#8221;); if(tahvel.getContext){ let t=tahvel.getContext(&#8220;2d&#8221;); t.clearRect(0,0,300,250); } } function ring(){ const tahvel=document.getElementById(&#8220;tahvel&#8221;); let r=document.getElementById(&#8220;raadius&#8221;); if(tahvel.getContext){ let t=tahvel.getContext(&#8220;2d&#8221;); t.beginPath(); t.strokeStyle=&#8221;green&#8221;; t.lineWidth = 1; t.arc(50,50,r.value,0,2*Math.PI,true); t.stroke(); t.beginPath(); t.fillStyle=&#8221;green&#8221;; t.lineWidth = 1; t.arc(50,130,r.value,0,2*Math.PI,true); t.stroke(); t.fill(); } } function ristkylik(){ const tahvel=document.getElementById(&#8220;tahvel&#8221;); let laius=document.getElementById(&#8220;laius&#8221;); let korgus=document.getElementById(&#8220;korgus&#8221;); if(tahvel.getContext){ let t=tahvel.getContext(&#8220;2d&#8221;); t.fillStyle=&#8221;yellow&#8221;; t.fillRect(50,30,laius.value,korgus.value); } } function pilt(){ const tahvel=document.getElementById(&#8220;tahvel&#8221;); if(tahvel.getContext){ let t=tahvel.getContext(&#8220;2d&#8221;); const fail=new Image; fail.src=&#8221;https:\/\/picsum.photos\/200\/300&#8243;; t.drawImage(fail, 50,50,100,200); } } function Valgusfoor(){ const tahvel=document.getElementById(&#8220;tahvel&#8221;); if(tahvel.getContext){ let t=tahvel.getContext(&#8220;2d&#8221;); t.fillStyle=&#8221;grey&#8221;; t.fillRect(100,30,80,170); } let r=document.getElementById(&#8220;raadius&#8221;); if(tahvel.getContext) { let t = tahvel.getContext(&#8220;2d&#8221;); t.beginPath(); t.strokeStyle = &#8220;green&#8221;; t.lineWidth = 1; t.arc(200, 300, r.value, 0, 2 * Math.PI, true); t.stroke(); } }"}