iT邦幫忙

2018 iT 邦幫忙鐵人賽
DAY 10
0
自我挑戰組

自我挑戰日記系列 第 10

CSS:background 放射

  • 分享至 

  • xImage
  •  

大家好 /images/emoticon/emoticon37.gif

今天來用 linear-gradient 做放射的效果
找到2種方式

第一種
https://ithelp.ithome.com.tw/upload/images/20171215/20107496CvWLF6ZRXv.jpg

background: 
    linear-gradient(24deg, #edac6a 31%, transparent 31%) 0 0,
    linear-gradient(48deg, #e5a575 52.7%, transparent 52.7%) 0 0,
    linear-gradient(72deg, #d49688 75.6%, transparent 75.6%) 0 0,
    linear-gradient(-12deg, #9796a5 17.8%, transparent 17.8%) 100% 0,
    linear-gradient(-36deg, #9d81aa 42%, transparent 42%) 100% 0,
    linear-gradient(-60deg, #a168a8 63%, transparent 63%) 100% 0, 
    linear-gradient(-84deg, #b378a2 90.2%, transparent 90.2%) 100% 0, 
    linear-gradient(12deg, transparent 82%, #9796a5 82%) 100% 100%,
    linear-gradient(36deg, transparent 57.66%, #91a899 57.66%) 100% 100%,
    linear-gradient(60deg, transparent 36.5%, #8ab689 36.5%) 100% 100%,
    linear-gradient(84deg, transparent 10%, #a1c46f 10%) 100% 100%,
    linear-gradient(-24deg, transparent 69%, #f6b45c  68%) 0 100%,
    linear-gradient(-48deg, transparent 47%, #e5bb62 47%) 0 100%,
    linear-gradient(-72deg, transparent 24.52%, #d2c066 24.52%) 0 100%, 
    #c38797 linear-gradient(#bcc36b, #bcc36b) 50% 100%;
background-repeat: no-repeat;
background-size: 50% 50%;

資料參考
https://codepen.io/thebabydino/pen/hkxGp


第二種
https://ithelp.ithome.com.tw/upload/images/20171215/20107496Kjs0IjDwkL.jpg

background: linear-gradient(24deg, #e16352 31%, transparent 31%),
              linear-gradient(48deg, #e68064 53%, transparent 53%),
              linear-gradient(72deg, #eb9d78 75.4%, transparent 75.4%),
              linear-gradient(96deg, #f0b88d 10%, transparent 10%) 100% 0%,
              linear-gradient(120deg, #f6d2a2 37%, transparent 37%) 100% 0%,
              linear-gradient(144deg, #fbeab9 58.3%, transparent 58.3%) 100% 0%,
              linear-gradient(168deg, #d5c8b4 82.5%, transparent 82.5%) 100% 0%,
              linear-gradient(180deg, #afa7ae 100%, transparent 100%) 100% 0%,
              linear-gradient(192deg, #afa7ae 18%, transparent 18%) 100% 100%,
              linear-gradient(216deg, #8787a6 42.5%, transparent 42.5%) 100% 100%,
              linear-gradient(240deg, #5d6a9d 63.5%, transparent 63.5%) 100% 100%,
              linear-gradient(264deg, #2a5095 90.5%, transparent 90.5%) 100% 100%,
              linear-gradient(270deg, #61558a 100%, transparent 100%) 100% 100%,
              linear-gradient(288deg, #61558a 25%, transparent 25%) 0% 100%,
              linear-gradient(312deg, #87597e 48%, transparent 48%) 0% 100%,
              linear-gradient(336deg, #a95d71 69.5%, transparent 69.5%) 0% 100%,
              linear-gradient(360deg, #c66062 100%, transparent 100%) 0% 100%,
              #f0b88d;
  background-repeat: no-repeat;
  background-size: 50% 50%;

資料參考
https://codepen.io/agriboz/pen/izLak
https://wcc723.github.io/css/2013/09/24/css-background/

試著切 15 等份時發現
用第一種方式可以算很久!!
若是切四的倍數時才比較好作
因為先作出一半
另一半用複製、貼上的就行了

最後正好看到有個很有趣範例
就像是機關一樣可以開合

https://codepen.io/long-lazuli/pen/AHwEC

--- 明日待續。


上一篇
CSS:background 連續內凹圓弧
下一篇
CSS:background 圓錐形漸變
系列文
自我挑戰日記30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言