/* CSS のプロパティ:animationの定義 */ .shine{ animation: letter-shine 1s ; } /* CSS で点滅効果の作成 */ @keyframes letter-shine{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
/* 一秒ごとでタイマー(shine)の点滅cssを動的に追加 */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s"); }, 1000 );
/* animationの値(infinite)でタイマーを点滅させる */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s infinite"); }, 1000 );
// JSのロジック count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").removeAttr("style"); if( count%2 ==0 ){ $(".shine").css("animation","letter-shine-even 1s"); } else { $(".shine").css("animation","letter-shine-odd 1s"); } }, 1000 ); /* cssのanimationの値:@keyframes */ @keyframes letter-shine-even{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } } @keyframes letter-shine-odd{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
<div class="item"> <div class="timer-time">10</div> <svg width="160" height="160" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg> </div>
<svg width="80" height="80" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg>
/* タイマーの表示場所指定 */ .item { position: relative; float: left; } /* 残量時間を円の中心に合わせ */ .timer-time { text-align:center; position: absolute; line-height: 4em; width: 100%; font-size:2.5em; } /* 真上から円を描く指定 */ svg { -webkit-transform: rotate(-90deg); transform: rotate(-90deg); } /* 円を描く動画の準備 */ .timer-circle { stroke-dasharray: 280; stroke-dashoffset: 280; transition: all 1s linear; }
var time = 10; var initialOffset = '280'; var i = 1 var interval = setInterval(function() { $('.timer-circle').css('stroke-dashoffset', initialOffset-(i*(initialOffset/time))); $('.timer-time').text(10-i); if (i == time) { clearInterval(interval); } // 連続の場合: i=1; i++; }, 1000);
/* CSS のプロパティ:animationの定義 */ .shine{ animation: letter-shine 1s ; } /* CSS で点滅効果の作成 */ @keyframes letter-shine{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
/* 一秒ごとでタイマー(shine)の点滅cssを動的に追加 */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s"); }, 1000 );
/* animationの値(infinite)でタイマーを点滅させる */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s infinite"); }, 1000 );
// JSのロジック count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").removeAttr("style"); if( count%2 ==0 ){ $(".shine").css("animation","letter-shine-even 1s"); } else { $(".shine").css("animation","letter-shine-odd 1s"); } }, 1000 ); /* cssのanimationの値:@keyframes */ @keyframes letter-shine-even{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } } @keyframes letter-shine-odd{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
<div class="item"> <div class="timer-time">10</div> <svg width="160" height="160" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg> </div>
<svg width="80" height="80" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg>
/* タイマーの表示場所指定 */ .item { position: relative; float: left; } /* 残量時間を円の中心に合わせ */ .timer-time { text-align:center; position: absolute; line-height: 4em; width: 100%; font-size:2.5em; } /* 真上から円を描く指定 */ svg { -webkit-transform: rotate(-90deg); transform: rotate(-90deg); } /* 円を描く動画の準備 */ .timer-circle { stroke-dasharray: 280; stroke-dashoffset: 280; transition: all 1s linear; }
var time = 10; var initialOffset = '280'; var i = 1 var interval = setInterval(function() { $('.timer-circle').css('stroke-dashoffset', initialOffset-(i*(initialOffset/time))); $('.timer-time').text(10-i); if (i == time) { clearInterval(interval); } // 連続の場合: i=1; i++; }, 1000);
/* CSS のプロパティ:animationの定義 */ .shine{ animation: letter-shine 1s ; } /* CSS で点滅効果の作成 */ @keyframes letter-shine{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
/* 一秒ごとでタイマー(shine)の点滅cssを動的に追加 */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s"); }, 1000 );
/* animationの値(infinite)でタイマーを点滅させる */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s infinite"); }, 1000 );
// JSのロジック count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").removeAttr("style"); if( count%2 ==0 ){ $(".shine").css("animation","letter-shine-even 1s"); } else { $(".shine").css("animation","letter-shine-odd 1s"); } }, 1000 ); /* cssのanimationの値:@keyframes */ @keyframes letter-shine-even{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } } @keyframes letter-shine-odd{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
<div class="item"> <div class="timer-time">10</div> <svg width="160" height="160" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg> </div>
<svg width="80" height="80" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg>
/* タイマーの表示場所指定 */ .item { position: relative; float: left; } /* 残量時間を円の中心に合わせ */ .timer-time { text-align:center; position: absolute; line-height: 4em; width: 100%; font-size:2.5em; } /* 真上から円を描く指定 */ svg { -webkit-transform: rotate(-90deg); transform: rotate(-90deg); } /* 円を描く動画の準備 */ .timer-circle { stroke-dasharray: 280; stroke-dashoffset: 280; transition: all 1s linear; }
var time = 10; var initialOffset = '280'; var i = 1 var interval = setInterval(function() { $('.timer-circle').css('stroke-dashoffset', initialOffset-(i*(initialOffset/time))); $('.timer-time').text(10-i); if (i == time) { clearInterval(interval); } // 連続の場合: i=1; i++; }, 1000);
/* CSS のプロパティ:animationの定義 */ .shine{ animation: letter-shine 1s ; } /* CSS で点滅効果の作成 */ @keyframes letter-shine{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
/* 一秒ごとでタイマー(shine)の点滅cssを動的に追加 */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s"); }, 1000 );
/* animationの値(infinite)でタイマーを点滅させる */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s infinite"); }, 1000 );
// JSのロジック count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").removeAttr("style"); if( count%2 ==0 ){ $(".shine").css("animation","letter-shine-even 1s"); } else { $(".shine").css("animation","letter-shine-odd 1s"); } }, 1000 ); /* cssのanimationの値:@keyframes */ @keyframes letter-shine-even{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } } @keyframes letter-shine-odd{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
<div class="item"> <div class="timer-time">10</div> <svg width="160" height="160" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg> </div>
<svg width="80" height="80" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg>
/* タイマーの表示場所指定 */ .item { position: relative; float: left; } /* 残量時間を円の中心に合わせ */ .timer-time { text-align:center; position: absolute; line-height: 4em; width: 100%; font-size:2.5em; } /* 真上から円を描く指定 */ svg { -webkit-transform: rotate(-90deg); transform: rotate(-90deg); } /* 円を描く動画の準備 */ .timer-circle { stroke-dasharray: 280; stroke-dashoffset: 280; transition: all 1s linear; }
var time = 10; var initialOffset = '280'; var i = 1 var interval = setInterval(function() { $('.timer-circle').css('stroke-dashoffset', initialOffset-(i*(initialOffset/time))); $('.timer-time').text(10-i); if (i == time) { clearInterval(interval); } // 連続の場合: i=1; i++; }, 1000);
/* CSS のプロパティ:animationの定義 */ .shine{ animation: letter-shine 1s ; } /* CSS で点滅効果の作成 */ @keyframes letter-shine{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
/* 一秒ごとでタイマー(shine)の点滅cssを動的に追加 */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s"); }, 1000 );
/* animationの値(infinite)でタイマーを点滅させる */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s infinite"); }, 1000 );
// JSのロジック count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").removeAttr("style"); if( count%2 ==0 ){ $(".shine").css("animation","letter-shine-even 1s"); } else { $(".shine").css("animation","letter-shine-odd 1s"); } }, 1000 ); /* cssのanimationの値:@keyframes */ @keyframes letter-shine-even{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } } @keyframes letter-shine-odd{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
<div class="item"> <div class="timer-time">10</div> <svg width="160" height="160" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg> </div>
<svg width="80" height="80" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg>
/* タイマーの表示場所指定 */ .item { position: relative; float: left; } /* 残量時間を円の中心に合わせ */ .timer-time { text-align:center; position: absolute; line-height: 4em; width: 100%; font-size:2.5em; } /* 真上から円を描く指定 */ svg { -webkit-transform: rotate(-90deg); transform: rotate(-90deg); } /* 円を描く動画の準備 */ .timer-circle { stroke-dasharray: 280; stroke-dashoffset: 280; transition: all 1s linear; }
var time = 10; var initialOffset = '280'; var i = 1 var interval = setInterval(function() { $('.timer-circle').css('stroke-dashoffset', initialOffset-(i*(initialOffset/time))); $('.timer-time').text(10-i); if (i == time) { clearInterval(interval); } // 連続の場合: i=1; i++; }, 1000);
/* CSS のプロパティ:animationの定義 */ .shine{ animation: letter-shine 1s ; } /* CSS で点滅効果の作成 */ @keyframes letter-shine{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
/* 一秒ごとでタイマー(shine)の点滅cssを動的に追加 */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s"); }, 1000 );
/* animationの値(infinite)でタイマーを点滅させる */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s infinite"); }, 1000 );
// JSのロジック count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").removeAttr("style"); if( count%2 ==0 ){ $(".shine").css("animation","letter-shine-even 1s"); } else { $(".shine").css("animation","letter-shine-odd 1s"); } }, 1000 ); /* cssのanimationの値:@keyframes */ @keyframes letter-shine-even{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } } @keyframes letter-shine-odd{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
<div class="item"> <div class="timer-time">10</div> <svg width="160" height="160" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg> </div>
<svg width="80" height="80" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg>
/* タイマーの表示場所指定 */ .item { position: relative; float: left; } /* 残量時間を円の中心に合わせ */ .timer-time { text-align:center; position: absolute; line-height: 4em; width: 100%; font-size:2.5em; } /* 真上から円を描く指定 */ svg { -webkit-transform: rotate(-90deg); transform: rotate(-90deg); } /* 円を描く動画の準備 */ .timer-circle { stroke-dasharray: 280; stroke-dashoffset: 280; transition: all 1s linear; }
var time = 10; var initialOffset = '280'; var i = 1 var interval = setInterval(function() { $('.timer-circle').css('stroke-dashoffset', initialOffset-(i*(initialOffset/time))); $('.timer-time').text(10-i); if (i == time) { clearInterval(interval); } // 連続の場合: i=1; i++; }, 1000);
/* CSS のプロパティ:animationの定義 */ .shine{ animation: letter-shine 1s ; } /* CSS で点滅効果の作成 */ @keyframes letter-shine{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
/* 一秒ごとでタイマー(shine)の点滅cssを動的に追加 */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s"); }, 1000 );
/* animationの値(infinite)でタイマーを点滅させる */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s infinite"); }, 1000 );
// JSのロジック count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").removeAttr("style"); if( count%2 ==0 ){ $(".shine").css("animation","letter-shine-even 1s"); } else { $(".shine").css("animation","letter-shine-odd 1s"); } }, 1000 ); /* cssのanimationの値:@keyframes */ @keyframes letter-shine-even{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } } @keyframes letter-shine-odd{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
<div class="item"> <div class="timer-time">10</div> <svg width="160" height="160" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg> </div>
<svg width="80" height="80" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg>
/* タイマーの表示場所指定 */ .item { position: relative; float: left; } /* 残量時間を円の中心に合わせ */ .timer-time { text-align:center; position: absolute; line-height: 4em; width: 100%; font-size:2.5em; } /* 真上から円を描く指定 */ svg { -webkit-transform: rotate(-90deg); transform: rotate(-90deg); } /* 円を描く動画の準備 */ .timer-circle { stroke-dasharray: 280; stroke-dashoffset: 280; transition: all 1s linear; }
var time = 10; var initialOffset = '280'; var i = 1 var interval = setInterval(function() { $('.timer-circle').css('stroke-dashoffset', initialOffset-(i*(initialOffset/time))); $('.timer-time').text(10-i); if (i == time) { clearInterval(interval); } // 連続の場合: i=1; i++; }, 1000);
/* CSS のプロパティ:animationの定義 */ .shine{ animation: letter-shine 1s ; } /* CSS で点滅効果の作成 */ @keyframes letter-shine{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
/* 一秒ごとでタイマー(shine)の点滅cssを動的に追加 */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s"); }, 1000 );
/* animationの値(infinite)でタイマーを点滅させる */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s infinite"); }, 1000 );
// JSのロジック count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").removeAttr("style"); if( count%2 ==0 ){ $(".shine").css("animation","letter-shine-even 1s"); } else { $(".shine").css("animation","letter-shine-odd 1s"); } }, 1000 ); /* cssのanimationの値:@keyframes */ @keyframes letter-shine-even{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } } @keyframes letter-shine-odd{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
<div class="item"> <div class="timer-time">10</div> <svg width="160" height="160" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg> </div>
<svg width="80" height="80" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg>
/* タイマーの表示場所指定 */ .item { position: relative; float: left; } /* 残量時間を円の中心に合わせ */ .timer-time { text-align:center; position: absolute; line-height: 4em; width: 100%; font-size:2.5em; } /* 真上から円を描く指定 */ svg { -webkit-transform: rotate(-90deg); transform: rotate(-90deg); } /* 円を描く動画の準備 */ .timer-circle { stroke-dasharray: 280; stroke-dashoffset: 280; transition: all 1s linear; }
var time = 10; var initialOffset = '280'; var i = 1 var interval = setInterval(function() { $('.timer-circle').css('stroke-dashoffset', initialOffset-(i*(initialOffset/time))); $('.timer-time').text(10-i); if (i == time) { clearInterval(interval); } // 連続の場合: i=1; i++; }, 1000);
/* CSS のプロパティ:animationの定義 */ .shine{ animation: letter-shine 1s ; } /* CSS で点滅効果の作成 */ @keyframes letter-shine{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
/* 一秒ごとでタイマー(shine)の点滅cssを動的に追加 */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s"); }, 1000 );
/* animationの値(infinite)でタイマーを点滅させる */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s infinite"); }, 1000 );
// JSのロジック count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").removeAttr("style"); if( count%2 ==0 ){ $(".shine").css("animation","letter-shine-even 1s"); } else { $(".shine").css("animation","letter-shine-odd 1s"); } }, 1000 ); /* cssのanimationの値:@keyframes */ @keyframes letter-shine-even{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } } @keyframes letter-shine-odd{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
<div class="item"> <div class="timer-time">10</div> <svg width="160" height="160" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg> </div>
<svg width="80" height="80" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg>
/* タイマーの表示場所指定 */ .item { position: relative; float: left; } /* 残量時間を円の中心に合わせ */ .timer-time { text-align:center; position: absolute; line-height: 4em; width: 100%; font-size:2.5em; } /* 真上から円を描く指定 */ svg { -webkit-transform: rotate(-90deg); transform: rotate(-90deg); } /* 円を描く動画の準備 */ .timer-circle { stroke-dasharray: 280; stroke-dashoffset: 280; transition: all 1s linear; }
var time = 10; var initialOffset = '280'; var i = 1 var interval = setInterval(function() { $('.timer-circle').css('stroke-dashoffset', initialOffset-(i*(initialOffset/time))); $('.timer-time').text(10-i); if (i == time) { clearInterval(interval); } // 連続の場合: i=1; i++; }, 1000);
/* CSS のプロパティ:animationの定義 */ .shine{ animation: letter-shine 1s ; } /* CSS で点滅効果の作成 */ @keyframes letter-shine{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
/* 一秒ごとでタイマー(shine)の点滅cssを動的に追加 */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s"); }, 1000 );
/* animationの値(infinite)でタイマーを点滅させる */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s infinite"); }, 1000 );
// JSのロジック count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").removeAttr("style"); if( count%2 ==0 ){ $(".shine").css("animation","letter-shine-even 1s"); } else { $(".shine").css("animation","letter-shine-odd 1s"); } }, 1000 ); /* cssのanimationの値:@keyframes */ @keyframes letter-shine-even{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } } @keyframes letter-shine-odd{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
<div class="item"> <div class="timer-time">10</div> <svg width="160" height="160" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg> </div>
<svg width="80" height="80" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg>
/* タイマーの表示場所指定 */ .item { position: relative; float: left; } /* 残量時間を円の中心に合わせ */ .timer-time { text-align:center; position: absolute; line-height: 4em; width: 100%; font-size:2.5em; } /* 真上から円を描く指定 */ svg { -webkit-transform: rotate(-90deg); transform: rotate(-90deg); } /* 円を描く動画の準備 */ .timer-circle { stroke-dasharray: 280; stroke-dashoffset: 280; transition: all 1s linear; }
var time = 10; var initialOffset = '280'; var i = 1 var interval = setInterval(function() { $('.timer-circle').css('stroke-dashoffset', initialOffset-(i*(initialOffset/time))); $('.timer-time').text(10-i); if (i == time) { clearInterval(interval); } // 連続の場合: i=1; i++; }, 1000);
/* CSS のプロパティ:animationの定義 */ .shine{ animation: letter-shine 1s ; } /* CSS で点滅効果の作成 */ @keyframes letter-shine{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
/* 一秒ごとでタイマー(shine)の点滅cssを動的に追加 */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s"); }, 1000 );
/* animationの値(infinite)でタイマーを点滅させる */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s infinite"); }, 1000 );
// JSのロジック count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").removeAttr("style"); if( count%2 ==0 ){ $(".shine").css("animation","letter-shine-even 1s"); } else { $(".shine").css("animation","letter-shine-odd 1s"); } }, 1000 ); /* cssのanimationの値:@keyframes */ @keyframes letter-shine-even{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } } @keyframes letter-shine-odd{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
<div class="item"> <div class="timer-time">10</div> <svg width="160" height="160" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg> </div>
<svg width="80" height="80" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg>
/* タイマーの表示場所指定 */ .item { position: relative; float: left; } /* 残量時間を円の中心に合わせ */ .timer-time { text-align:center; position: absolute; line-height: 4em; width: 100%; font-size:2.5em; } /* 真上から円を描く指定 */ svg { -webkit-transform: rotate(-90deg); transform: rotate(-90deg); } /* 円を描く動画の準備 */ .timer-circle { stroke-dasharray: 280; stroke-dashoffset: 280; transition: all 1s linear; }
var time = 10; var initialOffset = '280'; var i = 1 var interval = setInterval(function() { $('.timer-circle').css('stroke-dashoffset', initialOffset-(i*(initialOffset/time))); $('.timer-time').text(10-i); if (i == time) { clearInterval(interval); } // 連続の場合: i=1; i++; }, 1000);
/* CSS のプロパティ:animationの定義 */ .shine{ animation: letter-shine 1s ; } /* CSS で点滅効果の作成 */ @keyframes letter-shine{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
/* 一秒ごとでタイマー(shine)の点滅cssを動的に追加 */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s"); }, 1000 );
/* animationの値(infinite)でタイマーを点滅させる */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s infinite"); }, 1000 );
// JSのロジック count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").removeAttr("style"); if( count%2 ==0 ){ $(".shine").css("animation","letter-shine-even 1s"); } else { $(".shine").css("animation","letter-shine-odd 1s"); } }, 1000 ); /* cssのanimationの値:@keyframes */ @keyframes letter-shine-even{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } } @keyframes letter-shine-odd{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
<div class="item"> <div class="timer-time">10</div> <svg width="160" height="160" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg> </div>
<svg width="80" height="80" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg>
/* タイマーの表示場所指定 */ .item { position: relative; float: left; } /* 残量時間を円の中心に合わせ */ .timer-time { text-align:center; position: absolute; line-height: 4em; width: 100%; font-size:2.5em; } /* 真上から円を描く指定 */ svg { -webkit-transform: rotate(-90deg); transform: rotate(-90deg); } /* 円を描く動画の準備 */ .timer-circle { stroke-dasharray: 280; stroke-dashoffset: 280; transition: all 1s linear; }
var time = 10; var initialOffset = '280'; var i = 1 var interval = setInterval(function() { $('.timer-circle').css('stroke-dashoffset', initialOffset-(i*(initialOffset/time))); $('.timer-time').text(10-i); if (i == time) { clearInterval(interval); } // 連続の場合: i=1; i++; }, 1000);
/* CSS のプロパティ:animationの定義 */ .shine{ animation: letter-shine 1s ; } /* CSS で点滅効果の作成 */ @keyframes letter-shine{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
/* 一秒ごとでタイマー(shine)の点滅cssを動的に追加 */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s"); }, 1000 );
/* animationの値(infinite)でタイマーを点滅させる */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s infinite"); }, 1000 );
// JSのロジック count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").removeAttr("style"); if( count%2 ==0 ){ $(".shine").css("animation","letter-shine-even 1s"); } else { $(".shine").css("animation","letter-shine-odd 1s"); } }, 1000 ); /* cssのanimationの値:@keyframes */ @keyframes letter-shine-even{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } } @keyframes letter-shine-odd{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
<div class="item"> <div class="timer-time">10</div> <svg width="160" height="160" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg> </div>
<svg width="80" height="80" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg>
/* タイマーの表示場所指定 */ .item { position: relative; float: left; } /* 残量時間を円の中心に合わせ */ .timer-time { text-align:center; position: absolute; line-height: 4em; width: 100%; font-size:2.5em; } /* 真上から円を描く指定 */ svg { -webkit-transform: rotate(-90deg); transform: rotate(-90deg); } /* 円を描く動画の準備 */ .timer-circle { stroke-dasharray: 280; stroke-dashoffset: 280; transition: all 1s linear; }
var time = 10; var initialOffset = '280'; var i = 1 var interval = setInterval(function() { $('.timer-circle').css('stroke-dashoffset', initialOffset-(i*(initialOffset/time))); $('.timer-time').text(10-i); if (i == time) { clearInterval(interval); } // 連続の場合: i=1; i++; }, 1000);
/* CSS のプロパティ:animationの定義 */ .shine{ animation: letter-shine 1s ; } /* CSS で点滅効果の作成 */ @keyframes letter-shine{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
/* 一秒ごとでタイマー(shine)の点滅cssを動的に追加 */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s"); }, 1000 );
/* animationの値(infinite)でタイマーを点滅させる */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s infinite"); }, 1000 );
// JSのロジック count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").removeAttr("style"); if( count%2 ==0 ){ $(".shine").css("animation","letter-shine-even 1s"); } else { $(".shine").css("animation","letter-shine-odd 1s"); } }, 1000 ); /* cssのanimationの値:@keyframes */ @keyframes letter-shine-even{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } } @keyframes letter-shine-odd{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
<div class="item"> <div class="timer-time">10</div> <svg width="160" height="160" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg> </div>
<svg width="80" height="80" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg>
/* タイマーの表示場所指定 */ .item { position: relative; float: left; } /* 残量時間を円の中心に合わせ */ .timer-time { text-align:center; position: absolute; line-height: 4em; width: 100%; font-size:2.5em; } /* 真上から円を描く指定 */ svg { -webkit-transform: rotate(-90deg); transform: rotate(-90deg); } /* 円を描く動画の準備 */ .timer-circle { stroke-dasharray: 280; stroke-dashoffset: 280; transition: all 1s linear; }
var time = 10; var initialOffset = '280'; var i = 1 var interval = setInterval(function() { $('.timer-circle').css('stroke-dashoffset', initialOffset-(i*(initialOffset/time))); $('.timer-time').text(10-i); if (i == time) { clearInterval(interval); } // 連続の場合: i=1; i++; }, 1000);
/* CSS のプロパティ:animationの定義 */ .shine{ animation: letter-shine 1s ; } /* CSS で点滅効果の作成 */ @keyframes letter-shine{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
/* 一秒ごとでタイマー(shine)の点滅cssを動的に追加 */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s"); }, 1000 );
/* animationの値(infinite)でタイマーを点滅させる */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s infinite"); }, 1000 );
// JSのロジック count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").removeAttr("style"); if( count%2 ==0 ){ $(".shine").css("animation","letter-shine-even 1s"); } else { $(".shine").css("animation","letter-shine-odd 1s"); } }, 1000 ); /* cssのanimationの値:@keyframes */ @keyframes letter-shine-even{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } } @keyframes letter-shine-odd{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
<div class="item"> <div class="timer-time">10</div> <svg width="160" height="160" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg> </div>
<svg width="80" height="80" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg>
/* タイマーの表示場所指定 */ .item { position: relative; float: left; } /* 残量時間を円の中心に合わせ */ .timer-time { text-align:center; position: absolute; line-height: 4em; width: 100%; font-size:2.5em; } /* 真上から円を描く指定 */ svg { -webkit-transform: rotate(-90deg); transform: rotate(-90deg); } /* 円を描く動画の準備 */ .timer-circle { stroke-dasharray: 280; stroke-dashoffset: 280; transition: all 1s linear; }
var time = 10; var initialOffset = '280'; var i = 1 var interval = setInterval(function() { $('.timer-circle').css('stroke-dashoffset', initialOffset-(i*(initialOffset/time))); $('.timer-time').text(10-i); if (i == time) { clearInterval(interval); } // 連続の場合: i=1; i++; }, 1000);
/* CSS のプロパティ:animationの定義 */ .shine{ animation: letter-shine 1s ; } /* CSS で点滅効果の作成 */ @keyframes letter-shine{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
/* 一秒ごとでタイマー(shine)の点滅cssを動的に追加 */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s"); }, 1000 );
/* animationの値(infinite)でタイマーを点滅させる */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s infinite"); }, 1000 );
// JSのロジック count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").removeAttr("style"); if( count%2 ==0 ){ $(".shine").css("animation","letter-shine-even 1s"); } else { $(".shine").css("animation","letter-shine-odd 1s"); } }, 1000 ); /* cssのanimationの値:@keyframes */ @keyframes letter-shine-even{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } } @keyframes letter-shine-odd{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
<div class="item"> <div class="timer-time">10</div> <svg width="160" height="160" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg> </div>
<svg width="80" height="80" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg>
/* タイマーの表示場所指定 */ .item { position: relative; float: left; } /* 残量時間を円の中心に合わせ */ .timer-time { text-align:center; position: absolute; line-height: 4em; width: 100%; font-size:2.5em; } /* 真上から円を描く指定 */ svg { -webkit-transform: rotate(-90deg); transform: rotate(-90deg); } /* 円を描く動画の準備 */ .timer-circle { stroke-dasharray: 280; stroke-dashoffset: 280; transition: all 1s linear; }
var time = 10; var initialOffset = '280'; var i = 1 var interval = setInterval(function() { $('.timer-circle').css('stroke-dashoffset', initialOffset-(i*(initialOffset/time))); $('.timer-time').text(10-i); if (i == time) { clearInterval(interval); } // 連続の場合: i=1; i++; }, 1000);
/* CSS のプロパティ:animationの定義 */ .shine{ animation: letter-shine 1s ; } /* CSS で点滅効果の作成 */ @keyframes letter-shine{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
/* 一秒ごとでタイマー(shine)の点滅cssを動的に追加 */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s"); }, 1000 );
/* animationの値(infinite)でタイマーを点滅させる */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s infinite"); }, 1000 );
// JSのロジック count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").removeAttr("style"); if( count%2 ==0 ){ $(".shine").css("animation","letter-shine-even 1s"); } else { $(".shine").css("animation","letter-shine-odd 1s"); } }, 1000 ); /* cssのanimationの値:@keyframes */ @keyframes letter-shine-even{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } } @keyframes letter-shine-odd{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
<div class="item"> <div class="timer-time">10</div> <svg width="160" height="160" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg> </div>
<svg width="80" height="80" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg>
/* タイマーの表示場所指定 */ .item { position: relative; float: left; } /* 残量時間を円の中心に合わせ */ .timer-time { text-align:center; position: absolute; line-height: 4em; width: 100%; font-size:2.5em; } /* 真上から円を描く指定 */ svg { -webkit-transform: rotate(-90deg); transform: rotate(-90deg); } /* 円を描く動画の準備 */ .timer-circle { stroke-dasharray: 280; stroke-dashoffset: 280; transition: all 1s linear; }
var time = 10; var initialOffset = '280'; var i = 1 var interval = setInterval(function() { $('.timer-circle').css('stroke-dashoffset', initialOffset-(i*(initialOffset/time))); $('.timer-time').text(10-i); if (i == time) { clearInterval(interval); } // 連続の場合: i=1; i++; }, 1000);
/* CSS のプロパティ:animationの定義 */ .shine{ animation: letter-shine 1s ; } /* CSS で点滅効果の作成 */ @keyframes letter-shine{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
/* 一秒ごとでタイマー(shine)の点滅cssを動的に追加 */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s"); }, 1000 );
/* animationの値(infinite)でタイマーを点滅させる */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s infinite"); }, 1000 );
// JSのロジック count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").removeAttr("style"); if( count%2 ==0 ){ $(".shine").css("animation","letter-shine-even 1s"); } else { $(".shine").css("animation","letter-shine-odd 1s"); } }, 1000 ); /* cssのanimationの値:@keyframes */ @keyframes letter-shine-even{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } } @keyframes letter-shine-odd{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
<div class="item"> <div class="timer-time">10</div> <svg width="160" height="160" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg> </div>
<svg width="80" height="80" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg>
/* タイマーの表示場所指定 */ .item { position: relative; float: left; } /* 残量時間を円の中心に合わせ */ .timer-time { text-align:center; position: absolute; line-height: 4em; width: 100%; font-size:2.5em; } /* 真上から円を描く指定 */ svg { -webkit-transform: rotate(-90deg); transform: rotate(-90deg); } /* 円を描く動画の準備 */ .timer-circle { stroke-dasharray: 280; stroke-dashoffset: 280; transition: all 1s linear; }
var time = 10; var initialOffset = '280'; var i = 1 var interval = setInterval(function() { $('.timer-circle').css('stroke-dashoffset', initialOffset-(i*(initialOffset/time))); $('.timer-time').text(10-i); if (i == time) { clearInterval(interval); } // 連続の場合: i=1; i++; }, 1000);
/* CSS のプロパティ:animationの定義 */ .shine{ animation: letter-shine 1s ; } /* CSS で点滅効果の作成 */ @keyframes letter-shine{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
/* 一秒ごとでタイマー(shine)の点滅cssを動的に追加 */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s"); }, 1000 );
/* animationの値(infinite)でタイマーを点滅させる */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s infinite"); }, 1000 );
// JSのロジック count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").removeAttr("style"); if( count%2 ==0 ){ $(".shine").css("animation","letter-shine-even 1s"); } else { $(".shine").css("animation","letter-shine-odd 1s"); } }, 1000 ); /* cssのanimationの値:@keyframes */ @keyframes letter-shine-even{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } } @keyframes letter-shine-odd{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
<div class="item"> <div class="timer-time">10</div> <svg width="160" height="160" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg> </div>
<svg width="80" height="80" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg>
/* タイマーの表示場所指定 */ .item { position: relative; float: left; } /* 残量時間を円の中心に合わせ */ .timer-time { text-align:center; position: absolute; line-height: 4em; width: 100%; font-size:2.5em; } /* 真上から円を描く指定 */ svg { -webkit-transform: rotate(-90deg); transform: rotate(-90deg); } /* 円を描く動画の準備 */ .timer-circle { stroke-dasharray: 280; stroke-dashoffset: 280; transition: all 1s linear; }
var time = 10; var initialOffset = '280'; var i = 1 var interval = setInterval(function() { $('.timer-circle').css('stroke-dashoffset', initialOffset-(i*(initialOffset/time))); $('.timer-time').text(10-i); if (i == time) { clearInterval(interval); } // 連続の場合: i=1; i++; }, 1000);
/* CSS のプロパティ:animationの定義 */ .shine{ animation: letter-shine 1s ; } /* CSS で点滅効果の作成 */ @keyframes letter-shine{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
/* 一秒ごとでタイマー(shine)の点滅cssを動的に追加 */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s"); }, 1000 );
/* animationの値(infinite)でタイマーを点滅させる */ var count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").css("animation","lettle-shine-even 1s infinite"); }, 1000 );
// JSのロジック count=0; timer=setInterval(function(){ count ++ ; $(".shine").text(count); $(".shine").removeAttr("style"); if( count%2 ==0 ){ $(".shine").css("animation","letter-shine-even 1s"); } else { $(".shine").css("animation","letter-shine-odd 1s"); } }, 1000 ); /* cssのanimationの値:@keyframes */ @keyframes letter-shine-even{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } } @keyframes letter-shine-odd{ 0% { opacity: 0 ; } 50% { opacity: 1 ; transform: scale(1.1); } 100% { opacity: 0 ; } }
<div class="item"> <div class="timer-time">10</div> <svg width="160" height="160" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg> </div>
<svg width="80" height="80" xmlns="http://www.w3.org/2000/svg"> <g> <title>Pie Timer</title> <circle id="circle" class="timer-circle" r="40" cy="81" cx="81" stroke-width="8" stroke="#6fdb6f" fill="none"/> </g> </svg>
/* タイマーの表示場所指定 */ .item { position: relative; float: left; } /* 残量時間を円の中心に合わせ */ .timer-time { text-align:center; position: absolute; line-height: 4em; width: 100%; font-size:2.5em; } /* 真上から円を描く指定 */ svg { -webkit-transform: rotate(-90deg); transform: rotate(-90deg); } /* 円を描く動画の準備 */ .timer-circle { stroke-dasharray: 280; stroke-dashoffset: 280; transition: all 1s linear; }
var time = 10; var initialOffset = '280'; var i = 1 var interval = setInterval(function() { $('.timer-circle').css('stroke-dashoffset', initialOffset-(i*(initialOffset/time))); $('.timer-time').text(10-i); if (i == time) { clearInterval(interval); } // 連続の場合: i=1; i++; }, 1000);