Skip to content

Commit

Permalink
Copy stuff from dot-ry.fi
Browse files Browse the repository at this point in the history
  • Loading branch information
lukxsx committed Mar 25, 2024
1 parent c307af5 commit d6c70ff
Show file tree
Hide file tree
Showing 16 changed files with 402 additions and 0 deletions.
20 changes: 20 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
baseURL = 'https://graffathon.org/'
languageCode = 'en-us'
title = 'Graffathon 2024'

[menu]
[[menu.main]]
name = "Home"
url = "/"
weight = 1
[[menu.main]]
name = "News"
pageRef = "news"
weight = 2
[[menu.main]]
name = "Contact"
pageRef = "contact"
weight = 3

[taxonomies]
tag = "tags"

[params]
dateFormat = "Jan 2, 2006"
30 changes: 30 additions & 0 deletions content/contact.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: "Contact"
layout: staticpage
---

<p>Email: <a href="mailto:[email protected]">[email protected]</a></p>
<p>
Telegram:
<a href="https://t.me/+IJ89AkccCKQyNzE0" target="_blank"
>https://t.me/+IJ89AkccCKQyNzE0</a
>
</p>
<p>IRC: #dot @ IRCNet</p>
<p>
Facebook:
<a
href="https://www.facebook.com/DigitalMediaClubOfAaltoUniversity"
target="_blank"
>https://www.facebook.com/DigitalMediaClubOfAaltoUniversity</a
>
</p>
<p>
Official name: Digitaalisen median ammattiainekerho DOT ry
</p>
<p>
Business ID (Y-tunnus): 3071317-5
</p>
<p>
IBAN: FI36 1309 3000 2025 49 (Nordea)
</p>
1 change: 1 addition & 0 deletions layouts/_default/_markup/render-link.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<a href="{{ .Destination | safeURL }}" {{ with .Title}} title="{{ . }}"{{ end }} {{ if strings.HasPrefix .Destination "http" }} target="_blank" rel="noopener noreferrer" {{ end }}> {{ .Text | safeHTML }} </a>
8 changes: 8 additions & 0 deletions layouts/_default/baseof.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!DOCTYPE html>
<html lang="en">
{{ partial "head.html" . }}
<body>
{{ partial "header.html" . }} {{ partial "nav.html" . }}
<main>{{ block "main" . }}{{ end }}</main>
</body>
</html>
11 changes: 11 additions & 0 deletions layouts/_default/list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{ define "main" }}

<h2>Category: {{ .Title }}</h2>
{{ range .Pages.ByPublishDate.Reverse }}
<ul>
<li>
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
{{ partial "date.html" . }}
</li>
</ul>
{{ end }} {{ end }}
6 changes: 6 additions & 0 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{{ define "main" }}
<h2>{{ .Title }}</h2>
{{ partial "date.html" . }}
<br></br>
{{ .Content }}
{{ end }}
3 changes: 3 additions & 0 deletions layouts/_default/staticpage.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{ define "main" }}
<h2>{{ .Title }}</h2>
{{ .Content }} {{ end }}
4 changes: 4 additions & 0 deletions layouts/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{{ define "main" }}

