small pixel drawing of a pufferfish j3s.sh

flippy puffer
Jes Olson j3s@c3f.net
Fri, 18 Nov 2022 20:27:50 -0800
commit

523f4d14e12ac0ff95f8ed5cd5b284ad8ba173a0

parent

51e395881fc2a568e43dbc4dff9458016d706f9c

2 files changed, 24 insertions(+), 1 deletions(-)

jump to
M main.gomain.go

@@ -103,7 +103,8 @@ return template.Template{}, err

} funcMap := template.FuncMap{ - "randomheaderphrase": randomJesPhrase, + "randomheaderphrase": randomJesPhrase, + "randomrotationdegrees": randomRotationDegrees, } tmpl, err := template.New("unimportant").Funcs(funcMap).ParseFiles(layoutPath, requestedPath)

@@ -262,6 +263,11 @@ fmt.Fprintf(w, "<tr><td>")

fmt.Fprintf(w, `<a href="%s">%s</a>`, p.Link, p.Title) fmt.Fprintf(w, "</tr></td>") } +} + +func randomRotationDegrees() int { + rand.Seed(time.Now().UnixNano()) + return rand.Intn(500 - -500) + -500 } func randomJesPhrase() string {
M templates/layout.htmltemplates/layout.html

@@ -16,6 +16,23 @@ max-width: 500px;

margin: 0 auto; padding: 0; } + + @keyframes lol { + from{ + transform: rotate(0deg); + } + to { + transform: rotate({{ randomrotationdegrees }}deg); + } + } + + #header img { + animation: lol; + animation-duration: 1s; + animation-timing-function: ease; + animation-fill-mode: forwards; + animation-delay: 5s; + } #header { font-family: monospace;