User:Zuhui/SI26/Storybook
Progress
first sketch
Simple structure
- Using
display: flex
- Shrinking the browser window randomly removes words from the sentence, one by one, in correspondence with the reduced pixel count.
- Expanding the window brings words back, also at random, reconstructing the sentence into a new structure each time—never quite the same as before.
Peekaboo
In our last Monday class discussion(SI26 WEEK2) on display: flex
, we talked about its adaptability and how its mechanism resembles other design practices --like curtains or even a peacock’s majestic display.
Building on this, I started thinking about the game of Peekaboo.
- As the face disappears and reappears, its expression constantly shifts(🙂→🤪→🤨→😆→🙄).
- Similarly in my initial sketch of
display:flex
, the alignment of words in the sentence shifts as it disappears and reappears.- Expanding and shrinking the browser window can reveal, hide, reorder information, and creating compositions that change dynamically.
- Similarly in my initial sketch of
Do tigers melt like butter in the forest?
I want to try this exercise with a first sentence of question that I derived from a children’s book called The Story of Little Black Sambo published in UK 1899. Until not long ago, this book was quite popular in some countries like Korea and Japan and can still be found on bookshelves today. But for those familiar with it, it’s notoriously known for being blatantly racist due to its illustrations, its moronic backdrop, and the name of its characters.
Keeping this in mind, I find a kind of meta-ironic profundity in the story, completely independent of the author’s intention.
How I want to develop it
- I'm envisioning a kind of storybook that users can save the screens they like in the browser. once they're done, they can export them as a multi-paged pdf file containing all the screens they've saved in the browser. even print them out in the end.
- Inspired by The House of Dust by Alison Knowles, I imagined adding random words as the browser window extends, rather than simply re-aligning previous words in the sentence as I did on my initial sketch.
- This way, every time the user shrinks and then re-extends the browser window, a new word would subtly replace an old one--one at a time, gradually transforming the sentence with each interaction(of peekaboo).
Word-corresponding background illustration
Storybook in pdf
- A button that allows users to save the current state of the browser window --not to the local computer, but within the browser itself.
- Another button would then enable users to export these saved states as a PDF file, allowing them to print out each saved version of the browser window in chronological order.
To do
I should treat the continuously restructured sentences(the main prompter) not just as a block of text, but understand as a flexible, variable-based structure that logically aligns with CSS’s spatial and contextual interpretation.
The following analysis is needed:
- identify the basic structure and elements of the sentence
- define the possible combinatorial variables
- structure these combinatory variables in a way that CSS can correspond
- plus, I’d like to try incorporating the theatre metaphor from ‘Why CSS is so weird’ into the work:
- regarding the browser window as a stage and apply the sentence analysis and structure accordingly.
words | grammarly feature | semantic | stage role |
---|---|---|---|
do | auxiliary verb | check for action | ?? |
tigers | noun | agenct | object |
melt | verb | action | effect |
like | preposition | comparison standard | condition modifier? |
butter | noun | comparison target(object) | object |
in | preposition | spatial relationship | positioning |
the | determiner | - | - |
forest | noun | context | backdrop |
? | punctuation | sentence type | ?? |
drawing html/css structure
the main prompter p id="sentence"
html
<p id="sentence">
<span class="do">do</span>
<span class="tigers">tigers</span>
<span class="melt">melt</span>
<span class="like">like</span>
<span class="butter">butter</span>
<span class="in">in</span>
<span class="the">the</span>
<span class="forest">forest</span>
<span class="?">?</span>
</p>
css
#sentence {
position: fixed;
margin: 0;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
z-index: 999999999;
text-align: center;
font-size: 29px;
font-weight: bold;
font-family: Arial, sans-serif;
font-weight: bold;
color:rgb(0, 0, 0);
white-space: nowrap;
}
naked stage: div id="stage"
html
<div id="stage">
//all the children divs that goes onto the stage//
</div>
css
#stage {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
margin: 0;
z-index: -99999;
}
what goes onto the stage (child divs of id="stage")
html
using both data-* selector and class to target better in css and javascript
<div data-space="forest" class="forest"> //or, data-object="forest" for the occasion when forest becomes an object//
<div data-object="celestial" class="celestial"></div>
<div data-object="tigers" class="tigers"></div>
<div data-object="butter" class="butter"></div>
<div data-effect="melt" class="melt"></div>
</div>
css data-*selector
[data-space="forest"] {
top: 0;
left: 0;
width: 100vw;
height: 100vh;
margin: 0;
z-index: -99998;
background-color: green;
}
[data-object="forest"] {
width: 300px;
height: 300px;
margin: auto;
/*margin-top: 50%;*/
background-color: green;
}
[data-object="celestial"]{
}
[data-object="tiger"]{
}
[data-object="butter"]{
}
[data-effect="melt"]{
}
css .hide[data-*] for javascript to target
.hide[data-space]{
background-color: transparent;
background-image: none;
}
.hide[data-object]{
display:none;
}
.hide[data-effect]{
}
javascript 1
I made the first sketch by using an ai chatbot but I want to write javascript without it from the beginning. As Fred recommended, write down what needs to be done step by step and try to translate the logic into javascript language.
- 1. store all
span
element in a variable (I'm usingspan
underp
tag only for the words).
- 2. make another variable to store the (randomly)removed words.
- ↳ so that I can bring them back(randomly) whenever the screen size increases.
- 3. make javascript aware of the browser screen size changes, so the words respond accodringly.
- ↳ the words should disappear when the screen size decreases and reappear when it increases.
- ↳ look up
window.innerWidth
, I'm only going to decrease and increase the width.- ↳ look up
"resize"
function inwindow.addEventListner()
- ↳ need variables for screen size calculation. also look up
Math.-
methods.
- ↳ look up
- ↳ look up
- ↳ the words should disappear when the screen size decreases and reappear when it increases.
- 4. make two different functions, one for removing random words as the screen size decreases, and the other for bringing back random words as the screen size increases. it has to work with resize eventlistener.
- ↳ cap the minimal amount of word to at least 1, so the screen doesn't remove all the words.
- ↳ if word > 1, keep on removing the words, but if the word is == 1, then stop removing the words, and start bring the words back as the screen increases.
- ↳ cap the minimal amount of word to at least 1, so the screen doesn't remove all the words.
Resource
Javascript
- Classlist-add,remove,replace,toggle
- window.innerWidth (its unit is pixel)
- window.addEventListener "resize" mdn
Targeting
Word combination algorithm
- look for Permutation function
Storybook in pdf
recommended by Joseph
- try html2canvas for taking screenshot of the browser
- look for javascript: Window: localStorage property for storage. (this one stores locally, but try it anyway)
Reference
recommended by Joseph
- Little Blue and Little Yellow by Leo Lionni
- The Fable Game by Enzo Mari
- Autoprogettazione? by Enzo Mari
David Hockney stage designs