<h2>About</h2>
{{ end }}
8 changes: 8 additions & 0 deletions layouts/partials/date.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{{ $dateTime := .PublishDate.Format "2006-01-02" }} {{ $dateFormat :=
.Site.Params.dateFormat | default "Jan 2, 2006" }}
Published on <time datetime="{{ $dateTime }}">{{ .PublishDate.Format $dateFormat }}</time>
{{ with .Params.tags }}
<br />
Category: {{ range . }} {{ $href := print (relURL "tags/") (urlize .) }}
<a href="{{ $href }}">{{ . }}</a>
{{ end }} {{ end }}
15 changes: 15 additions & 0 deletions layouts/partials/head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
{{ $css := "style.css" | relURL }} {{ $shader := "shader.js" | relURL }} {{
$favicon := "favicon.png" | relURL }}
<link rel="stylesheet" href="{{ $css }}" />
<script src="{{ $shader }}"></script>
<link rel="icon" type="image/x-icon" href="{{ $favicon }}" />
{{ $title := print .Title " - " .Site.Title }} {{ if .IsHome }}{{ $title =
.Site.Title }}{{ end }}
<title>{{ $title }}</title>
</head>
8 changes: 8 additions & 0 deletions layouts/partials/header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{{ $dotlogo := "dot_logo_white.png" | relURL }}
<header>
<canvas></canvas>
<img
src="{{ $dotlogo }}"
alt="Digital Media Club of Aalto University - DOT ry"
/>
</header>
7 changes: 7 additions & 0 deletions layouts/partials/nav.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<nav>
<ul class="nav-links">
{{ range .Site.Menus.main }} {{ $text := print .Name | safeHTML }}
<li><a href="{{ .URL }}">{{ $text }}</a></li>
{{ end }}
</ul>
</nav>
Binary file added static/dot_logo_white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
160 changes: 160 additions & 0 deletions static/shader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
window.onload = function () {
const canvas = document.querySelector("canvas");
const gl = canvas.getContext("webgl");
if (!gl) {
alert("Failed to initialize WebGL.");
}

const vertexShaderSource = `
attribute vec4 a_position;
void main() {
gl_Position = a_position;
}
`;

const fragmentShaderSource = `
precision highp float;
uniform vec2 u_resolution;
uniform float u_time;
float hash(vec3 p) {
return fract(sin(dot(p, vec3(127.1, 311.7, 235.2))) * 43758.5453);
}
float noise(vec3 p) {
vec3 i = floor(p);
vec3 f = fract(p);
vec3 u = f * f * (3.0 - 2.0 * f);
return mix(
mix(
mix(hash(i), hash(i + vec3(1.0, 0.0, 0.0)), u.x),
mix(hash(i + vec3(0.0, 1.0, 0.0)), hash(i + vec3(1.0, 1.0, 0.0)), u.x),
u.y
),
mix(
mix(hash(i + vec3(0.0, 0.0, 1.0)), hash(i + vec3(1.0, 0.0, 1.0)), u.x),
mix(hash(i + vec3(0.0, 1.0, 1.0)), hash(i + vec3(1.0, 1.0, 1.0)), u.x),
u.y
),
u.z
);
}
float fbm(vec3 p) {
float v = 0.0;
float a = 0.5;
vec3 shift = vec3(101.618);
for (int i = 0; i < 9; ++i) {
v += a * noise(p);
p = p * 2.0 + shift;
a *= 0.48;
}
return v;
}
float h(float t) {
return sin(t * 6.283) * 0.5 + 0.5;
}
vec3 aurora(vec2 uv, float time) {
vec2 q = vec2(uv.x, 1.0 - uv.y + u_time * 0.03);
vec3 fbmUV = vec3(q * 10., time * 0.5);
float f = fbm(fbmUV);
vec3 color = vec3(h(f), h(f + 0.333), h(f + 0.666));
float mask = smoothstep(0.2, 0.0, abs(uv.y + 0.5 - f) * 5.0); // Mask
return color * mask;
}
vec3 getColor(vec2 uv, float time) {
vec3 col = aurora(uv, time);
return col;
}
void main() {
vec2 uv = gl_FragCoord.xy - u_resolution.xy * 0.5;
uv /= u_resolution.y;
uv /= 1.3; // zoom
gl_FragColor = vec4(getColor(uv, u_time), 1.0);
}
`;

function createShader(gl, type, source) {
const shader = gl.createShader(type);
gl.shaderSource(shader, source);
gl.compileShader(shader);
const success = gl.getShaderParameter(shader, gl.COMPILE_STATUS);
if (success) {
return shader;
}
console.error(gl.getShaderInfoLog(shader));
gl.deleteShader(shader);
}

function createProgram(gl, vertexShader, fragmentShader) {
const program = gl.createProgram();
gl.attachShader(program, vertexShader);
gl.attachShader(program, fragmentShader);
gl.linkProgram(program);
const success = gl.getProgramParameter(program, gl.LINK_STATUS);
if (success) {
return program;
}
console.error(gl.getProgramInfoLog(program));
gl.deleteProgram(program);
}

function createFullScreenQuad(gl) {
const quadBuffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuffer);
gl.bufferData(
gl.ARRAY_BUFFER,
new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]),
gl.STATIC_DRAW
);
return quadBuffer;
}

const vertexShader = createShader(gl, gl.VERTEX_SHADER, vertexShaderSource);
const fragmentShader = createShader(
gl,
gl.FRAGMENT_SHADER,
fragmentShaderSource
);
const program = createProgram(gl, vertexShader, fragmentShader);
const positionAttributeLocation = gl.getAttribLocation(program, "a_position");
const resolutionUniformLocation = gl.getUniformLocation(
program,
"u_resolution"
);
const timeUniformLocation = gl.getUniformLocation(program, "u_time");
const quadBuffer = createFullScreenQuad(gl);

function render() {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight * 0.2;

gl.viewport(0, 0, gl.canvas.width, gl.canvas.height);
gl.clearColor(0, 0, 0, 1);
gl.clear(gl.COLOR_BUFFER_BIT);
gl.useProgram(program);
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuffer);

gl.enableVertexAttribArray(positionAttributeLocation);
gl.vertexAttribPointer(positionAttributeLocation, 2, gl.FLOAT, false, 0, 0);
gl.uniform2f(resolutionUniformLocation, gl.canvas.width, gl.canvas.height);
gl.uniform1f(timeUniformLocation, performance.now() * 0.001);

gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
requestAnimationFrame(render);
}

requestAnimationFrame(render);
};
Loading

0 comments on commit d6c70ff

Please sign in to comment.