merged changes from mb, work on animation export view

main
Michael Murtaugh 1 week ago
parent ea3ee94371
commit 8abed680b3

@ -328,4 +328,4 @@
"complex",
"artificial"
]
}
}

@ -0,0 +1,59 @@
{% extends "call/base.html" %}
{% load static %}
{% block extrahead %}
<link rel="stylesheet" href="{% static 'call/guestbook.css'%}">
<style>
body {
background: hsl({{bg_hue|default:"0"}}deg {{bg_sat|default:"0"}}% {{bg_lightness|default:"66"}}%);
margin: 0;
}
@page {
/* size: 2160px 3840px; */
size: {{width}}px {{height}}px;
margin: 0;
}
.flex-container {
height: 100%;
padding: 0;
margin: 0;
display: flex;
align-items: center;
justify-content: center;
}
#page {
position: absolute;
left: 0; right: 0;
top: 0; bottom: 0;
}
</style>
{% endblock %}
{% block content %}
<div id="page">
<div class="flex-container">
<div id="info" style="font-family: serif !important">
<p>
The <a href="https://xpub.nl/" target="extern">Master Experimental Publishing (XPUB)</a> at the <a href="https://pzwart.nl/" target="extern">Piet Zwart Institute</a> in Rotterdam (NL) is a two-year master focused on the acts of making things public and creating publics in the age of post-digital networks.
</p>
<p>XPUB is looking for new students! Come & join us!<p>
<p>Use the <em>XPUB Community Builder</em> below to put yourself on our digital guestbook, join an upcoming open day either online or in-person, and APPLY!</p>
<p><a href="https://www.pzwart.nl/application/deadlines/" target="extern">Application deadlines</a>:</p>
<p>
<ul>
<li>March 4, 2024 (non-EU final + EU priority deadline)</li>
<li>May 8, 2024 (final EU deadline)</li>
</ul>
</p>
<p><a href="https://www.pzwart.nl/blog/open-day/" target="extern">Open days</a>:</p>
<p>
<ul>
<li>ONLINE: <a href="mailto:pzi.coordinators@hr.nl?subject=XPUB Open Day (online)&amp;body=Hello, I will join the online open day on the February 11th on 10:00 CET or 16:00 CET" target="_blank">February 11, 2024, 10:00 + 16:00 CEST</a></li>
<li>IN PERSON:<a href="https://www.pzwart.nl/blog/open-day/" target="extern">February 15, 2025</a></li>
</ul>
</p>
<p>
<button style="background: yellow" id="apply" onclick="window.open('https://www.pzwart.nl/experimental-publishing/apply/', 'extern')">Apply</button>
</p>
</div>
</div>
</div>
{% endblock %}

@ -9,7 +9,7 @@
}
@page {
/* size: 2160px 3840px; */
size: 432px 768px;
size: {{width}}px {{height}}px;
margin: 0;
}
.flex-container {
@ -26,15 +26,15 @@
top: 0; bottom: 0;
}
div.caption div.captiontext {
font-size: 24px;
font-size: 2.5vh; /* 24px; */
}
div.caption {
/* border: 1px solid black; */
position: absolute;
/* left: -480px;
width: 960px; */
left: -120px;
width: 240px;
left: -13vh; /* -120px; */
width: 26vh; /* 240px; */
}
</style>
@ -42,7 +42,7 @@
{% block content %}
<div id="page">
<div class="flex-container">
<div class="creature"><img src="{% url 'creature_frame' creature.id %}?cell={{cell}}"><div class="centerbottom"><div class="caption"><div class="corner"></div><div class="captiontext">{{creature.caption}}</div></div></div></div>
<div class="creature"><img src="{% url 'creature_frame' creature.id %}?cell={{cell}}&scale={{scale}}"><div class="centerbottom"><div class="caption"><div class="corner"></div><div class="captiontext">{{creature.caption}}</div></div></div></div>
</div>
</div>
{% endblock %}

@ -37,7 +37,7 @@
</p>
</div>
<h2>XPUB Community Builder</h2>
<h2>Join the (digital) Community</h2>
<p>Add yourself to our digital guestbook!<br>What kind of XPUB student do you want to be?<br>(Activate your character by clicking on it!)</p>
<canvas id=c width=16 height=16></canvas>
<!-- <div id=caption>HERE CAPTION</div> -->

@ -17,7 +17,7 @@ Including another URLconf
from django.contrib import admin
from django.urls import path, include
from call import views
from .views import Guestbook, CreatureList, creature_detail, creature_frame
from .views import Guestbook, CreatureList, creature_detail, creature_frame, call_block
urlpatterns = [
path("guestbook/", Guestbook.as_view(), name="guestbook"),
@ -26,5 +26,6 @@ urlpatterns = [
path("creatures/", CreatureList.as_view(), name="creature_list"),
path("creatures/<int:creature_id>/", creature_detail, name="creature_detail"),
path("creatures/<int:creature_id>/frame/", creature_frame, name="creature_frame"),
path("call/block/", call_block, name="call_block"),
path('', views.index)
]

@ -47,10 +47,19 @@ def creature_detail(request, creature_id):
context = {}
context['creature'] = get_object_or_404(Creature, pk=creature_id)
context['cell'] = int(request.GET.get("cell", "0"))
context['scale'] = int(request.GET.get("scale", "6"))
context['width'] = int(request.GET.get("width", "432"))
context['height'] = int(request.GET.get("height", "768"))
seed(creature_id)
context['bg_hue'] = randint(0, 360)
context['bg_sat'] = 100
context['bg_lightness'] = randint(50, 100)
# context['bg_hue'] = 0 # randint(0, 360)
# context['bg_sat'] = 0 # 100
# context['bg_lightness'] = 66 # randint(50, 100)
return render(request, "call/creature_detail.html", context)
def creature_frame (request, creature_id):
@ -59,7 +68,9 @@ def creature_frame (request, creature_id):
creature = get_object_or_404(Creature, pk=creature_id)
im = Image.open(creature.image.path)
response = HttpResponse(content_type="image/png")
scale = 6 # 24
scale = int(request.GET.get("scale", "6")) # 24
# limit from 1-100
scale = max(1, min(100, scale))
im = im.crop((16*cell, 0, (16*cell)+16, 16))
w, h = im.size
im = im.resize((w*scale,h*scale), resample=Image.NEAREST)
@ -68,3 +79,19 @@ def creature_frame (request, creature_id):
#im_with_background.paste(im, mask=im)
#im_with_background.save(response, "PNG")
return response
def call_block(request):
""" Call text for animation """
context = {}
context['width'] = int(request.GET.get("width", "432"))
context['height'] = int(request.GET.get("height", "768"))
# context['bg_hue'] = randint(0, 360)
# context['bg_sat'] = 100
# context['bg_lightness'] = randint(50, 100)
context['bg_hue'] = 0 # randint(0, 360)
context['bg_sat'] = 0 # 100
context['bg_lightness'] = 66 # randint(50, 100)
return render(request, "call/call_block.html", context)

Loading…
Cancel
Save