Tuesday, 30 July 2013
Auto Flip Rotate For Blogger Post
-------------------------------------------------------------------------------------------
FIND AND REPLACE B SKIN TAG WITH BELOW CODE
]]></b:skin>
---------------------------------------------------------------------------------------------@-webkit-keyframes flip1 {
from { -webkit-transform: rotateY(0deg); }
to { -webkit-transform: rotateY(360deg); }
}
.flip1 {
padding: 5px 10px;
display: inline;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-webkit-animation-duration: 4s;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function:linear;
-webkit-backface-visibility: hidden;
padding: 20px;
position: absolute;
-webkit-animation-name: flip1;
}
]]></b:skin>
-------------------------------------------------------------------------------------------FIND AND REPLACE THIS LINE WITH BELOW CODE
http://fbgadgets.blogspot.co.uk/2017/02/js-image-scroller.html
http://fbgadgets.blogspot.co.uk/2017/02/auto-css-js-slider-with-arrow-bullet.html
JS IMAGE SCROLLER CODE
image scroller
https://amazingcarousel.com/
http://www.jqueryscript.net/css3-html5/ALS-Content-Scrolling-Plugin.html
http://www.jssor.com/
http://www.menucool.com/jquery-slider
image slider bootstrap
https://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_carousel&stacked=h
Presta Js Image Scroller
http://prestashopmodule.pounduk.com/
cssslider
http://accordionslider.com/
http://anroots.github.io/css3-image-collapse/
http://als.musings.it/#demo
http://www.alessioatzeni.com/CSS3-Cycle-Image-Slider/
http://benschwarz.github.io/gallery-css/
https://corpocrat.com/2015/12/09/20-cool-pure-css-sliders-without-jqueryjavascript/
http://codepen.io/Eliteware/full/BoBgqV/
https://codepen.io/joshnh/full/KwilB/
http://codepen.io/AMKohn/details/EKJHf
http://codepen.io/dudleystorey/full/kFoGw/
http://codepen.io/JFarrow/full/iAuto/
http://codepen.io/johnmotyljr/full/cDpEH/
http://codepen.io/drygiel/full/rtpnE/
http://codepen.io/rizky_k_r/full/shmwC/
https://codepen.io/johnlouie04/full/BqyGb/
http://codeconvey.com/Tutorials/cssSlider/
http://codepen.io/ClearDesign/full/KpQEyv
http://www.creativejuiz.fr/trytotry/juizy-slideshow-full-css3-html5/
http://csscience.com/responsiveslidercss3/
http://cssslider.com
http://dreyacosta.github.io/pure-responsive-css3-slider/
https://github.com/littleli/PureCssSlides
https://github.com/stephenscaff/keyframes-slider
http://lea.verou.me/2014/07/image-comparison-slider-with-pure-css/
http://tstachl.github.io/slidr.css/
http://thecodeplayer.com/walkthrough/css3-image-slider-with-stylized-thumbnails
https://www.youtube.com/watch?v=xVaW-e_eOPs
How to create Image Slider with HTML and CSS3
https://www.google.co.uk/search?q=How+to+create+Image+Slider+with+HTML+and+CSS3&rlz=1C1CHBD_en-GBGB722GB722&source=lnms&tbm=isch&sa=X&ved=0ahUKEwi_s_KCo5_SAhVkDMAKHZ1zBS8Q_AUICSgC&biw=1280&bih=670#imgrc=tYhPT2djaP30WM:
<b:includable id='post' var='post'></b:includable>
----------------------------------------------------------------------------------------------<b:includable id='post' var='post'>
<b:if cond='data:blog.pageType != "item"'>
<div class='post' id='post'>
<a expr:name='data:post.id'/>
<b:if cond='data:post.title'>
<h3 class='post-title entry-title'>
<b:if cond='data:post.link'>
<a expr:href='data:post.link'><data:post.title/></a>
<b:else/>
<b:if cond='data:post.url'>
<a expr:href='data:post.url'><data:post.title/></a>
<b:else/>
<data:post.title/>
</b:if>
</b:if>
</h3>
</b:if>
<div class='post-header-line-1'/>
<div class='post-body entry-content'>
<!-- Animation start Here-->
<div class='flip1'>
<a expr:href='data:post.url'/>
<div expr:id='"summary" + data:post.id'><data:post.body/></div>
</div>
<!-- Animation Finish Here-->
<b:if cond='data:blog.pageType != "item"'>
<script type='text/javascript'>/*<![CDATA[*/createSummaryAndThumb("summary<data:post.id/>");/*]]>*/</script>
</b:if>
<b:if cond='data:blog.pageType == "item"'><data:post.body/></b:if>
<div style='clear:both'/>
</div>
</div>
</b:if>
<b:if cond='data:blog.pageType == "item"'>
<div class='single' id='post'>
<a expr:name='data:post.id'/>
<b:if cond='data:post.title'>
<h3 class='post-title entry-title'>
<b:if cond='data:post.link'>
<a expr:href='data:post.link'><data:post.title/></a>
<b:else/>
<b:if cond='data:post.url'>
<a expr:href='data:post.url'><data:post.title/></a>
<b:else/>
<data:post.title/>
</b:if>
</b:if>
</h3>
</b:if>
<div class='post-body-2'>
<p><data:post.body/></p>
<div style='clear:both'/>
</div>
<div class='post-footer'>
<div class='post-footer-line post-footer-line-1'><span class='post-author vcard'>
<b:if cond='data:top.showAuthor'>
<data:top.authorLabel/>
<span class='fn'><data:post.author/></span>
</b:if>
</span> on <data:post.dateHeader/> <span class='post-timestamp'>
<b:if cond='data:top.showTimestamp'>
<data:top.timestampLabel/>
<b:if cond='data:post.url'>
<a class='timestamp-link' expr:href='data:post.url' rel='bookmark' title='permanent link'><abbr class='published' expr:title='data:post.timestampISO8601'><data:post.timestamp/></abbr></a>
</b:if>
</b:if>
</span> <span class='post-comment-link'>
<b:if cond='data:blog.pageType != "item"'>
<b:if cond='data:blog.pageType != "static_page"'>
<b:if cond='data:post.allowComments'>
<a class='comment-link' expr:href='data:post.addCommentUrl' expr:onclick='data:post.addCommentOnclick'><b:if cond='data:post.numComments == 1'>1 <data:top.commentLabel/><b:else/><data:post.numComments/> <data:top.commentLabelPlural/></b:if></a>
</b:if>
</b:if>
</b:if>
</span> <span class='post-icons'>
<b:if cond='data:post.emailPostUrl'>
<span class='item-action'>
<a expr:href='data:post.emailPostUrl' expr:title='data:top.emailPostMsg'>
<img alt='' class='icon-action' height='13' src='http://img1.blogblog.com/img/icon18_email.gif' width='18'/>
</a>
</span>
</b:if>
<b:include data='post' name='postQuickEdit'/>
</span> <div class='post-share-buttons'>
<b:include data='post' name='shareButtons'/>
</div> </div>
<div class='post-footer-line post-footer-line-2'><span class='post-labels'>
<b:if cond='data:post.labels'>
<data:postLabelsLabel/>
<b:loop values='data:post.labels' var='label'>
<a expr:href='data:label.url' rel='tag'><data:label.name/></a><b:if cond='data:label.isLast != "true"'>,</b:if>
</b:loop>
</b:if>
</span> </div>
</div>
</div>
</b:if>
</b:includable>
------------------------------------------------------------------------------------------------------------
OR USE THIS KEY FRAME SCROLLING SLIDER ANIMATION
------------------------------------------------------------------------------------------------------------
<html>
<head>
<meta charset=utf-8 />
<meta name="description" content="description">
<title>Design Shack Animated Photo Banner</title>
<style>
/*body and container*/
* {
margin: 0;
padding: 0;
}
body {
background: url('dark_geometric.png');
}
#container {
width: 1000px;
overflow: hidden;
margin: 50px auto;
background: white;
}
/*header*/
header {
width: 800px;
margin: 40px auto;
}
header h1 {
text-align: center;
font: 100 60px/1.5 Helvetica, Verdana, sans-serif;
}
header p {
font: 100 15px/1.5 Helvetica, Verdana, sans-serif;
text-align: justify;
}
/*photobanner*/
.photobanner {
height: 233px;
width: 3550px;
margin-bottom: 80px;
}
.photobanner img {
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
-ms-transition: all 0.5s ease;
transition: all 0.5s ease;
}
.photobanner img:hover {
-webkit-transform: scale(1.1);
-moz-transform: scale(1.1);
-o-transform: scale(1.1);
-ms-transform: scale(1.1);
transform: scale(1.1);
cursor: pointer;
-webkit-box-shadow: 0px 3px 5px rgba(0,0,0,0.2);
-moz-box-shadow: 0px 3px 5px rgba(0,0,0,0.2);
box-shadow: 0px 3px 5px rgba(0,0,0,0.2);
}
/*keyframe animations*/
.first {
-webkit-animation: bannermove 30s linear infinite;
-moz-animation: bannermove 30s linear infinite;
-ms-animation: bannermove 30s linear infinite;
animation: bannermove 30s linear infinite;
}
@keyframes "bannermove" {
0% {
margin-left: 0px;
}
100% {
margin-left: -2125px;
}
}
@-moz-keyframes bannermove {
0% {
margin-left: 0px;
}
100% {
margin-left: -2125px;
}
}
@-webkit-keyframes "bannermove" {
0% {
margin-left: 0px;
}
100% {
margin-left: -2125px;
}
}
@-ms-keyframes "bannermove" {
0% {
margin-left: 0px;
}
100% {
margin-left: -2125px;
}
}
@-o-keyframes "bannermove" {
0% {
margin-left: 0px;
}
100% {
margin-left: -2125px;
}
}
</style>
</head>
<body>
<div id="container">
<header>
<h1>Animated Photo Banner</h1>
<p>An animated banner of photos that automatically scrolls horizontally through an infinite loop. The best part: no JavaScript! It also uses individual images inserted via HTML, not simply one long repeating CSS background. <a href="http://designshack.net/articles/css/infinitephotobanner/">Click here</a> to return to the tutorial on Design Shack.</p>
</header>
<div class="photobanner">
<img class="first" src="http://designshack.net/tutorialexamples/photobanner/image-1.jpg" alt="" />
<img src="http://designshack.net/tutorialexamples/photobanner/image-2.jpg" alt="" />
<img src="http://designshack.net/tutorialexamples/photobanner/image-3.jpg" alt="" />
<img src="http://designshack.net/tutorialexamples/photobanner/image-4.jpg" alt="" />
<img src="http://designshack.net/tutorialexamples/photobanner/image-5.jpg" alt="" />
<img src="http://designshack.net/tutorialexamples/photobanner/image-6.jpg" alt="" />
<img src="http://designshack.net/tutorialexamples/photobanner/image-1.jpg" alt="" />
<img src="http://designshack.net/tutorialexamples/photobanner/image-2.jpg" alt="" />
<img src="http://designshack.net/tutorialexamples/photobanner/image-3.jpg" alt="" />
<img src="http://designshack.net/tutorialexamples/photobanner/image-4.jpg" alt="" />
</div>
</div>
</body>
</html>
------------------------------------------------------------------------------------------------------------
Jquery Animated Aquarium CSS
https://codepen.io/samarkandiy/pen/wzJRwv
-------------------------------------------------------------------------------------------------------------FISH ANIMATION CODE
-------------------------------------------------------------------------------------------------------------
<!DOCTYPE html>
<html class=''>
<head>
<script src='//production-assets.codepen.io/assets/editor/live/console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js'>
</script>
<script src='//production-assets.codepen.io/assets/editor/live/events_runner-73716630c22bbc8cff4bd0f07b135f00a0bdc5d14629260c3ec49e5606f98fdd.js'>
</script>
<script src='//production-assets.codepen.io/assets/editor/live/css_live_reload_init-2c0dc5167d60a5af3ee189d570b1835129687ea2a61bee3513dee3a50c115a77.js'></script>
<meta charset='UTF-8'><meta name="robots" content="noindex">
<link rel="shortcut icon" type="image/x-icon" href="//production-assets.codepen.io/assets/favicon/favicon-8ea04875e70c4b0bb41da869e81236e54394d63638a1ef12fa558a4a835f1164.ico" />
<link rel="mask-icon" type="" href="//production-assets.codepen.io/assets/favicon/logo-pin-f2d2b6d2c61838f7e76325261b7195c27224080bc099486ddd6dccb469b8e8e6.svg" color="#111" />
<link rel="canonical" href="https://codepen.io/samarkandiy/pen/wzJRwv" />
<style class="cp-pen-styles">body {);color:red;height:100%;overflow:hidden;}
.head {
position: fixed;
bottom: 0;
left: 0;
z-index: 99999;
}
body {
background: #151515;
}
header {
-o-transition-duration: 0.3s;
-moz-transition-duration: 0.3s;
-webkit-transition-duration: 0.3s;
transition-duration: 0.3s;
padding: 1px 0;
position: fixed;
top: 0;
width: 100%;
text-align: center;
text-shadow: 0px 0px #fff;
font-size: 6px;
background: -moz-linear-gradient(top,
#333 0%, rgba(53,02,01,1) 100%);
border-bottom: 3px solid #dad;
}
/* GRADIEND */
.ap {
position: fixed;
right: 0;
bottom: 0;
left: 0;
height: 30px;
margin: auto;
font-family: Arial, sans-serif;
font-size: 10px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
text-align: center;
text-shadow: 0px 0px #FFf;
font-size: 11px;
background: #111;
border-top: 2px solid #f0f;
z-index: 9999;
}
h2 {
padding: 15px;
background:
-webkit-linear-gradient(transparent 10%, goldenrod 50%, transparent 90%);
background: linear-gradient(transparent
10%, #666 50%, transparent 90%);
}
body {
background: #000;
overflow:hidden;
background: url('xx') no-repeat center
center fixed;
background-size:cover;
}
.container {
position:absolute;
left: 50%;
margin-left: -700px;
top: 50%;
margin-top: -300px;
height: 600px;
width: 1400px;
}
* {
margin: 0;
padding: 0;
}
#fishbitmap {
display: none;
}
body {
background:url(https://s-media-cache-ak0.pinimg.com/736x/19/7e/b3/197eb32f4289f5c5c7774da7461c6d5f.jpg)
no-repeat center center fixed ;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
} a {
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
}
@import
url(http://fonts.googleapis.com/css?family=Cherry+Swash);
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}table{border-collapse:collapse;border-spacing:0}
html,body {
height: 100%; overflow:hidden;
font-family: 'Cherry Swash', trebuchet ms, cursive;
}
/* start of fish animation */
.fish{
height: 230px;
left: 200px;
position: absolute;
top: 55%;
width: 290px;
z-index: 90;
left: 200px;
z-index: 100;
animation:swim 30s infinite linear;
/*firefox*/
-moz-animation:swim 30s infinite
linear;
/*webkit*/
-webkit-animation:swim 30s infinite
linear;
}
@keyframes swim{
from{
left:80%;
}
20%{
left:0;
transform:scaleX(1);
z-index:90;
}
20.5%{
transform:scaleX(-1);
z-index:10;
left:-30px;
}
21%{
left:80px;
}
42%{
left:60%;
}
50%{
z-index:28;
top:30%;
left:70%;
transform:scaleX(-1);
}
50.5%{
transform:scaleX(1);
z-index:100;
left:75%;
top:40%;
}
51%{
left:50%px;
z-index:150;
}
60%{
left:30%;
z-index:150;
}
64%{
left:20%;
z-index:150;
}
66%{
left:80px;
z-index:150;
}
69%{
left:-30px;
z-index:150;
}
70%{
top:15%;
left:-30px;
transform:scaleX(1);
z-index:90;
}
70.5%{
transform:scaleX(-1);
z-index:10;
left:-30px;
}
71%{
left:40px;
}
80%{
left:60%;
}
81%{
left:65%;
top:45%;
}
82%{
left:76%;
transform:scaleX(-1);
}
82.5%{
transform:scaleX(1);
top:45%;
left:77%;
}
84%{
top:50%;
left:70%;
z-index:28;
}
88%{
top:60%;
left:75%;
z-index:28;
}
to{
left:80%;
}
}
@-moz-keyframes swim{
from{
left:80%;
}
20%{
left:0;
transform:scaleX(1);
z-index:90;
}
20.5%{
transform:scaleX(-1);
z-index:10;
left:-30px;
}
21%{
left:80px;
}
42%{
left:60%;
}
50%{
z-index:28;
top:30%;
left:70%;
transform:scaleX(-1);
}
50.5%{
transform:scaleX(1);
z-index:100;
left:75%;
top:40%;
}
51%{
left:50%px;
z-index:150;
}
60%{
left:30%;
z-index:150;
}
64%{
left:20%;
z-index:150;
}
66%{
left:80px;
z-index:150;
}
69%{
left:-30px;
z-index:150;
}
70%{
top:15%;
left:-30px;
transform:scaleX(1);
z-index:90;
}
70.5%{
transform:scaleX(-1);
z-index:10;
left:-30px;
}
71%{
left:40px;
}
80%{
left:60%;
}
81%{
left:65%;
top:45%;
}
82%{
left:76%;
transform:scaleX(-1);
}
82.5%{
transform:scaleX(1);
top:45%;
left:77%;
}
84%{
top:50%;
left:70%;
z-index:28;
}
88%{
top:60%;
left:75%;
z-index:28;
}
to{
left:80%;
}
}
@-webkit-keyframes swim{
from{
left:80%;
}
20%{
left:0;
transform:scaleX(1);
z-index:90;
}
20.5%{
transform:scaleX(-1);
z-index:10;
left:-30px;
}
21%{
left:80px;
}
42%{
left:60%;
}
50%{
z-index:28;
top:30%;
left:70%;
transform:scaleX(-1);
}
50.5%{
transform:scaleX(1);
z-index:100;
left:75%;
top:40%;
}
51%{
left:50%px;
z-index:150;
}
60%{
left:30%;
z-index:150;
}
64%{
left:20%;
z-index:150;
}
66%{
left:80px;
z-index:150;
}
69%{
left:-30px;
z-index:150;
}
70%{
top:15%;
left:-30px;
transform:scaleX(1);
z-index:90;
}
70.5%{
transform:scaleX(-1);
z-index:10;
left:-30px;
}
71%{
left:40px;
}
80%{
left:60%;
}
81%{
left:65%;
top:45%;
}
82%{
left:76%;
transform:scaleX(-1);
}
82.5%{
transform:scaleX(1);
top:45%;
left:77%;
}
84%{
top:50%;
left:70%;
z-index:28;
}
88%{
top:60%;
left:75%;
z-index:28;
}
to{
left:80%;
}
}
.fish1{
height: 230px;
left: 200px;
position: absolute;
top: 65%;
width: 290px;
z-index: 90;
left: 200px;
z-index: 100;
animation:swim1 40s infinite linear;
/*firefox*/
-moz-animation:swim1 40s infinite
linear;
/*webkit*/
-webkit-animation:swim1 40s infinite
linear;
}
@keyframes swim1{
from{
left:75%;
}
20%{
left:0;
transform:scaleX(1);
z-index:90;
}
20.5%{
transform:scaleX(-1);
z-index:10;
left:-30px;
}
21%{
left:80px;
}
42%{
left:60%;
}
50%{
z-index:28;
top:75%;
left:75%;
transform:scaleX(-1);
}
50.5%{
transform:scaleX(1);
z-index:100;
left:75%;
top:60%;
}
51%{
left:50%;
z-index:150;
}
60%{
left:25%;
z-index:150;
}
64%{
left:20%;
z-index:150;
}
66%{
left:4%;
z-index:150;
}
69%{
left:-30px;
z-index:150;
}
70%{
top:35%;
left:-30px;
transform:scaleX(1);
z-index:90;
}
70.5%{
transform:scaleX(-1);
z-index:10;
left:-30px;
}
75%{
left:50%;
}
80%{
left:60%;
}
81%{
left:65%;
top:70%;
}
82%{
left:70%;
transform:scaleX(-1);
}
82.5%{
transform:scaleX(1);
top:72%;
left:68%;
}
84%{
top:65%;
left:70%;
z-index:28;
}
88%{
top:70%;
left:75%;
z-index:28;
}
to{
left:75%;
}
}
@-moz-keyframes swim1{
from{
left:75%;
}
20%{
left:0;
transform:scaleX(1);
z-index:90;
}
20.5%{
transform:scaleX(-1);
z-index:10;
left:-30px;
}
21%{
left:80px;
}
42%{
left:60%;
}
50%{
z-index:28;
top:75%;
left:75%;
transform:scaleX(-1);
}
50.5%{
transform:scaleX(1);
z-index:100;
left:75%;
top:60%;
}
51%{
left:50%;
z-index:150;
}
60%{
left:25%;
z-index:150;
}
64%{
left:20%;
z-index:150;
}
66%{
left:4%;
z-index:150;
}
69%{
left:-30px;
z-index:150;
}
70%{
top:35%;
left:-30px;
transform:scaleX(1);
z-index:90;
}
70.5%{
transform:scaleX(-1);
z-index:10;
left:-30px;
}
75%{
left:50%;
}
80%{
left:60%;
}
81%{
left:65%;
top:70%;
}
82%{
left:70%;
transform:scaleX(-1);
}
82.5%{
transform:scaleX(1);
top:72%;
left:68%;
}
84%{
top:65%;
left:70%;
z-index:28;
}
88%{
top:70%;
left:75%;
z-index:28;
}
to{
left:75%;
}
}
@-webkit-keyframes swim1{
from{
left:75%;
}
20%{
left:0;
transform:scaleX(1);
z-index:90;
}
20.5%{
transform:scaleX(-1);
z-index:10;
left:-30px;
}
21%{
left:80px;
}
42%{
left:60%;
}
50%{
z-index:28;
top:65%;
left:75%;
transform:scaleX(-1);
}
50.5%{
transform:scaleX(1);
z-index:100;
left:75%;
top:50%;
}
51%{
left:50%;
z-index:150;
}
60%{
left:25%;
z-index:150;
}
64%{
left:20%;
z-index:150;
}
66%{
left:4%;
z-index:150;
}
69%{
left:-30px;
z-index:150;
}
70%{
top:35%;
left:-30px;
transform:scaleX(1);
z-index:90;
}
70.5%{
transform:scaleX(-1);
z-index:10;
left:-30px;
}
75%{
left:50%;
}
80%{
left:60%;
}
81%{
left:65%;
top:60%;
}
82%{
left:70%;
transform:scaleX(-1);
}
82.5%{
transform:scaleX(1);
top:62%;
left:68%;
}
84%{
top:65%;
left:70%;
z-index:28;
}
88%{
top:60%;
left:75%;
z-index:28;
}
to{
left:75%;
}
}
header, #header {
background-color:#185C8A;background-color:rgba(99,
99, 99, 0.5);color:#fff;display:block;padding: 10px 0; width:100%;
font-size:1.2em;font-family: 'Cherry Swash', trebuchet ms, cursive
}
h1, p {text-align: center}
header h1 {text-align: center}header a,
a:visited {
text-decoration:none;color: #06C}
@keyframes greenPulse {
0% {box-shadow:0 0 30px #4bbec8}
50% {box-shadow:0 0 80px #4bbec8}
100% {box-shadow:0 0 30px #4bbec8}
}
div#beaker span.glow {
width:100%;
height:100%;background:##222;
position:relative;
display:block;
border-radius:200px;
animation:greenPulse 2s infinite;
-webkit-animation:greenPulse 2s
infinite;
-moz-animation:greenPulse 2s infinite;
-o-animation:greenPulse 2s infinite;
}
@keyframes bubbleUp {
0%
{bottom:110px;-webkit-transform:scale(.9);opacity:0}
1%
{bottom:110px;-webkit-transform:scale(.3);opacity:0}
30%
{bottom:110px;-webkit-transform:scale(.8);opacity:1}
95%
{bottom:545px;-webkit-transform:scale(.3);opacity:1}
99% {bottom:550px;-webkit-transform:scale(3);opacity:0}
100%
{bottom:110px;-webkit-transform:scale(.9);opacity:0}
}
div#beaker span.bubble {
background:#fff;
width:80px;
height:80px;
position:absolute;
display:block;
left:110px;
bottom:110px;
border-radius:100px;
background:-moz-radial-gradient(center
45deg, circle closest-corner, rgba(75,190,200,0), rgba(75,190,200,.1),
rgba(75,190,200,.3), rgba(255,255,255,.7));
background:-webkit-gradient(radial,
center center, 0, center center, 100, from(rgba(75,190,200,.2)),
to(rgba(255,255,255,.7)));
background:gradient(center 45deg,
circle closest-corner, rgba(75,190,200,0), rgba(75,190,200,.1),
rgba(75,190,200,.3), rgba(255,255,255,.7));
background: -ms-radial-gradient(center,
ellipse cover, rgba(255,255,255,0) 0%, rgba(9,133,167,0.1) 51%, rgba(9,133,167,0.3)
71%, rgba(9,133,167,.7) 100%);
animation:bubbleUp 4s infinite
ease-in-out;
-webkit-animation:bubbleUp 4s infinite
ease-in-out;
-o-animation:bubbleUp 4s infinite
ease-in-out;
-moz-animation:bubbleUp 4s infinite
ease-in-out;
}</style></head><body>
<body translate="no" >
<div class="head fish">
<img src="http://iconizer.net/files/Impressions/orig/diver.png" alt="" />
</div>
<div class="bubbles">
</div>
<div class="ground">
</div>
<div class="rock_1">
</div>
<div class="rock_2">
</div>
<div class="rock_3">
</div>
<div class="rock_4">
</div>
<div class="rock_5">
</div>
<div class="rock_6">
</div>
<div class="rock_7">
</div>
<div class="plant_1_wrap">
<div class="plant_1">
</div>
<div class="plant_2">
</div>
<div class="plant_3">
</div>
</div>
<div class="plant_2_wrap">
<div class="plant_4">
</div>
<div class="plant_5">
</div>
</div>
<div class="fish">
<img alt="Gold Fish-1" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4z2G_N4SgqbfXbFtIRM23foDCzWDLW6NaWZWDK5vfh3aIrFYLoSS6Q6dC90v0mEkf-5hfKeX6QU38gacHam5CHLzLUyjDME09DsB8_ZoIC_ig237DZ65YlGTDSAz-8tEA9tFVHcfoHzQ/s1600/ikan-mys2010.gif" /></div>
<div class="fish1">
<img alt="Gold Fish-2" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4z2G_N4SgqbfXbFtIRM23foDCzWDLW6NaWZWDK5vfh3aIrFYLoSS6Q6dC90v0mEkf-5hfKeX6QU38gacHam5CHLzLUyjDME09DsB8_ZoIC_ig237DZ65YlGTDSAz-8tEA9tFVHcfoHzQ/s1600/ikan-mys2010.gif" /></div>
<div style="position: fixed; bottom: 0px; height: 360px;
right: 150px; width: 1400px;">
<script language="javascript" src="http://yourjavascript.com/31571726261/ikan-dan-gelembung-mys2010s.js"></script></div>
<div style="position: fixed; bottom: 0px; height: 160px;
right: 150px; width: 1220px;">
<img alt=" " border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgind80HSXsnaCn8c21lb5NJCpcK0pruWDohEYnLaA0ejQKcBmc-Mr1xlyZc5F93NQVdllDBYexWB7lUTMASK_Hz68hl_6DoXBYGJ0j_WDtB3jkS_OeIxOujG23J_2I5aENxIU4qaae3N8/s1600/pohon-1-mys2010.png" title=" " /></div>
<div style="position: fixed; bottom: 0px; height:330px;
right: 30px; width: 1400px;">
<script language="javascript" src="https://sites.google.com/site/kodesite/svn/ballon-mys2010.js"></script></div>
</div>
<div style="position: fixed; bottom: 0px; height: 360px;
right: 150px; width: 1400px;">
<img alt=" " border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiY_jwPpWwqwf1pxE7Xe74ycarYVrLL6EtMCAlbkj4m5MbmX9DQQ0mVPtXwtVOUKIeQDsLcqncO15cawsk2hhIOAM51ryvxuyWIeLyDwXYmOa97UkqOiNdztZdj-JZLZxMbjRUppyPW7tE/s1600/pohon-2-mys2010.png" title=" " /></div>
<div style="position: fixed; bottom: 0px; height: 460px;
right: 20px; width: 1400px;">
<img alt=" " border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiY_jwPpWwqwf1pxE7Xe74ycarYVrLL6EtMCAlbkj4m5MbmX9DQQ0mVPtXwtVOUKIeQDsLcqncO15cawsk2hhIOAM51ryvxuyWIeLyDwXYmOa97UkqOiNdztZdj-JZLZxMbjRUppyPW7tE/s1600/pohon-2-mys2010.png" title=" " /></div>
<div style="position: fixed; bottom: 0px; height: 200px;
left:150px; width: 1720px;">
<img alt=" " border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGsIau2XO5o_dXqvrnHr3forSp6wd0iaejB34gmkZSZ1o4R0RLqu4QfGhqW_ZpZwGm2ud8ClzA4cMtZsPdk-_x7o9xYtMhs88vOo0o_QKaacZozn67qyNe02VZuOwU52LQ56B3H__UR_4f/s1600-r/bubbles-mys2010.gif" title=" " /></div>
<div style="bottom: 0px; height: 190px; right: 90px;
width: 120px;">
<img alt=" " border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiniJyOyIq6I-k6vPTfKMmeGzUfw2dvg27ZQ8Xo0pAp3pnscpoFCN6il9muUhSSF57lK6htNlN7eUoAjAYx-QzxFWG47Moq9IU12Cbe6FjacoeCd77JPxs0gfgHosFD00eIBt4ksPxNj6I/s1600/ikan2-mys2010.gif" title=" " /></div>
<div style="position: fixed; bottom: 0px; height: 290px;
right: 190px; width: 1220px;">
<img alt=" " border="0" src="http://img11.deviantart.net/22cc/i/2014/173/6/2/shrub_01_png___by_alz_stock-d7nc699.png" title=" " /></div>
<div style="position: fixed; 0px; height: 390px; width:
2000px;">
<img alt=" " border="0" src="http://img03.deviantart.net/227e/i/2012/363/1/b/tree_23_by_moonglowlilly-d5pjsbw.png" title=" " /></div>
<div style="position: fixed; bottom: 0px; height: 290px;
right: 150px; width: 1720px;">
<img alt=" " border="0" src="http://img11.deviantart.net/22cc/i/2014/173/6/2/shrub_01_png___by_alz_stock-d7nc699.png" title=" " /></div>
<div id="beaker">
<span class="bubble">
<img border="0" height="60" name="e902" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYPWgR1GNQQS_DJx2XkB9KwZXzwhcdcQsVQbIBe8HREu94n2sJMqvUbMcDYJuqqjpyqMiX27Rs6ZDndeb3ycIPcDZ0RqmByIlmWl4qu8DGSHzh6wQWIhXFtcV-4MlC8Fq89NY2dCvUDKc/s1600/ubur-mys2010.gif" width="100" /></span></div>
<div style="bottom: 120px; height: 190px; right: 800px;
width: 120px;">
<script language="javascript" src="http://yourjavascript.com/41562081021/ikan-dan-gelembung-mys2010.js"></script></div>
</div>
<div style="position: fixed; bottom: 0px; height: 190px;
left: 350px; width: 1720px;">
<img alt=" " border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzAbSAwCA10MWmZ_bp24Ras4aV1N-DVUYK1WvzNL2pCyKXA13BelJm8GQ2XZFTw_u1H4Clr-Ip-GO7pP1L3bCDvflUQ4jbwwINBxovdW9F9ulghroiCHa3xmgBMu_0UHvK4V6u7GPi-EQh/s1600-r/ikan2-mys2010.gif" title=" " /></div>
<div style="position: fixed; bottom: 0px; height: 190px;
left: 350px; width: 1720px;">
<img alt=" " border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGsIau2XO5o_dXqvrnHr3forSp6wd0iaejB34gmkZSZ1o4R0RLqu4QfGhqW_ZpZwGm2ud8ClzA4cMtZsPdk-_x7o9xYtMhs88vOo0o_QKaacZozn67qyNe02VZuOwU52LQ56B3H__UR_4f/s1600-r/bubbles-mys2010.gif" title=" " /></div>
<div style="position: fixed; bottom: 0px; height: 190px;
left: 350px; width: 1900px;">
<img alt=" " border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGsIau2XO5o_dXqvrnHr3forSp6wd0iaejB34gmkZSZ1o4R0RLqu4QfGhqW_ZpZwGm2ud8ClzA4cMtZsPdk-_x7o9xYtMhs88vOo0o_QKaacZozn67qyNe02VZuOwU52LQ56B3H__UR_4f/s1600-r/bubbles-mys2010.gif" title=" " /></div>
<div style="position: fixed; bottom: 0px; height: 290px;
left: 150px; width: 1820px;">
<img alt=" " border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmAhyG-R_OKKitejBXKuEmT5PLhO78oHHHaM40ozi-mYnIu6XVXXLtCxSNiyiyCmdCJJEMg9TduNa2h5DsSjc94RT5YrtVGSSl5VBCcHfMG4QZjm_ZcwY-INLOt9jOSHsXaQOZC3rJA1s/s1600/pohon-5-mys2010.png" title=" " /></div>
<div style="position: fixed; bottom: 0px; height: 110px;
left: 440px; width: 120px;">
<img alt="" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiw5inqGCDvCZKF_ZCGe1Wtf2ECjerdJJw-_5AfdXGhNIuigCaz2GlYeAQ0Dx41ATxuyYBagcro3WsUc_7OKaRiHFXXJcfzCoy0MRiwI5INgoPj7UlL4Fkjsqsn5GLWyq9V7KmE3MhlWMY/s1600/kerang-mys2010.gif" title="" /></div>
<div style="position: fixed; bottom: 0px; height: 410px;
right: -151px; width: 400px;">
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyRUpxyUJC8Vl_KHGiVue7Yt4R5g10BPquotRmFCbf16A7OcC-fobc7vNm9Mm14_tMfsVRZD65o7zAtMiBwDwPiunSaZflL8Xk5QzkCNEp3q2Jrd8bIbtNmz2laZ-ds9haWOGmBkpGmWI/s1600/rumput2-mys2010.png" name="e902" border="0" width="350" height="590" /></a>
<div style="position: fixed; bottom: 0px; height: 290px;
right: -151px; width: 400px;">
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZgRZOquQgu6fFxu8qfJmw_biOkX01udtA0r-Z8NDonIZ1ZWRTJE3CQLdmkKWg8MpWPj-gQDzIxqQCKfP-vFXovDHAR3TfjQY0DX9EggP3NuHiXNwy83Rx5bdHKwD-94p8L6iI0eXdHck/s1600/rumput-mys2010.png" name="e902" border="0" width="350" height="790" /></a>
<div style="position: fixed; bottom: 0px; height: 310px;
right: 30px; width: 400px;">
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjP0LLtt8Umq5b0e8CCDtmSTd_pecxrpmNxBDAP5dtZVWkQjeDClY5B4QJjM7W4Ni9AQ_ezVQo8mVClWw_lOg_osSBW8x2OonHPNCPA6J4irQlNQKAIpgrbN3rz95azQY8ip8FJWXhPSYg/s1600/pohon-3-mys2010.png" name="e902" border="0" width="350" height="1190" /></a>
<div style="position: fixed; bottom: 0px; height: 120px;
left: 520px; width: 420px;">
<img alt=" " border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyhUWF_SAkt2LvXwUMOSrjGI2YQOZBqotTzcuc54Bhn20u9bhKoVwDIjOp2YbBb9tmP7iZVPOhly4t5N9FdkZfufOKTaqe8AZvhWL-Qoj9QXPM1TwrPY8PbS5wgH1hwSEY2dWJxnQ0HaU/s1600/ikan3-mys2010.gif" title=" " /></div>
<div style="position: fixed; bottom: 0px; height: 370px;
left: 520px; width: 210px;">
<img alt=" " border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTncy0p_c9-D6xyGAcOURTC7woZA5AJgXMgGqTPYsPcOiucDkgtWsVevkn9pJbaib8vF1QFi7vKkHEbgP4zemlF3sjRZQRn6vntZUQiPVJEVK9438tfIz1S69zz2TiKs53LKe1vndjFU8/s1600/bambu-mys2010.png" title=" " /></div>
<div style="position: fixed; bottom: 0px; height: 470px;
left: 320px; width: 1210px;">
<img alt=" " border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiY_jwPpWwqwf1pxE7Xe74ycarYVrLL6EtMCAlbkj4m5MbmX9DQQ0mVPtXwtVOUKIeQDsLcqncO15cawsk2hhIOAM51ryvxuyWIeLyDwXYmOa97UkqOiNdztZdj-JZLZxMbjRUppyPW7tE/s1600/pohon-2-mys2010.png" title=" " /></div>
<div style="position: fixed; bottom: 0px; height: 250px;
left: 620px; width: 400px;">
<img alt=" " border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2Ix2CGNfnMs80qy99SOljSFEdKag43pD7v3UAE_uo8KxioHdm8b-GEE7ftD-CihYcPtoPNaBwvcOTzzmgbY3FOkeYY8w09diVAc0OdY4NRaQTBAV17wd7vJYj3uKEInPrd0XF3pFKal0/s1600/zebra-mys2010.gif" title=" " /></div>
<div style="position: fixed; bottom: 0px; height: 290px;
left: 350px; width: 1720px;">
<img alt=" " border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj80q14B3Lsf6TfSnSPrOdW85p8xojKDX5Xx2AuLzEIzpw-X8WOnKcWa9AVM9NHCt63cNTPoAbKnwlCTsxzz7DZKPcvS1gEobk73Gfiuz2SnZoOLE8cxkYA3NISSRjhPboKpYXNjgX6Mjo/s1600/pohon-4-mys2010.png" title=" " /></div>
<div style="position: fixed; bottom: 0px; height: 390px;
left: 350px; width: 1720px;">
<img alt=" " border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGsIau2XO5o_dXqvrnHr3forSp6wd0iaejB34gmkZSZ1o4R0RLqu4QfGhqW_ZpZwGm2ud8ClzA4cMtZsPdk-_x7o9xYtMhs88vOo0o_QKaacZozn67qyNe02VZuOwU52LQ56B3H__UR_4f/s1600-r/bubbles-mys2010.gif" title=" " /></div>
<div style="position: fixed; bottom: 0px; height: 390px;
left: 650px; width: 1720px;">
<img alt=" " border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGsIau2XO5o_dXqvrnHr3forSp6wd0iaejB34gmkZSZ1o4R0RLqu4QfGhqW_ZpZwGm2ud8ClzA4cMtZsPdk-_x7o9xYtMhs88vOo0o_QKaacZozn67qyNe02VZuOwU52LQ56B3H__UR_4f/s1600-r/bubbles-mys2010.gif" title=" " /></div>
<div style="position: fixed; bottom: 0px; height: 290px;
left: 850px; width: 1720px;">
<img alt=" " border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGsIau2XO5o_dXqvrnHr3forSp6wd0iaejB34gmkZSZ1o4R0RLqu4QfGhqW_ZpZwGm2ud8ClzA4cMtZsPdk-_x7o9xYtMhs88vOo0o_QKaacZozn67qyNe02VZuOwU52LQ56B3H__UR_4f/s1600-r/bubbles-mys2010.gif" title=" " /></div>
</div>
<div class="container">
<canvas height="600" id="fishtank" width="1400">
</canvas></div>
</div>
</div>
</div>
</div>
<div class="ap" id="ap">
<div align="center">
<h2>
<span style="color:#eee; font-size: 10pt">CIBEBER CIMAHI</2></a>
</div>
<header>
<a href="https://sites.google.com/site/usesitesto/file-code/Aquarium-Mys2010s.css"title="Download Full Code">
<h2>
<span style="color:green; font-size: 10pt">2010 - 2016</2></a></span>
</header>
</div>
</div>
</div>
</div>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<script src="//assets.codepen.io/assets/common/stopExecutionOnTimeout-f961f59a28ef4fd551736b43f94620b5.js"></script>
<script src="//assets.codepen.io/assets/common/stopExecutionOnTimeout-ddaa1eeb67d762ab8aad46508017908c.js"></script>
<script src='//production-assets.codepen.io/assets/common/stopExecutionOnTimeout-b2a7b3fe212eaa732349046d8416e00a9dec26eb7fd347590fbced3ab38af52e.js'></script>
<script>/*Source Code :
Gold Fish code by. Jquery design com - http://www.css-jquery-design.com/2014/10/animated-aquarium-with-pure-css/
Fish flocking Code by. Psycho Dramatic -
http://codepen.io/PsychoDramatic/pen/YPzXON
Design code is edited by. Myscript2010 -
http://sample-mys2010.blogspot.co.id/2016/06/jquery-aquarium-css.html
*/
/* ---------------- FISH "CLASS" START
-------------- */
var FOLLOW_DISTANCE = 100;
var Fish = function(id) {
this.id = id;
this.entourage = [];
// dx/yx is current speed, ox/oy is the previous
one
this.ox = this.dx = Math.random()
- 0.5;
this.oy = this.dy = Math.random()
- 0.5;
this.x = canvas.width * Math.random();
this.y = canvas.height * Math.random();
// A couple of helper functions, the names should
describe their purpose
Fish.prototype.angleToClosestFish = function(otherFish) {
otherFish = otherFish == null ?
this.following : otherFish;
if (otherFish)
{
return Math.atan2(otherFish.y - this.y, otherFish.x -
this.x);
} else {
return Number.MAX_VALUE;
}
}
Fish.prototype.angleFromFishDirectionToClosestFish =
function(otherFish) {
otherFish = otherFish == null ?
this.following : otherFish;
if (otherFish)
{
return Math.abs(deltaAngle(this.angle, this.angleToClosestFish(otherFish)));
} else {
return Number.MAX_VALUE;
}
}
Fish.prototype.angleDirectionDifference = function(otherFish) {
otherFish = otherFish == null ?
this.following : otherFish;
if (otherFish)
{
Math.abs(deltaAngle(this.angle,
otherFish.angle));
} else {
return Number.MAX_VALUE;
}
}
// Update the fish "physics"
Fish.prototype.calc = function() {
this.ox = this.dx;
this.oy = this.dy;
var MAX_SPEED = 1.1;
var maxSpeed = MAX_SPEED;
//Do I need to find another fish buddy?
if (this.following
== null || py(this.x - this.following.x, this.y
- this.following.y) > FOLLOW_DISTANCE) {
if (this.following
!= null) {
if (keyDown)
affinityLine(this.following, this, "white");
this.following.entourage.splice(this.following.entourage.indexOf(this));
}
this.following = null;
//attract closer to other fish - find closest
var closestDistance = Number.MAX_VALUE;
var closestFish = null;
for (var i = 0; i < fishes.length; i++) {
var fish = fishes[i];
if (fish !=
this) {
var distance = py(this.x - fish.x, this.y -
fish.y);
// Is it closer, within the max distance and within
the sector that the fish can see?
if (distance <
closestDistance && fish.following != this && distance < FOLLOW_DISTANCE &&
this.angleFromFishDirectionToClosestFish(fish) < Math.PI
* 0.25) {
closestDistance = distance;
closestFish = fish;
}
}
}
if (closestFish !=
null) {
this.following = closestFish;
closestFish.entourage.push(this);
}
}
// Fish is following another
if (this.following
!= null) {
// Go closer to other fish
this.followingDistance = py(this.x -
this.following.x, this.y - this.following.y);
this.distanceFactor = 1 - this.followingDistance / FOLLOW_DISTANCE;
// If going head on, just break a little before
following
if (this.angleDirectionDifference()
> (Math.PI * 0.9) && // On colliding
angle?
this.angleFromFishDirectionToClosestFish() <
(Math.PI * 0.2)) { // In colliding sector?
this.dx += this.following.x * 0.1;
this.dy += this.following.y * 0.1;
if (keyDown)
affinityLine(this.following, this, "yellow");
} else if (this.followingDistance
> FOLLOW_DISTANCE * 0.3) { // Dont go closer if
close
this.dx += Math.cos(this.angleToClosestFish())
* (0.05 * this.distanceFactor);
this.dy += Math.sin(this.angleToClosestFish())
* (0.05 * this.distanceFactor);
}
if (keyDown)
affinityLine(this.following, this, "red");
}
// Go closer to center, crashing into the canvas
walls is just silly!
if (this.x <
canvas.width * .1 || this.x >
canvas.width * .9 || this.y <
canvas.height * .2 || this.y >
canvas.height * .8) {
this.dx += (canvas.width / 2 - this.x) / 5000;
this.dy += (canvas.height / 2 - this.y) / 5000;
}
// Poor little fishies are scared of your cursor
if (py(this.x
- cursor.x, this.y - cursor.y) < FOLLOW_DISTANCE
* 0.75) {
this.dx -= (cursor.x - this.x)
/ 500;
this.dy -= (cursor.y - this.y)
/ 500;
maxSpeed = 4;
if (keyDown)
affinityLine(cursor, this, "green");
}
// If following fish, try avoid going close to your
siblings
if (this.following
!= null) {
for (var i = 0; i < this.following.entourage.length; i++) {
var siblingFish = this.following.entourage[i];
if (siblingFish !==
this) {
if (py(this.x
- siblingFish.x, this.y - siblingFish.y) <
FOLLOW_DISTANCE * 0.2) {
if (keyDown)
affinityLine(siblingFish, this, "yellow");
this.dx -= (siblingFish.x - this.x)
/ 1000;
this.dy -= (siblingFish.y - this.y)
/ 1000;
}
}
}
}
// Calculate heading from new speed
this.angle = Math.atan2(this.dy,
this.dx);
// Grab the speed from the vectors, and normalize
it
var speed = Math.max(0.1, Math.min(maxSpeed, py(this.dx,
this.dy)));
// Recreate speed vector from recombining angle of
direction with normalized speed
this.dx = Math.cos(this.angle)
* (speed + speedBoost);
this.dy = Math.sin(this.angle)
* (speed + speedBoost);
// Fish like to move it, move it!
this.x += this.dx;
this.y += this.dy;
}
}
/* ---------------------- FISH "CLASS"
END -------------- */
/* ---------------------- MAIN START
-------------------- */
var canvas = document.getElementById('fishtank');
var context = canvas.getContext('2d');
var fishes = [];
var speedBoostCountdown = 200,
speedBoost = 0,
SPEED_BOOST = 2;
var fishBitmap = new Image()
fishBitmap.onload = function() {
update();
};
fishBitmap.src = "https://dl.dropboxusercontent.com/u/4534978/2014/fishes/fish.png";
//Draw Circle
function draw(f) {
var r = f.angle + Math.PI;
context.translate(f.x, f.y);
context.rotate(r);
var w = 20;
var acc = py(f.dx - f.ox, f.dy - f.oy)
/ 0.05;
// If a fish does a "flip", make it less
wide
if (acc >
1) {
w = 10 + 10 / acc;
}
context.drawImage(fishBitmap, 0, 0, w, 6);
context.rotate(-r);
context.translate(-f.x, -f.y);
}
// Pythagoras shortcut
function py(a, b) {
return Math.sqrt(a * a + b * b);
}
//------------ USER INPUT START -------------
var cursor = {
x: 0,
y: 0
};
var cursorDown = false,
keyDown = false;
document.onmousemove = function(e) {
cursor.x = e.pageX - (window.innerWidth
/ 2 - canvas.width / 2);
cursor.y = e.pageY - (window.innerHeight
/ 2 - canvas.height / 2);
}
document.onmouseout = function(e) { //Out of screen is
not a valid pos
cursor.y = cursor.x = Number.MAX_VALUE;
}
document.onmousedown = function() {
activateSpeedBoost();
cursorDown = true;
}
document.onmouseup = function() {
cursorDown = false;
}
document.onkeydown = function() {
keyDown = true;
}
document.onkeyup = function() {
keyDown = false;
}
//------------ USER INPUT STOP -------------
function deltaAngle(f, o) { //Find the shortest angle between two
var r = f - o;
return Math.atan2(Math.sin(r), Math.cos(r));
}
function affinityLine(f, o, c) { //Draw a line with pretty gradient
var grad = context.createLinearGradient(f.x, f.y,
o.x, o.y);
grad.addColorStop(0, c);
grad.addColorStop(1, "black");
context.strokeStyle = grad;
context.beginPath();
context.moveTo(f.x, f.y);
context.lineTo(o.x, o.y);
context.stroke();
}
function activateSpeedBoost() {
speedBoostCountdown = 400 + Math.round(400 * Math.random());
speedBoost = SPEED_BOOST;
}
//Update and draw all of them
function update() {
if (fishes.length
< 500) {
fishes.push(new Fish(fishes.length));
}
if (!cursorDown)
{
//clear the canvas
canvas.width = canvas.width; //Try commenting this line :-)
//Update and draw fish
for (var i = 0; i < fishes.length; i++) {
var fish = fishes[i];
fish.calc();
draw(fish);
}
}
speedBoostCountdown--;
if (speedBoostCountdown
< 0) {
activateSpeedBoost();
}
if (speedBoost >
0) {
speedBoost -= SPEED_BOOST / 80; //Reduce speed bost fast!
} else {
speedBoost = 0;
}
requestAnimationFrame(update);
}
/* ---------------------- MAIN END
----------------------- */
var colours=new Array("#FF9900", "#FF9900", "#FF9900", "#FF9900", "#FF9900"); // colours for top, right, bottom and
left borders and background of bubbles
var bubbles=100; // maximum number of bubbles on screen
var x=ox=400;
var y=oy=300;
var swide=800;
var shigh=600;
var sleft=sdown=0;
var bubb=new Array();
var bubbx=new Array();
var bubby=new Array();
var bubbs=new Array();
window.onload=function() { if (document.getElementById) {
var rats, div;
for (var i=0; i<bubbles; i++) {
rats=createDiv("3px", "3px");
rats.style.visibility="hidden";
div=createDiv("auto", "auto");
rats.appendChild(div);
div=div.style;
div.top="1px";
div.left="0px";
div.bottom="1px";
div.right="0px";
div.borderLeft="1px
solid "+colours[3];
div.borderRight="1px
solid "+colours[1];
div=createDiv("auto", "auto");
rats.appendChild(div);
div=div.style;
div.top="0px";
div.left="1px";
div.right="1px";
div.bottom="0px"
div.borderTop="1px solid "+colours[0];
div.borderBottom="1px
solid "+colours[2];
div=createDiv("auto", "auto");
rats.appendChild(div);
div=div.style;
div.left="1px";
div.right="1px";
div.bottom="1px";
div.top="1px";
div.backgroundColor=colours[4];
div.opacity=0.5;
if (document.all)
div.filter="alpha(opacity=50)";
document.body.appendChild(rats);
bubb[i]=rats.style;
}
set_scroll();
set_width();
bubble();
}}
function bubble() {
var c;
if (x!=ox
|| y!=oy) {
ox=x;
oy=y;
for (c=0; c<bubbles; c++) if (!bubby[c]) {
bubb[c].left=(bubbx[c]=x)+"px";
bubb[c].top=(bubby[c]=y)+"px";
bubb[c].width="3px";
bubb[c].height="3px"
bubb[c].visibility="visible";
bubbs[c]=3;
break;
}
}
for (c=0; c<bubbles; c++) if (bubby[c]) update_bubb(c);
setTimeout("bubble()", 40);
}
function update_bubb(i) {
if (bubby[i])
{
bubby[i]-=bubbs[i]/2+i%2;
bubbx[i]+=(i%5-2)/5;
if (bubby[i]>sdown
&& bubbx[i]>0) {
if (Math.random()<bubbs[i]/shigh*2 && bubbs[i]++<8) {
bubb[i].width=bubbs[i]+"px";
bubb[i].height=bubbs[i]+"px";
}
bubb[i].top=bubby[i]+"px";
bubb[i].left=bubbx[i]+"px";
}
else {
bubb[i].visibility="hidden";
bubby[i]=0;
return;
}
}
}
document.onmousemove=mouse;
function mouse(e) {
set_scroll();
y=(e)?e.pageY:event.y+sleft;
x=(e)?e.pageX:event.x+sdown;
}
window.onresize=set_width;
function set_width() {
if (document.documentElement
&& document.documentElement.clientWidth) {
swide=document.documentElement.clientWidth;
shigh=document.documentElement.clientHeight;
}
else if (typeof(self.innerHeight)=="number") {
swide=self.innerWidth;
shigh=self.innerHeight;
}
else if (document.body.clientWidth)
{
swide=document.body.clientWidth;
shigh=document.body.clientHeight;
}
else {
swide=800;
shigh=600;
}
}
window.onscroll=set_scroll;
function set_scroll() {
if (typeof(self.pageYOffset)=="number") {
sdown=self.pageYOffset;
sleft=self.pageXOffset;
}
else if (document.body.scrollTop
|| document.body.scrollLeft) {
sdown=document.body.scrollTop;
sleft=document.body.scrollLeft;
}
else if (document.documentElement
&& (document.documentElement.scrollTop || document.documentElement.scrollLeft))
{
sleft=document.documentElement.scrollLeft;
sdown=document.documentElement.scrollTop;
}
else {
sdown=0;
sleft=0;
}
}
function createDiv(height, width) {
var div=document.createElement("div");
div.style.position="absolute";
div.style.height=height;
div.style.width=width;
div.style.overflow="hidden";
return (div);
}
//# sourceURL=pen.js
</script>
</body>
</html>
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment