29
28

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ぷよぷよする玉をCSSで作ってみた

Posted at

「攻城戦記バハムートグリード」のマイページで、ぷよぷよはねる玉のボタンがあったので、それを参考にしてぷよぷよする玉をCSSで作ってみた。

今回作ったサンプル
http://jk0602.sakura.ne.jp/sample/jelly_ball/

ソースコード
http://jk0602.sakura.ne.jp/sample/jelly_ball/jelly_ball.zip

「攻城戦記バハムートグリード」のソースを見てみると、scaleの変化だけであのぷよぷよした感じを作っていた。。。使い方次第でこんな風にも表現できるんだなぁ~と感心しました。

index.html
<body>
	<div class="content">
		<div class="ball jelly"></div>
	</div>
</body>
index.css
.ball{
    position:absolute;
    top:100px;
    left: 110px;
    width: 100px;
    height: 100px;
    border-radius:50px;
    background: #FFF;
}

.jelly {
  -webkit-animation-duration: 4s;
  -webkit-animation-timing-function: ease-in;
  -webkit-animation-iteration-count: infinite;
  -webkit-transform-origin: bottom center;
  -webkit-animation-name: jelly;
}

@-webkit-keyframes jelly {
    0%    {-webkit-transform: scale(1, 1);}
    8%    {-webkit-transform: scale(1, 1);}
    10%   {-webkit-transform: scale(1.1, 0.9);}
    13%   {-webkit-transform: scale(0.9, 1.1);}
    17.5% {-webkit-transform: scale(1, 1);}
    19%   {-webkit-transform: scale(1, 1);}
    58%   {-webkit-transform: scale(1, 1);}
    60%   {-webkit-transform: scale(1.1, 0.9);}
    63%   {-webkit-transform: scale(0.9, 1.1);}
    67.5% {-webkit-transform: scale(1, 1);}
    69%   {-webkit-transform: scale(1, 1);}
    100%  {-webkit-transform: scale(1, 1);}
}
29
28
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
29
28

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?