Get more performance by doing the gaussian blur at a smaller scale
This commit is contained in:
parent
47bfdac6c1
commit
bfb1c59303
8
drift.js
8
drift.js
|
@ -54,10 +54,10 @@ const applyState = states => states.map(s => {
|
|||
|
||||
loop = (state) => {
|
||||
setInterval(() => {
|
||||
const goopZoneWidth = goopZoneElem.width.baseVal.value;
|
||||
const goopZoneHeight = goopZoneElem.height.baseVal.value;
|
||||
const goopZoneWidth = goopZoneElem.width.baseVal.value/2;
|
||||
const goopZoneHeight = goopZoneElem.height.baseVal.value/2;
|
||||
|
||||
goopHeader.setAttribute("x", goopZoneWidth/2-300);
|
||||
goopHeader.setAttribute("x", (goopZoneWidth - 300)/2);
|
||||
|
||||
state = nextState(state, goopZoneWidth, goopZoneHeight);
|
||||
applyState(state)
|
||||
|
@ -65,4 +65,4 @@ loop = (state) => {
|
|||
}
|
||||
|
||||
const drifters = Array.from(document.getElementsByClassName("glob"));
|
||||
loop(mkInitialState(drifters, goopZoneElem.width.baseVal.value, goopZoneElem.height.baseVal.value));
|
||||
loop(mkInitialState(drifters, goopZoneElem.width.baseVal.value/2, goopZoneElem.height.baseVal.value/2));
|
17
index.html
17
index.html
|
@ -8,15 +8,19 @@
|
|||
<header>
|
||||
<svg id=goop-zone>
|
||||
<defs>
|
||||
<filter id="goop-full">
|
||||
<feGaussianBlur stdDeviation="30"/>
|
||||
<feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1000 -250"/>
|
||||
<filter id="goop-blur">
|
||||
<feGaussianBlur stdDeviation="15"/>
|
||||
</filter>
|
||||
<filter id="goop-thresh">
|
||||
<feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1000 -500"/>
|
||||
</filter>
|
||||
<path
|
||||
style="transform:scale(0.5)"
|
||||
id="the-one-true-glob"
|
||||
d="M 24.0,158.5 0,67.2 48.1,0 189.7,36.6 146.5,87.4 185.2,135.3 84.8,134.1 Z" />
|
||||
</defs>
|
||||
<g style="filter:url(#goop-full);width:100%;height:100%">
|
||||
<g style="filter:url(#goop-thresh)">
|
||||
<g style="filter:url(#goop-blur);transform:scale(2.0)">
|
||||
<use class="glob" xlink:href="#the-one-true-glob" />
|
||||
<use class="glob" xlink:href="#the-one-true-glob" />
|
||||
<use class="glob" xlink:href="#the-one-true-glob" />
|
||||
|
@ -34,8 +38,9 @@
|
|||
<use class="glob" xlink:href="#the-one-true-glob" />
|
||||
<use class="glob" xlink:href="#the-one-true-glob" />
|
||||
<use class="glob" xlink:href="#the-one-true-glob" />
|
||||
<rect width=2000 height=30 x=-60 y=400 /> <!-- base -->
|
||||
<rect width=600 height=130 x=100 y=135 id="header-box" />
|
||||
<rect width=1000 height=30 x=-30 y=190 /> <!-- base -->
|
||||
<rect width=300 height=65 x=50 y=67.5 id="header-box" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
<h1>Emi Simpson</h1>
|
||||
|
|
Loading…
Reference in a new issue