Categories
creative coding lab

Mini Project 7: Project B Website Draft

  • Project Title
    Journey
  • Link to your project
    link to my project:
    https://calistalu.github.io/project-b-draft/
    link to my code:
    https://github.com/calistalu/project-b-draft
  • Brief Description and Concept
    My project B is committed to exploring a journey of self-discovery, taking the form of interactive audio visualization.  In my design, the whole project is composed of two web pages: the first serves as the initial interface as well as a background introduction for the users; and I plan to put my p5 sketch in the second website, inviting users to an immersive experience of rhythmic visuals.
  • Demo/Visual Documentation

  • Coding

    document.addEventListener('DOMContentLoaded', function() {
    const endOfPage=document.getElementById('box5');
    const contactBtn=document.getElementById('contactBtn');
    contactBtn.addEventListener('click', function() {
    endOfPage.scrollIntoView({ behavior:'smooth' });
    });
    });

    This portion of the code is responsible for generating a contact button that functions as a page redirect, taking the user to the bottom of the webpage upon being clicked. I sought resources like W3Schools to learn the utilization of event listeners in JavaScript to achieve this specific functionality.

    window.addEventListener("scroll", function() {
    const scrolled=window.scrollY;
    console.log(scrolled/10)
    const translationX=scrolled;
    const translationY=scrolled;
    document.getElementById("box2").style.transform="translate("+translationX+"px, "+translationY+"px) ";
    });

    Originally, my goal was to animate a brown pole’s rotation while having a circular element slide down it as users scrolled through the page. However, controlling these behaviors precisely proved challenging. Consequently, I opted to simplify the design, keeping the circle moving down to the right as the webpage is scrolled.

    \.frame1 {
    font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;
    font-size: 30px;
    text-align: center;
    left: 25%;
    width: 50%;
    height: auto;
    padding: 20px;
    border-style: double;
    border-width: 6px;
    border-color: rgb(108, 95, 91);
    }
    
    .frame1 img {
    display: none;
    position: absolute;
    left: -300px;
    transform: translateY(-50%);
    width: 200px;
    height: 200px;
    }
    
    .frame1:hover img {
    display: block;
    }
    
    .frame1 img, .frame1 {
    transition: background-color 0.5s ease-out, transform 0.5s ease-out;
    }
    
    .frame1:hover{
    background-color: rgba(103, 114, 157,0.8);
    transform: rotate(5deg);
    }

    In the CSS section, I established interactive features for four distinct elements labeled “childhood, teenage, adulthood, old age.” The gif would appear when the mouse hovers over the specific bar, and disappear when mouse moves away through the use of pseudo classes, creating an engaging user experience. Initially, I assigned individual IDs to each bar, even though the interaction for the third bar is same as the first, as did the second and fourth bars. To enhance efficiency, I optimized the code by consolidating the shared interactions among bars into a single CSS class, retaining the IDs for defining their absolute positions. This approach reduced redundancy and greatly shortened the code.

  • Reflection
    1. Well-organized File Names make it easier to understand the purpose of each file, reducing confusion and the risk of misinterpreting file functionalities.2. I would use classes when multiple elements share similar style or behavior. They allow the application of the same styles to multiple elements without repeating code. Ids would be more commonly used, for in most cases an element has a distinct style or functionality that is specific on the page.

    3. I’m concerned about potential variations in the layout of my website across different devices since I haven’t utilized absolute positioning for all elements.”

    4. WYSIWYG Text Editor offers a visual, user-friendly interface for text editing and styling. It’s intuitive for those unfamiliar with coding, while HTML provides direct control over content structure and formatting.

    5. HTML/CSS defines the structure, content, and layout of web pages. JavaScript and p5.js enable interactive design, animations, and dynamic behaviors on web pages.

Leave a Reply

Your email address will not be published. Required fields are marked *