HTML ဂရပ်ဖစ်

ဂရပ်ဖစ် ပင်မစာမျက်နှာ

Google Maps

Maps မိတ်ဆက် Maps အခြေခံ Maps Overlays Maps ပွဲများ Maps ထိန်းချုပ်မှုများ Maps အမျိုးအစားများ Maps အကိုးအကား

SVG ကျူတိုရီရယ်

SVG နိဒါန်း HTML တွင် SVG SVG စတုဂံ SVG စက်ဝိုင်း SVG Ellipse SVG လိုင်း SVG Polygon SVG Polyline SVG လမ်းကြောင်း SVG စာသား SVG Stroking SVG Filters နိဒါန်း SVG မှုန်ဝါးခြင်းအကျိုးသက်ရောက်မှုများ SVG Drop Shadows SVG Linear SVG Radial SVG ဥပမာများ SVG အကိုးအကား

Canvas ကျူတိုရီရယ်

Canvas မိတ်ဆက် ကင်းဗတ်ဆွဲခြင်း။ Canvas Coordinates ကင်းဗတ် Gradients ကင်းဗတ်စာသား ကင်းဗတ်ပုံများ ကင်းဗတ်ရည်ညွှန်း

ကင်းဗတ်နာရီ

နာရီ မိတ်ဆက် နာရီမျက်နှာ နာရီနံပါတ်များ နာရီလက်များ နာရီစတင်

HTML ဂိမ်း

ဂိမ်းမိတ်ဆက် ဂိမ်း Canvas ဂိမ်းအစိတ်အပိုင်းများ ဂိမ်းထိန်းချုပ်သူများ ဂိမ်းအတားအဆီးများ ဂိမ်းရမှတ် ဂိမ်းပုံများ ဂိမ်းအသံ ဂိမ်းဆွဲငင်အား ဂိမ်းခုန်ခြင်း။ ဂိမ်းလှည့်ခြင်း။ ဂိမ်းလှုပ်ရှားမှု

SVG Gradients - Linear


SVG Gradients

Gradient သည် အရောင်တစ်ခုမှ အခြားတစ်ခုသို့ ချောမွေ့စွာ ကူးပြောင်းမှုတစ်ခုဖြစ်သည်။ ထို့အပြင်၊ များစွာသောအရောင်အပြောင်းအလဲများကို တူညီသောဒြပ်စင်သို့ အသုံးချနိုင်သည်။

SVG တွင် gradient အမျိုးအစား နှစ်မျိုးရှိသည်။

  • တစ်ပြေးညီ
  • Radial

SVG Linear Gradient - <linearGradient>

<linearGradient> ဒြပ်စင်အား မျဉ်းကြောင်းအတိုင်း gradient ကို သတ်မှတ်ရန် အသုံးပြုသည်။

<linearGradient> ဒြပ်စင်အား <defs> တဂ်တစ်ခုအတွင်းတွင် အစုအဝေးဖြစ်ရပါမည်။ <defs> tag သည် အဓိပ္ပါယ်ဖွင့်ဆိုချက်များအတွက် အတိုကောက်ဖြစ်ပြီး အထူးဒြပ်စင်များ (ဥပမာ gradient များကဲ့သို့) ၏ အဓိပ္ပါယ်ဖွင့်ဆိုချက်ပါရှိသည်။

အလျားလိုက်၊ ဒေါင်လိုက် သို့မဟုတ် ထောင့်ဖြတ်အဆင့်များအဖြစ် သတ်မှတ်နိုင်သည်-

  • y1 နှင့် y2 သည် ညီမျှပြီး x1 နှင့် x2 ကွာခြားသောအခါ အလျားလိုက် gradient များကို ဖန်တီးသည်
  • x1 နှင့် x2 သည် ညီမျှပြီး y1 နှင့် y2 ကွာခြားသောအခါ ဒေါင်လိုက် gradient များကို ဖန်တီးသည်။
  • x1 နှင့် x2 ကွာခြားပြီး y1 နှင့် y2 ကွာခြားသောအခါ Angular gradient များကို ဖန်တီးသည်

