redesign #5
3 changed files with 114 additions and 82 deletions
|
@ -1,6 +1,6 @@
|
|||
// <![CDATA[
|
||||
var colour="#f5e0dc"; // in addition to "random" can be set to any valid colour eg "#f0f" or "red"
|
||||
var sparkles=50;
|
||||
var sparkles=300;
|
||||
|
||||
/****************************
|
||||
* Tinkerbell Magic Sparkle *
|
||||
|
|
112
public/scripts/rain.js
Normal file
112
public/scripts/rain.js
Normal file
|
@ -0,0 +1,112 @@
|
|||
// <![CDATA[
|
||||
var speed=33; // lower number for faster
|
||||
var drops=100; // number of 'drops'
|
||||
var colour="#a6e3a1"; // colour of drops (generally grey!)
|
||||
|
||||
/***************************\
|
||||
* Rainy Afternoon Effect *
|
||||
*(c)2011-13 mf2fm web-design*
|
||||
* http://www.mf2fm.com/rv *
|
||||
* DON'T EDIT BELOW THIS BOX *
|
||||
\***************************/
|
||||
|
||||
var flks=new Array();
|
||||
var flkx=new Array();
|
||||
var flky=new Array();
|
||||
var fldy=new Array();
|
||||
var swide, shigh, boddie;
|
||||
var ie_version=(navigator.appVersion.indexOf("MSIE")!=-1)?parseFloat(navigator.appVersion.split("MSIE")[1]):false;
|
||||
|
||||
function addLoadEvent(funky) {
|
||||
var oldonload=window.onload;
|
||||
if (typeof(oldonload)!='function') window.onload=funky;
|
||||
else window.onload=function() {
|
||||
if (oldonload) oldonload();
|
||||
funky();
|
||||
}
|
||||
}
|
||||
|
||||
addLoadEvent(storm);
|
||||
|
||||
function storm() { if (document.getElementById) {
|
||||
var r1, r2;
|
||||
boddie=document.createElement("div");
|
||||
boddie.style.position="fixed";
|
||||
boddie.style.top="0px";
|
||||
boddie.style.left="0px";
|
||||
boddie.style.width="1px";
|
||||
boddie.style.height="1px";
|
||||
boddie.style.overflow="visible";
|
||||
boddie.style.backgroundColor="transparent";
|
||||
document.body.appendChild(boddie);
|
||||
set_width();
|
||||
for (var i=0; i<drops; i++) {
|
||||
flks[i]=createDiv(16, 2, "transparent");
|
||||
r1=createDiv(6, 2, colour);
|
||||
r1.style.top="10px";
|
||||
r1.style.left="0px";
|
||||
flks[i].appendChild(r1);
|
||||
r2=createDiv(10, 2, colour);
|
||||
r2.style.top="0px";
|
||||
r2.style.left="0px";
|
||||
if (ie_version && ie_version<10) r2.style.filter="alpha(opacity=25)";
|
||||
else r2.style.opacity=0.25;
|
||||
flks[i].appendChild(r2);
|
||||
flkx[i]=2*Math.floor(Math.random()*swide/2);
|
||||
flky[i]=Math.floor(Math.random()*shigh);
|
||||
fldy[i]=2+Math.floor(Math.random()*4);
|
||||
flks[i].style.left=flkx[i]+"px";
|
||||
flks[i].style.top=flky[i]+"px";
|
||||
boddie.appendChild(flks[i]);
|
||||
}
|
||||
setInterval("cats_and_dogs()", speed);
|
||||
}}
|
||||
|
||||
function createDiv(height, width, colour) {
|
||||
var div=document.createElement("div");
|
||||
div.style.position="absolute";
|
||||
div.style.height=height+"px";
|
||||
div.style.width=width+"px";
|
||||
div.style.overflow="hidden";
|
||||
div.style.backgroundColor=colour;
|
||||
return (div);
|
||||
}
|
||||
|
||||
window.onresize=set_width;
|
||||
function set_width() {
|
||||
var sw_min=999999;
|
||||
var sh_min=999999;
|
||||
if (document.documentElement && document.documentElement.clientWidth) {
|
||||
sw_min=document.documentElement.clientWidth;
|
||||
sh_min=document.documentElement.clientHeight;
|
||||
}
|
||||
if (typeof(self.innerWidth)!="undefined" && self.innerWidth) {
|
||||
if (self.innerWidth<sw_min) sw_min=self.innerWidth;
|
||||
if (self.innerHeight<sh_min) sh_min=self.innerHeight;
|
||||
}
|
||||
if (document.body.clientWidth) {
|
||||
if (document.body.clientWidth<sw_min) sw_min=document.body.clientWidth;
|
||||
if (document.body.clientHeight<sh_min) sh_min=document.body.clientHeight;
|
||||
}
|
||||
if (sw_min==999999 || sh_min==999999) {
|
||||
sw_min=800;
|
||||
sh_min=600;
|
||||
}
|
||||
swide=sw_min-2;
|
||||
shigh=sh_min;
|
||||
}
|
||||
|
||||
function cats_and_dogs(c) {
|
||||
var i, x, o=0;
|
||||
for (i=0; i<drops; i++) {
|
||||
flky[i]+=fldy[i];
|
||||
if (flky[i]>=shigh-16) {
|
||||
flky[i]=-16;
|
||||
fldy[i]=2+Math.floor(Math.random()*4);
|
||||
flkx[i]=2*Math.floor(Math.random()*swide/2);
|
||||
flks[i].style.left=flkx[i]+"px";
|
||||
}
|
||||
flks[i].style.top=flky[i]+"px";
|
||||
}
|
||||
}
|
||||
// ]]>
|
|
@ -23,86 +23,6 @@ const { title } = Astro.props;
|
|||
</div>
|
||||
</section>
|
||||
<Footer />
|
||||
<style is:global>
|
||||
.navbar .navbar-menu {
|
||||
flex-grow: initial;
|
||||
flex-shrink: initial;
|
||||
}
|
||||
:root {
|
||||
--accent: 250, 179, 135;
|
||||
--accent-light: 250, 221, 201;
|
||||
--accent-dark: 149, 106, 81;
|
||||
--accent-gradient: linear-gradient(
|
||||
45deg,
|
||||
rgb(var(--accent)),
|
||||
rgb(var(--accent-light)) 30%,
|
||||
white 60%
|
||||
);
|
||||
}
|
||||
html {
|
||||
font-family: system-ui, sans-serif;
|
||||
background: #13151a;
|
||||
background-size: 224px;
|
||||
}
|
||||
main {
|
||||
margin: auto;
|
||||
padding: 1rem;
|
||||
width: 800px;
|
||||
max-width: calc(100% - 2rem);
|
||||
color: white;
|
||||
font-size: 20px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.astro-a {
|
||||
position: absolute;
|
||||
top: -32px;
|
||||
left: 50%;
|
||||
transform: translatex(-50%);
|
||||
width: 220px;
|
||||
height: auto;
|
||||
z-index: -1;
|
||||
}
|
||||
h1 {
|
||||
font-size: 4rem;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
text-align: center;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
.text-gradient {
|
||||
background-image: var(--accent-gradient);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-size: 400%;
|
||||
background-position: 0%;
|
||||
}
|
||||
.instructions {
|
||||
margin-bottom: 2rem;
|
||||
border: 1px solid rgba(var(--accent-light), 25%);
|
||||
background: linear-gradient(
|
||||
rgba(var(--accent-dark), 66%),
|
||||
rgba(var(--accent-dark), 33%)
|
||||
);
|
||||
padding: 1.5rem;
|
||||
border-radius: 8px;
|
||||
}
|
||||
.instructions code {
|
||||
font-size: 0.8em;
|
||||
font-weight: bold;
|
||||
background: rgba(var(--accent-light), 12%);
|
||||
color: rgb(var(--accent-light));
|
||||
border-radius: 4px;
|
||||
padding: 0.3em 0.4em;
|
||||
}
|
||||
.instructions strong {
|
||||
color: rgb(var(--accent-light));
|
||||
}
|
||||
.link-card-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(24ch, 1fr));
|
||||
gap: 2rem;
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
<script type='text/javascript' src='/scripts/rain.js'></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue