小程序/PC圣誕動畫

先祝各位小伙伴圣誕快樂,寫一個圣誕動畫送給大家奔垦,寫的是小程序端的叠穆,大家可以自己改成web端少漆,由于素材的限制寫得比較簡陋,大家看看就好哈硼被;話不多說上源碼

wxml

<!--components/christmas/christmas.wxml-->
<view class="christmas_container" catchtouchmove="move" bindtap="onClick">
  <view class="title">
      <image src="cloud://frankieqi-9gur2q1x49d1ebbc.6672-frankieqi-9gur2q1x49d1ebbc-1304442932/happy.png"></image>
  </view>
  <view class="snow">
      <view class="snow1"></view>
      <view class="snow2"></view>
      <view class="snow3"></view>
  </view>
  <view class="tree">
      <view>
          <text></text>
          <text></text>
      </view>
      <view>
          <text></text>
          <text></text>
      </view>
      <view>
          <text></text>
          <text></text>
      </view>
      <view>
          <text></text>
          <text></text>
      </view>
      <view>
          <text></text>
          <text></text>
      </view>
  </view>
  <view class="people">
    <image src="cloud://frankieqi-9gur2q1x49d1ebbc.6672-frankieqi-9gur2q1x49d1ebbc-1304442932/chirsmes.png"></image>
  </view>
</view>

wxss

/* components/christmas/christmas.wxss */
view text {
  margin:0;
  padding: 0;
  box-sizing: border-box;
}
.christmas_container {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #001f00;
}
.christmas_container::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: #fff;
  height: 250rpx;
}
.tree {
  position: relative;
  bottom: 10rpx;
  width: 400rpx;
  height: 400rpx;
  /* background: rgba(0,0,0,.1); */

}
.tree::before {
  position: absolute;
  content: "";
  bottom: -300rpx;
  left: 0;
  width: 100%;
  height: 100rpx;
  border-radius: 50%;
  background: rgba(0,0,0,.1);
}
.tree::after {
  content: '';
  position: absolute;
  bottom: -240rpx;
  left: 50%;
  transform: translateX(-50%);
  width: 60rpx;
  height: 40rpx;
  background: #734500;
}
.tree view {
  position: absolute;
  width: 100%;
  height: 200rpx;
  bottom: -200rpx;
  display: flex;
}
.tree view:nth-child(2) {
  transform: translateY(-100rpx) scale(0.8);
  z-index: 1;
}
.tree view:nth-child(3) {
  transform: translateY(-175rpx) scale(0.6);
  z-index: 1;
}
.tree view:nth-child(4) {
  transform: translateY(-240rpx) scale(0.4);
  z-index: 1;
}
.tree view:nth-child(5) {
  transform: translateY(-280rpx) scale(0.2);
  z-index: 1;
}
.tree view text {
  position: relative;
  width: 50%;
  height: 100%;
  display: block;
  overflow: hidden;
}
.tree view text:nth-child(1):before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 200%;
  height: 100%;
  background: linear-gradient(#00b300,#0f0);
  border-top-left-radius: 110% 100%;
  border-top-right-radius: 0% 100%;
  border-bottom-left-radius: 50% 20%;
  border-bottom-right-radius: 50% 20%;
}
.tree view text:nth-child(2):before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 200%;
  height: 100%;
  background: linear-gradient(#00b300,#0f0);
  border-top-left-radius: 0% 100%;
  border-top-right-radius: 110% 100%;
  border-bottom-left-radius: 50% 20%;
  border-bottom-right-radius: 50% 20%;

}
.snow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}
.snow .snow1 {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('https://uploadfile.huiyi8.com/2014/0227/20140227102820171.jpg');
  z-index: 1000;
  mix-blend-mode: screen;/*牛逼*/
  animation: animate 2s linear infinite;
  transform: scale(2);
}
.snow .snow2 {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('https://uploadfile.huiyi8.com/2014/0227/20140227102820171.jpg');
  z-index: 1000;
  mix-blend-mode: screen;/*牛逼*/
  animation: animate 5s linear infinite;
  transform: scale(1);
  filter: blur(1rpx);
}
.snow .snow3 {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=1888909580,1624588087&fm=26&gp=0.jpg');
  z-index: 1000;
  mix-blend-mode: screen;/*牛逼*/
  animation: animate 5s linear infinite;
  transform: scale(1.5);
}
.people image{
  position: absolute;
  bottom: 0;
  left: 0;
  width: 120rpx;
  height: 120rpx;
  animation: people 3s ease infinite;
}
@keyframes animate {
  0% 
  {
      background-position: 0 0;
  }
  50% {
    background-position: 0 350rpx;
  }
  100% {
      background-position: 0 700rpx;
  }
}
@keyframes word {
  0% {
    opacity: 0;
  }
  50% {
    opacity: .6;
  }
  75% {
    opacity: 1;
  }
  100% {
    opacity: .5;
  }
}
@keyframes people {
  0% {
    left: 0;
  }
  50% {
    left: 50%;
  }
  100% {
    left: 100%;
  }
}
.title {
  position: absolute;
  top: 0rpx;
}
.title image{
  width: 620rpx;
  animation: word 3s linear infinite;
}