ဥပမာ ၁

အဝါရောင်မှ အနီရောင်သို့ အလျားလိုက်မျဉ်းဖြောင့်မျဉ်းကြောင်းဖြင့် ဘဲဥပုံတစ်ခုကို သတ်မှတ်ပါ-

Sorry, your browser does not support inline SVG.

ဤသည်မှာ SVG ကုဒ်ဖြစ်သည်

ဥပမာ

<svg height="150" width="400">
  <defs>
    <linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="0%">
      <stop offset="0%" style="stop-color:rgb(255,255,0);stop-opacity:1" />
      <stop offset="100%" style="stop-color:rgb(255,0,0);stop-opacity:1" />
    </linearGradient>
  </defs>
  <ellipse cx="200" cy="70" rx="85" ry="55" fill="url(#grad1)" />
</svg>

ကုဒ်၏ ရှင်းလင်းချက်

  • <linearGradient> tag ၏ id attribute သည် gradient အတွက် ထူးခြားသောအမည်ကို သတ်မှတ်ပေးပါသည်။
  • <linearGradient> tag ၏ x1၊ x2၊ y1၊y2 ရည်ညွှန်းချက်များသည် gradient ၏ အစနှင့်အဆုံး အနေအထားကို သတ်မှတ်သည်
  • gradient တစ်ခုအတွက် အရောင်အကွာအဝေးကို အရောင်နှစ်မျိုး သို့မဟုတ် ထို့ထက်ပိုသော အရောင်များဖြင့် ပေါင်းစပ်နိုင်ပါသည်။ အရောင်တစ်ခုစီကို <stop> tag ဖြင့် သတ်မှတ်ထားသည်။ အော့ဖ်ဆက် attribute ကို gradient အရောင်၏အစနှင့်အဆုံးနေရာတွင်သတ်မှတ်ရန်အသုံးပြုသည်။
  • ဖြည့်စွက်ရည်ညွှန်းချက်သည် ellipse element ကို gradient နှင့် ချိတ်ဆက်ထားသည်။


ဥပမာ ၂

အဝါရောင်မှ အနီရောင်သို့ ဒေါင်လိုက်မျဉ်းဖြောင့်အရောင်ဖြင့် ဘဲဥပုံတစ်ခုကို သတ်မှတ်ပါ-

Sorry, your browser does not support inline SVG.

ဤသည်မှာ SVG ကုဒ်ဖြစ်သည်

ဥပမာ

<svg height="150" width="400">
  <defs>
    <linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%">
      <stop offset="0%" style="stop-color:rgb(255,0,0);stop-opacity:1" />
      <stop offset="100%" style="stop-color:rgb(255,255,0);stop-opacity:1" />
    </linearGradient>
  </defs>
  <ellipse cx="200" cy="70" rx="85" ry="55" fill="url(#grad2)" />
</svg>

ဥပမာ ၃

အဝါရောင်မှ အနီရောင်သို့ အလျားလိုက်မျဉ်းစောင်းဖြင့် အလျားလိုက်မျဉ်းစောင်းဖြင့် ellipse ကို သတ်မှတ်ပြီး ellipse အတွင်းရှိ စာသားကို ထည့်ပါ-

SVG Sorry, your browser does not support inline SVG.

ဤသည်မှာ SVG ကုဒ်ဖြစ်သည်

ဥပမာ

<svg height="150" width="400">
  <defs>
    <linearGradient id="grad3" x1="0%" y1="0%" x2="100%" y2="0%">
      <stop offset="0%" style="stop-color:rgb(255,255,0);stop-opacity:1" />
      <stop offset="100%" style="stop-color:rgb(255,0,0);stop-opacity:1" />
    </linearGradient>
  </defs>
  <ellipse cx="200" cy="70" rx="85" ry="55" fill="url(#grad3)" />
  <text fill="#ffffff" font-size="45" font-family="Verdana" x="150" y="86">
  SVG</text>
</svg>

ကုဒ်၏ ရှင်းလင်းချက်

  • စာသားထည့်ရန် <text> အစိတ်အပိုင်းကို အသုံးပြုသည်။