Compare commits
17 Commits
Author | SHA1 | Date |
---|---|---|
km0 | 85087c9f56 | 6 months ago |
km0 | d9483f63b2 | 6 months ago |
km0 | 1c7b0deea3 | 3 years ago |
km0 | 758440312a | 3 years ago |
km0 | 6649bb23cd | 3 years ago |
km0 | 45efc91428 | 3 years ago |
km0 | 325fe7e332 | 3 years ago |
km0 | 0767c14eea | 3 years ago |
km0 | 3c95e10fd8 | 3 years ago |
km0 | 82326e203a | 3 years ago |
km0 | cb8e7b5110 | 3 years ago |
km0 | d28556aacb | 3 years ago |
km0 | 2d86221fa0 | 3 years ago |
km0 | 7a66713859 | 3 years ago |
km0 | f5c3d84bd5 | 3 years ago |
km0 | 276be13ffb | 3 years ago |
km0 | 92d027e9a1 | 3 years ago |
@ -0,0 +1,57 @@
|
|||||||
|
# Xquisite Branch
|
||||||
|
|
||||||
|
A branching version of the [exquisite corpse](https://en.wikipedia.org/wiki/Exquisite_corpse) game. A drawing app developed for [SI17](https://issue.xpub.nl/17/).
|
||||||
|
|
||||||
|
Draw something, upload it and send the link to someone else: they will continue from your drawing. But wait! There's a catch!!!!! If you send to just one person the chain will continue linearly, but send it to more people and things will start branching in different directions.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
Clone the repository.
|
||||||
|
```
|
||||||
|
git clone https://git.xpub.nl/kamo/exquisite-branch.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Create a virtual environment.
|
||||||
|
```
|
||||||
|
python3 -m venv venv
|
||||||
|
```
|
||||||
|
|
||||||
|
Install the requirements with `pip` and the `requirements.txt` file.
|
||||||
|
```
|
||||||
|
pip install -r requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
Create an `.env` file in the root folder of the project with the following variables:
|
||||||
|
```
|
||||||
|
DEBUG=True
|
||||||
|
FLASK_ENV=development
|
||||||
|
FLASK_APP=exquisite_branch
|
||||||
|
```
|
||||||
|
|
||||||
|
Before running the app for the first time, be sure to initialize the database. __Watch out:__ this will delete the previous instance of the database along with its contents!
|
||||||
|
```
|
||||||
|
flask init-db
|
||||||
|
```
|
||||||
|
After initializing the database you can run the flask application
|
||||||
|
```
|
||||||
|
flask run
|
||||||
|
```
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
_Xquisite Branch_ saves contents in a database, and join them together in a branching version of the exquisite corpse.
|
||||||
|
|
||||||
|
The original exquisite corpse data structure is something similar to a linked list, where every drawing is connected to the previous one. Contents in _Xquisite Branch_ are saved in a database with the same principle.
|
||||||
|
|
||||||
|
Each entry in the database has the following properties:
|
||||||
|
|
||||||
|
- `id`: a unique identifier for every entry
|
||||||
|
- `branch`: a random name for the excerpt
|
||||||
|
- `parent`: the random name of the previous excerpt
|
||||||
|
- `content`: the actual content of the writings
|
||||||
|
- `username`: the author of the excerpt
|
||||||
|
|
||||||
|
When generating the display page, every entry look up its `parent` property to position itself after that.
|
||||||
|
|
||||||
|
Mhh should rewrite this better bc is super convoluted ahah.
|
||||||
|
|
@ -0,0 +1,52 @@
|
|||||||
|
|
||||||
|
.container{
|
||||||
|
display: block;
|
||||||
|
padding: 2000px;
|
||||||
|
}
|
||||||
|
.streams {
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: hidden;
|
||||||
|
position: relative;
|
||||||
|
width: 500px;
|
||||||
|
height: 500px;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stream {
|
||||||
|
white-space: nowrap;
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
width: 500px;
|
||||||
|
height: 500px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.svg-container {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
display: inline-block;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.author {
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
bottom: 50px;
|
||||||
|
font-size: 1rem;
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.branches {
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.branch {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.branch svg {
|
||||||
|
border-top: 1px solid currentColor;
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Exquisite Branch</title>
|
||||||
|
<link rel="stylesheet" href="${url_for('static', filename='css/variables.css')}" />
|
||||||
|
<link rel="stylesheet" href="${url_for('static', filename='css/global.css')}" />
|
||||||
|
|
||||||
|
<%block name='head' %></%block>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<nav>
|
||||||
|
<%block name='nav' >
|
||||||
|
<a href="${url_for('home.home')}">Home</a>
|
||||||
|
<a href="${url_for('display.display')}">Results</a>
|
||||||
|
</%block>
|
||||||
|
</nav>
|
||||||
|
${self.body()}
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,46 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<%inherit file="base_mako.html" />
|
||||||
|
|
||||||
|
|
||||||
|
<%block name="head">
|
||||||
|
<link rel="stylesheet" href="${url_for('static', filename='css/display_mako.css')}">
|
||||||
|
</%block>
|
||||||
|
|
||||||
|
|
||||||
|
<main class="container">
|
||||||
|
|
||||||
|
|
||||||
|
<% from random import random %>
|
||||||
|
<% from collections import defaultdict %>
|
||||||
|
<% transform = {'NEW': ''} %>
|
||||||
|
<% visited = defaultdict(int) %>
|
||||||
|
|
||||||
|
<div class="stream">
|
||||||
|
|
||||||
|
% for branch in branches:
|
||||||
|
|
||||||
|
|
||||||
|
<% visited[branch['parent']] += 1 %>
|
||||||
|
|
||||||
|
|
||||||
|
% if visited[branch['parent']] > 1:
|
||||||
|
<% steer = (random() - 0.5) * 0.25 %>
|
||||||
|
% else:
|
||||||
|
<% steer = 0 %>
|
||||||
|
% endif
|
||||||
|
|
||||||
|
|
||||||
|
<% transform[branch['branch']] = f'{transform[branch["parent"]]} rotate({random() * 0.04 + steer}turn) translateX(100%)' %>
|
||||||
|
|
||||||
|
<div class="svg-container" style="transform: ${transform[branch['parent']]}">
|
||||||
|
<a href="${url_for('draw.draw', parent=branch['branch'], _external=True, _scheme='https')}" target="__blank">
|
||||||
|
${branch['content']}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
% endfor
|
||||||
|
</div>
|
||||||
|
</main>
|
@ -0,0 +1,18 @@
|
|||||||
|
<%inherit file="base_mako.html" />
|
||||||
|
|
||||||
|
<%block name="head">
|
||||||
|
<link rel="stylesheet" href="${url_for('static', filename='css/display_mako.css')}">
|
||||||
|
</%block>
|
||||||
|
|
||||||
|
<% from random import random %>
|
||||||
|
<% offset = 1 / (len(streams) + 1)%>
|
||||||
|
|
||||||
|
% for stream in streams:
|
||||||
|
<div class="stream">
|
||||||
|
<% transform = f'rotate({offset * loop.index}turn) translateX(100%) ' %>
|
||||||
|
% for branch in stream:
|
||||||
|
<% transform = transform + ' rotate(' + str((random() * 2 - 1) * 0.02) + 'turn) translateX(100%)'%>
|
||||||
|
<div class="svg-container" style="transform: ${transform}">${branch['content']}</div>
|
||||||
|
% endfor
|
||||||
|
</div>
|
||||||
|
% endfor
|
@ -0,0 +1,15 @@
|
|||||||
|
autopep8==1.6.0
|
||||||
|
click==8.0.3
|
||||||
|
colorama==0.4.4
|
||||||
|
-e git+https://git.xpub.nl/kamo/exquisite-branch.git@ae185baf0c048ac5f9171314ea5e842362b99dcd#egg=exquisite_branch
|
||||||
|
Flask==2.0.2
|
||||||
|
Flask-Mako==0.4
|
||||||
|
itsdangerous==2.0.1
|
||||||
|
Jinja2==3.0.3
|
||||||
|
Mako==1.2.0
|
||||||
|
MarkupSafe==2.0.1
|
||||||
|
pycodestyle==2.8.0
|
||||||
|
python-dotenv==0.19.2
|
||||||
|
shortuuid==1.0.8
|
||||||
|
toml==0.10.2
|
||||||
|
Werkzeug==2.0.3
|
Loading…
Reference in New Issue