修改成web端

把view替換成div示损;把text替換成span;把rpx替換成px嚷硫;即可

素材:

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末检访,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子仔掸,更是在濱河造成了極大的恐慌脆贵,老刑警劉巖,帶你破解...
    沈念sama閱讀 219,188評論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件起暮,死亡現(xiàn)場離奇詭異卖氨,居然都是意外死亡,警方通過查閱死者的電腦和手機负懦,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,464評論 3 395
  • 文/潘曉璐 我一進店門筒捺,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人纸厉,你說我怎么就攤上這事系吭。” “怎么了颗品?”我有些...
    開封第一講書人閱讀 165,562評論 0 356
  • 文/不壞的土叔 我叫張陵肯尺,是天一觀的道長。 經(jīng)常有香客問我抛猫,道長蟆盹,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,893評論 1 295
  • 正文 為了忘掉前任闺金,我火速辦了婚禮逾滥,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘。我一直安慰自己寨昙,他們只是感情好讥巡,可當(dāng)我...
    茶點故事閱讀 67,917評論 6 392
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著舔哪,像睡著了一般欢顷。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上捉蚤,一...
    開封第一講書人閱讀 51,708評論 1 305
  • 那天抬驴,我揣著相機與錄音,去河邊找鬼缆巧。 笑死布持,一個胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的陕悬。 我是一名探鬼主播题暖,決...
    沈念sama閱讀 40,430評論 3 420
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼捉超!你這毒婦竟也來了胧卤?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 39,342評論 0 276
  • 序言:老撾萬榮一對情侶失蹤拼岳,失蹤者是張志新(化名)和其女友劉穎枝誊,沒想到半個月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體裂问,經(jīng)...
    沈念sama閱讀 45,801評論 1 317
  • 正文 獨居荒郊野嶺守林人離奇死亡侧啼,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,976評論 3 337
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現(xiàn)自己被綠了堪簿。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 40,115評論 1 351
  • 序言:一個原本活蹦亂跳的男人離奇死亡皮壁,死狀恐怖椭更,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情蛾魄,我是刑警寧澤虑瀑,帶...
    沈念sama閱讀 35,804評論 5 346
  • 正文 年R本政府宣布,位于F島的核電站滴须,受9級特大地震影響舌狗,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜扔水,卻給世界環(huán)境...
    茶點故事閱讀 41,458評論 3 331
  • 文/蒙蒙 一痛侍、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧魔市,春花似錦主届、人聲如沸赵哲。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,008評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽枫夺。三九已至,卻和暖如春绘闷,著一層夾襖步出監(jiān)牢的瞬間橡庞,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 33,135評論 1 272
  • 我被黑心中介騙來泰國打工印蔗, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留毙死,地道東北人。 一個月前我還...
    沈念sama閱讀 48,365評論 3 373
  • 正文 我出身青樓喻鳄,卻偏偏與公主長得像扼倘,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子除呵,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 45,055評論 2 355

推薦閱讀更多精彩內(nèi)容