<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>css3 | ウダ2Blog</title>
	<atom:link href="https://uda2.com/blog/tag/css3/feed/" rel="self" type="application/rss+xml" />
	<link>https://uda2.com/blog</link>
	<description>大阪でフリーランスとしてWEB制作している管理人が気になった技術をメモったり、作ったツールの紹介などを綴っているブログです。</description>
	<lastBuildDate>Tue, 30 Oct 2018 16:00:50 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>
	<item>
		<title>FlexならCSSだけで順序入れ替え</title>
		<link>https://uda2.com/blog/flexorder/</link>
					<comments>https://uda2.com/blog/flexorder/#respond</comments>
		
		<dc:creator><![CDATA[uda2]]></dc:creator>
		<pubDate>Thu, 04 Aug 2016 02:00:50 +0000</pubDate>
				<category><![CDATA[制作日記]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[Flex]]></category>
		<guid isPermaLink="false">http://uda2.com/blog/?p=2058</guid>

					<description><![CDATA[<p>基本HTMLで書かれたものは左上から右下に掲載され逆転するのは難しかった。 CSS3のFlex（フレキシブルボックスレイアウト）を使うと簡単に順番が変えられるようになった。 Flexはテーブルレイアウトかあらfloatの</p>
The post <a href="https://uda2.com/blog/flexorder/">FlexならCSSだけで順序入れ替え</a> first appeared on <a href="https://uda2.com/blog">ウダ2Blog</a>.]]></description>
										<content:encoded><![CDATA[<p>基本HTMLで書かれたものは左上から右下に掲載され逆転するのは難しかった。<br />
CSS3のFlex（フレキシブルボックスレイアウト）を使うと簡単に順番が変えられるようになった。<br />
Flexはテーブルレイアウトかあらfloatの時代を経て現れた新しいレイアウト方式で古いパソコンやスマホは未対応だったりしますが、IE8-9にも対応させる<a href="https://github.com/jonathantneal/flexibility" target="_blank">flexibility.js</a>も現れ期待がもてます。<br />
<span id="more-2058"></span><br />
本題の順序を変更するCSSですが、今回はPC版だとHTMLの順番で表示されるが、スマホだと3番目の項目が一番上に移動するようなサンプルを作成した。<br />
<a href="http://uda2.com/flexorder.html" target="_blank">Flex順序サンプル</a></p>
<p>簡単に解説すると、まず親要素（flexコンテナ）に<br />
display: flex;<br />
と入れフレキシブルボックスレイアウト化し、合わせて表示方向を上から下になるように指定し下記も入れて置く<br />
flex-direction: column;<br />
スマホの場合は特定の子要素（Flexアイテム）に<br />
order: -1;<br />
と記述し最初に持ってきている。</p>The post <a href="https://uda2.com/blog/flexorder/">FlexならCSSだけで順序入れ替え</a> first appeared on <a href="https://uda2.com/blog">ウダ2Blog</a>.]]></content:encoded>
					
					<wfw:commentRss>https://uda2.com/blog/flexorder/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>サインポール風アニメーションjQueryプラグイン</title>
		<link>https://uda2.com/blog/barbersignpole/</link>
					<comments>https://uda2.com/blog/barbersignpole/#respond</comments>
		
		<dc:creator><![CDATA[uda2]]></dc:creator>
		<pubDate>Tue, 14 Apr 2015 12:25:15 +0000</pubDate>
				<category><![CDATA[制作日記]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[jQuery プラグイン]]></category>
		<category><![CDATA[transform]]></category>
		<guid isPermaLink="false">http://uda2.com/blog/?p=1882</guid>

					<description><![CDATA[<p>首相が通ってる美容室の発言に端を発してQBハウスの社長が規制改革に動いてるらしい散髪屋さんですが昔から赤・白・青のサインポールが定番になっています。 デザインの梅干によるとトリコロールのサインポールは日本だけで無く世界的</p>
The post <a href="https://uda2.com/blog/barbersignpole/">サインポール風アニメーションjQueryプラグイン</a> first appeared on <a href="https://uda2.com/blog">ウダ2Blog</a>.]]></description>
										<content:encoded><![CDATA[<p>首相が通ってる美容室の発言に端を発してQBハウスの社長が規制改革に動いてるらしい散髪屋さんですが昔から赤・白・青のサインポールが定番になっています。<br />
<a href="http://www4.nhk.or.jp/umeboshi/" target="_blank">デザインの梅干</a>によるとトリコロールのサインポールは日本だけで無く世界的に使われてるようです。</p>
<p>そこでサインポールの動きをCSSのグラデーションとトランスレーションで再現してみました。<br />
<a href="http://uda2.com/github/barbersignpole.html" target="_blank">4本のサインポールの動きサンプル</a><br />
<span id="more-1882"></span><br />
仕組みは正方形のオブジェクトを入れ、それにCSSのlinear-gradientで斜めのストライプを作って、それをtransformでアニメーションしています。</p>
<p>今回はjQueryプラグイン化し、久々にGithubにアップしました。<br />
<a href="https://github.com/uda2/barbersignpole" target="_blank">uda2/barbersignpole</a><br />
グラデーションの模様は好きなデザインに指定できます。値は色とパーセントです。<br />
方向はvectに数値を入力することで設定します。テンキーを基準に7が左上、9が右上、3が右下、1が左下になります。<br />
speedは一連のアニメーションの時間（秒）です。</p>
<p>まず、グラデーションですが普通に色を並べるとストライプにならないので色を指定すると次の色を0.005％後に指定する事でグラデーションを抑止しストライプにしています。<br />
アニメーションはCSSのグラデーションは背景画像なのでシンプルに背景画像位置（background-position）をいじっても再現できるのですが重いので、正方形のオブジェクトを追加してそれをtransformで移動しています。<br />
一見冗長に見えますがタスクマネージャー読みで3倍ぐらい高速になります。</p>
<p>※現時点のGoogleChromeは斜めのグラデーションが汚く細かい線が再現されないです。</p>The post <a href="https://uda2.com/blog/barbersignpole/">サインポール風アニメーションjQueryプラグイン</a> first appeared on <a href="https://uda2.com/blog">ウダ2Blog</a>.]]></content:encoded>
					
					<wfw:commentRss>https://uda2.com/blog/barbersignpole/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>HTML・CSSで刀で斬るようなアニメーション</title>
		<link>https://uda2.com/blog/zan/</link>
					<comments>https://uda2.com/blog/zan/#respond</comments>
		
		<dc:creator><![CDATA[uda2]]></dc:creator>
		<pubDate>Fri, 06 Feb 2015 14:59:41 +0000</pubDate>
				<category><![CDATA[制作日記]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[アニメーション]]></category>
		<guid isPermaLink="false">http://uda2.com/blog/?p=1616</guid>

					<description><![CDATA[<p>最近LIGのブログを見る機会が多くなった。LIGは面白法人カヤックやバーグハンバーグバーグの流れを汲んだキワモノ系の制作会社で、そのLIGのブログが技術系の記事が増えてきたので毎日読んでる。昨日も刀でズバッと斬るよ</p>
The post <a href="https://uda2.com/blog/zan/">HTML・CSSで刀で斬るようなアニメーション</a> first appeared on <a href="https://uda2.com/blog">ウダ2Blog</a>.]]></description>
										<content:encoded><![CDATA[<p>最近LIGのブログを見る機会が多くなった。LIGは<a href="http://www.kayac.com/" target="_blank">面白法人カヤック</a>や<a href="http://bhb.co.jp/" target="_blank">バーグハンバーグバーグ</a>の流れを汲んだキワモノ系の制作会社で、そのLIGのブログが技術系の記事が増えてきたので毎日読んでる。昨日も<a href="http://liginc.co.jp/web/html-css/143360" target="_blank">刀でズバッと斬るようなアニメーションをHTML・CSS・JS（jQuery）で実装する方法 | 株式会社LIG</a>を読んで「さすがLIG、このタイミングで首をはねるアニメーションを作るとは・・・」とも思ったが俺も作ってみた。<br />
<span id="more-1616"></span><br />
まずLIG版はPhotoShopで加工して3枚の画像を作ってたが、こっちは<strong>clip-path</strong>（CSS）を使って切り抜くことにした（clip-pathはIEが未対応なので実務的には使う機会が少ない）、clip-pathを使ってブラウザ上で切り抜いてるのでどっからでも引っ張ってこれる。画像は倫理的な問題からamazonのリンゴ画像にした。<br />
ちなみにLIG版はアニメーション終わりのイベント取得にwebkitAnimationEndしか使って無いためwebkit系でしか動かないけど「animationend webkitAnimationEnd oAnimationEnd」な感じで入れたらFirefoxや旧operaでも動くようになる。</p>
<p>clip-pathは先月の<a href="http://coliss.com/articles/build-websites/operation/css/css-clip-path-clippy.html" target="_blank">工夫のあるUIがいい！CSSで円・楕円・多角形などのクリップパスが簡単に作成できるオンラインサービス -Clippy | コリス</a>で知ってから気にはなっていたが、firefoxが動かなかったので、まだまだ未来の技術だと思ってスルーしていたが、今回改めて調べるとclip-pathで指定するクリップパスはwebkit用の「CSSの直書き」とfirefox用の「SVG内部参照」「SVG外部参照」の3パターンの設定方法があるが、<a href="http://bennettfeely.com/clippy/" target="_blank">Clippy</a>がwebkitにしか対応していないだけで、自前でSVGを用意してやると切り抜ける事が分った。（それでもIEは未対応だが）<br />
LIGの人も書いてるが斜めに切り取った画像を並べると微妙に隙間が空く。そこで、あえて隙間を空けて斬る前のシーンの為に後ろに切り取ってない画像を用意した。その画像をずらして斬った風な感じを出してる。</p>
<p>LIG版は上下が切り離されてる感じになってたが、板を切った様に上部が崩れ落ちる風のアニメーションにした。<br />
あと、LIG版はjQueryでアニメーションの開始終了を制御してるが、ごてごてするのでanimationのディレイで誤魔化した。</p>
<p>CSS</p>
<pre><code>@keyframes slashSord {
  0%   {transform: translate3d(0,0,0);}
  100% {transform: translate3d(-640px,0,0);}
}

@keyframes slashUp{
  0%   {transform: translate3d(0,0,0) rotate(0deg);}
  70%  {transform: translate3d(-32px,24px,0) rotate(0deg);}
  75%  {transform: translate3d(-32px,24px,0) rotate(0deg);}
  100% {transform: translate3d(64px,540px,0) rotate(-80deg);}
}
@-webkit-keyframes slashSord {
  0%   {-webkit-transform: translate3d(0,0,0);}
  100% {-webkit-transform: translate3d(-640px,0,0);}
}

@-webkit-keyframes slashUp{
  0%   {-webkit-transform: translate3d(0,0,0) rotate(0deg);}
  70%  {-webkit-transform: translate3d(-32px,24px,0) rotate(0deg);}
  75%  {-webkit-transform: translate3d(-32px,24px,0) rotate(0deg);}
  100% {-webkit-transform: translate3d(64px,540px,0) rotate(-80deg);}
}

.zan img {
  position:absolute;
  top:0;
  left:0;
}
.zan img.ue {
  -webkit-clip-path: polygon(0 479px,639px 0,0 0);
  clip-path: url("#clipPolygon7");
  -webkit-animation: slashUp 3.5s ease 2s both;
  animation: slashUp 3.5s ease 2s both;
}
.zan img.all {
  -webkit-animation: slashSord 0.25s ease 1.5s both;
  animation: slashSord 0.25s ease 1.5s both;
}
.zan img.shita {
  -webkit-clip-path: polygon(0 480px,640px 0,640px 480px);
  clip-path: url("#clipPolygon3");
}

.zan {
  position:relative;
  margin:90px auto;
  width:640px;
  height:480px;
  overflow:hidden;
}</code></pre>
<p>HTML</p>
<pre><code>&lt;div class=&quot;zan&quot;&gt;&lt;a href=&quot;http://www.amazon.co.jp/exec/obidos/ASIN/B00SWFGK1I/ref=nosim&quot; target=&quot;_blank&quot;&gt;
&lt;img src=&quot;http://ecx.images-amazon.com/images/I/81kVL7QeoxL._SL1500_SR640,480_.jpg&quot; alt=&quot;&quot; class=&quot;all&quot; /&gt;
&lt;img src=&quot;http://ecx.images-amazon.com/images/I/81kVL7QeoxL._SL1500_SR640,480_.jpg&quot; alt=&quot;&quot; class=&quot;ue&quot; /&gt;
&lt;img src=&quot;http://ecx.images-amazon.com/images/I/81kVL7QeoxL._SL1500_SR640,480_.jpg&quot; alt=&quot;リンゴ&quot; class=&quot;shita&quot; /&gt;
&lt;/a&gt;&lt;/div&gt;
&lt;svg width=&quot;0&quot; height=&quot;0&quot;&gt;
&lt;clipPath id=&quot;clipPolygon7&quot;&gt;
&lt;polygon points=&quot;0 479,639 0,0 0&quot;&gt;&lt;/polygon&gt;
&lt;/clipPath&gt;
&lt;clipPath id=&quot;clipPolygon3&quot;&gt;
&lt;polygon points=&quot;0 480,640 0,640 480&quot;&gt;&lt;/polygon&gt;
&lt;/clipPath&gt;
&lt;/svg&gt;</code></pre>
<p>できたアニメーションが「<a href="/zan.html" target="_blank">リンゴを斬る！</a>」</p>The post <a href="https://uda2.com/blog/zan/">HTML・CSSで刀で斬るようなアニメーション</a> first appeared on <a href="https://uda2.com/blog">ウダ2Blog</a>.]]></content:encoded>
					
					<wfw:commentRss>https://uda2.com/blog/zan/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>CSSだけで角をカット</title>
		<link>https://uda2.com/blog/ccc/</link>
					<comments>https://uda2.com/blog/ccc/#respond</comments>
		
		<dc:creator><![CDATA[uda2]]></dc:creator>
		<pubDate>Sat, 04 Feb 2012 08:49:26 +0000</pubDate>
				<category><![CDATA[制作日記]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[css3]]></category>
		<guid isPermaLink="false">http://uda2.com/blog/?p=1232</guid>

					<description><![CDATA[<p>画像を使わずCSSだけで角が欠けた表現をする方法がBeveled corners &#38; negative border-radius with CSS3 gradients &#124; Lea Verouに書かれていた。角</p>
The post <a href="https://uda2.com/blog/ccc/">CSSだけで角をカット</a> first appeared on <a href="https://uda2.com/blog">ウダ2Blog</a>.]]></description>
										<content:encoded><![CDATA[<p><img fetchpriority="high" decoding="async" src="http://uda2.com/blog/wp-content/uploads/css3cornercutter_s.jpg" alt="" title="css3cornercutter_s" width="450" height="271" class="alignnone size-full wp-image-1233" srcset="https://uda2.com/blog/wp-content/uploads/css3cornercutter_s.jpg 450w, https://uda2.com/blog/wp-content/uploads/css3cornercutter_s-300x180.jpg 300w" sizes="(max-width: 450px) 100vw, 450px" /><br />
画像を使わずCSSだけで角が欠けた表現をする方法が<a href="http://lea.verou.me/2011/03/beveled-corners-negative-border-radius-with-css3-gradients/" target="_blank">Beveled corners &amp; negative border-radius with CSS3 gradients | Lea Verou</a>に書かれていた。角丸の表現も飽きてきてたので新鮮だったが、CSSの量が多く（ベンタープレフィックスの為だけど・・・）面倒なのでジェネレーターを作ってみた。<br />
「<a href="http://uda2.com/css3cornercutter/" target="_blank">Css3 Corner Cutter</a>」</p>
<p>この角が欠けた表現をする仕組みは背景を4分割してそれぞれの角に透明から急に色が付くグラデーションを塗って角が欠けた表現をしているので、背景もうまく透過している。<br />
ただ、元のCSSだときれいに4等分（縦横50％）しすぎで要素の幅や高さが奇数の場合に隙間があいてしまっていたので、ジェネレーターでは縦横51％にして少しかぶせて隙間が現れ無いようにしています。</p>The post <a href="https://uda2.com/blog/ccc/">CSSだけで角をカット</a> first appeared on <a href="https://uda2.com/blog">ウダ2Blog</a>.]]></content:encoded>
					
					<wfw:commentRss>https://uda2.com/blog/ccc/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
