0%

Box

Some contents related to Box

Display Property

  • Inline: Width and Height are ignored. Margin & Padding push elements away horizontally but not vertically.
  • Block: Block elements break the flow of a document. Width, Height, Margin, & Padding are respected.
  • Inline-Block: Behaved like an inline element except Width, Height, Margin, & Padding are respected.

Hide element

1
2
3
h1{
display: none;
}

CSS Unit Revisited

Relative

  • em
  • rem
  • vh
  • vw
  • %
  • and more!

Absolute

  • px
  • pt
  • cm
  • in
  • mm

em

font-size: em meanings relative value from its parent.
margin: em meanings relative value from itself(font-size).

One problem from em will be if you put em in a nested structure, let’s say a nested list, the factor will either grow or shrink dramatically.

rem

Root ems

Relative to the root html element‘s font-size. Often easier to work with. If the root font-size is 20px, 1 rem is always 20px, 2rem is always 40px, etc.


Reference

https://www.youtube.com/watch?v=_-aDOAMmDHI

https://www.canva.com/design/DAEANYqyik4/tdD7T7i698xhdPQUS_nrtQ/view?utm_content=DAEANYqyik4&utm_campaign=designshare&utm_medium=link&utm_source=sharebutton#6

1
2
3
h1, h2{
color: white;
}

The ID Selector

https://coolors.co/palettes/trending

1
2
3
4
#lagout{
color: orange;
height: 200px;
}

The class Selector

1
Puppies
1
2
3
.tag{
background-color: #e63946;
}

Descendant Selector

1
2
3
li a{
color: teal;
}

Adjacent Selector

1
2
3
h1 + p{
color: red;
}

Select only the paragraphs that are immidiately preceded by an <h1>

Direct Child

1
2
3
div > li{
color: white;
}

Select only the <li>‘s that are direct children of a <div> element

Attribute Selector

Select all input elements where the type attribute is set to “text”

1
2
3
4
input[type="text"]{
width: 300px;
color: yellow;
}
1
2
3
a[href*="google"]{
color: magenta;
}

class is one attribute, so as id.
href*=”google” - Fuzzier matching

PSEUDO classes

keyword added to a selector that specifies a special state of the selected element(s)

  • :active
  • :checked
  • :first
  • :first-child
  • :hover
  • :not()
  • :nth-child()
  • :nth-of-type()

https://developer.mozilla.org/en-US/docs/Web/CSS/:hover

PSEUDO ELEMENTS

Keyword added to a selector that lets you style a particular part of selected element(s)

  • ::after
  • ::before
  • ::first-letter
  • ::first-line
  • ::selection

SPECIFICITY

Specificity is how the brower decides which rules to apply when multiple rules could apply to the same element. It is a measure of how specific a given selector is. The more specific selector “wins”.

1
ID > Class > Element

How to calculate the importance

  • ID selector: 100
  • Class, Attribute, Pseudo-Class, Selectors: 10
  • Element, Pseudo-Element, Selectors: 1

The combination of the things above:

For example

1
2
3
nav a.active{
color: orange;
}

0*100+1*10+2*1

https://specificity.keegan.st/

!important tag is superb every calculation above.

CSS Inheritance

1
2
3
button{
color: inherit;
}

CSS - casading style sheet

What is it?

CSS is a language for describing how documents are presented visually - how they are arranged and styled

What does it stand for?

CSS stands for Cascading Style Sheets.

CSS RULES

  • (almost) everything you do in CSS follows this basic pattern

    1
    2
    3
    selector{
    property: value;
    }

Including Style Correctly

  • Inline Style: You can write your styles directly inline on each element, but this is NOT A GOOD IDEA most of the time.
  • The STYLE element: You can write your style inside of a <style> element. This is easy, but it makes it impossible to share styles between documents. Not recommended either
  • External stylesheet: Write your styles in a .css file, and then include the using a <link> in the head of your html document. Recommended!

Focusing on the third method,

my_styles.css

1
2
3
h2{
color: indianred;
}

Demo.html

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19






Document

Forms Demo





I am Jim
I am Cool



Demo

I am Jim

I am Cool

https://developer.mozilla.org/en-US/docs/Web/CSS/color_value

Color Systems: RGB and Named Colors

https://htmlcolorcodes.com/color-names/
https://htmlcolorcodes.com/color-picker/

A typical computer can display ~16000000 different colors

RGB

  • Red, Green, Blue Channel
  • Each channel ranges from 0-255
1
2
3
4
h2{
color: teal;
background-color: rgb(89, 151, 0);
}

Color Systems: Hexadecimal

Hex

  • Still red, green and blue channels
  • Each ranges from 0-255 BUT represented with hexadecimal

Hexadecimal

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F

1
16*16 = 256

so, the rgb becomes -> #0f5679

Common Text Properties

https://developer.mozilla.org/en-US/docs/Web/CSS/text-align
https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight
https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration
https://developer.mozilla.org/en-US/docs/Web/CSS/line-height

Font Size Basics With Pixels

Relative

  • EM
  • REM
  • VH
  • VW
  • %
  • AND MORE!

Absolute

  • PX
  • PT
  • CM
  • IN
  • MM

PX - BY FAR THE MOST COMMONLY USED ABSOLUTE UNIT

1px does not necessarily equal the width of exactly one pixel!
Not recommended for responsive website

The Font Family Property

https://www.cssfontstack.com/
https://developer.mozilla.org/en-US/docs/Web/CSS/font-family

HTML: Forms and Tables

Tables: TR, TD, and TH element

  • TR: The Table Row element
  • TD: The Table Data Cell element
  • TH: The Table Header element

TR: Table Row

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tr

TD: Table Data

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td

TH: Table Header

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th

Tables: Thead, Tbody and Tfoot Elements

Tables: Colspan and Rowspan

1
2
3
4
5
6
7
8


Name
ID
Membership Dates
Balance


Coding Excersice

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40






Document


Heaviset Bird



Subscription
Price
Support




Free
Free
N/A


Personal
$9.99
Weekdays


Business
$49.99
24/7




table>tr>td*5


The Form Element

Creating Forms

  • The <form> element itself is a shell of container that doesn’t have any visual impact.
  • We then fill the form with a collection of inputs, checkboxes, buttons, etc.

<form>

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form

  • The form element represents a document section containing interactive contorls for submitting information.
  • The action attribute specifies WHERE the form data should be sent
  • The method attribute specifies which HTTP method should be used

<input> Common Input Types

  • The input element is used to create a variety of different form controls
  • We have 20+ possible types of inputs ranging from data pickers to checkboxes.
  • The type attribute is where the magic happens. Changing type dramatically alters the input’s behavior and appearance
1
2
3
4
5
6
7







The All-important Label label

https://developer.mozilla.org/en-US/search?q=label

The HTML element represents a caption for an item in a user interface.


1
2
3
4
5
6
7
8
9

Do you like cheese?




Do you like peas?


Do you like cheese?

Do you like peas?


HTML Buttons

The <button> HTML element represents a clickable button, used to submit forms or anywhere in a document for accessible, standard button functionality.

By default, button hold a type="submit" but if you want the button do not submit a form, you can do <button type="button">

1
2
3

Add to favorites

alternative

1

The name Attribute

We should put it on every single input that you use and it will be used when you send your data to a server eventually.

NameAttributes

Note that the webpage url changed after submitting the form.

1
2
3
4
5
6
7
8
9
10
11
12


Search Reddit



Search google



Search youtube

Search Reddit

Search google

Search youtube

Radio Buttons, Checkboxes, & Selects

Checkboxes

1
2
3
4
5


I agree to everything
Submit

Radio Buttons

1
2
3
4
5
6
7
8

S:

M:

L:



S: M: L:


1
2
3
4
5
6
7
8

Please select an Entree

Fish
Steak
Orange


Please select an Entree Fish Steak Orange

Range & Text Area

Range

1
2
3
4
 
Amount of Cheese:


Amount of Cheese:

Text Area

1
2
3
4

Any Special Request?



Any Special Request?

What Exactly Is Html5

Living Standard

The HTML standard is a document that describes how HTML should work

Role of Browsers

The standard describes the rules of HTML, but browsers actaully have to do the work and implement HTML according to those rules.

HTML5

HTML5 is the lastest evolution of the standard that defines HTML. It includes new elements & features for browsers to implement.

Block vs Inline Elements

  • INLINE elements
  • BLOCK elements

: The Content Division element

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/span

Generic container
Div helps us the group the content together and style them all in once.

An Odd Assortment of Elements: HR, BR, Sup, Sub

1
2
3
4
-  : https://developer.mozilla.org/en-US/docs/Web/HTML/Element/hr
- : https://developer.mozilla.org/en-US/docs/Web/HTML/Element/br
- : https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sup
- : https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sub

Entity Code

https://dev.w3.org/html5/html-author/charref
https://www.w3schools.com/html/html_entities.asp

Some characters are reserved in HTML. If you use the less than (<) or greater than (>) signs in your text, the browser might mix them with tags. Character entities are used to display reserved characters in HTML.

Intro to Semantic Markup - MEANINGFUL markup

Semantic - relating to meaning

what purpose of role does that HTML element have?

Semantic Markup can organize your html code well, and also google can crawl your page easily.

Playing with Semantic Elements

main

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/main

The <main> HTML element represents the dominant content of the <body> of a document.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/nav

The <nav> HTML element represents a section of a page whose purpose is to provide navigation links, either within the current document or to other documents.

section

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/section

article

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/article

The <article> HTML element represents a self-contained composition in a document, page, application, or site, which is intended to be independently distributable or reusable (e.g., in syndication).

aside

https://developer.mozilla.org/en-US/search?q=aside

The <aside> HTML element represents a portion of a document whose content is only indirectly related to the document’s main content.

VSCode Tip: Emmet

https://docs.emmet.io/

https://docs.emmet.io/abbreviations/syntax/

For example

1
nav>ul>li + Tab

Emmet

Introduction to HTML

HTML is a Markup language

HTML was created to help describe the structure of the acedemic research papars and share they across the very early internet.

The goal of HTML is to take the text content and somehow mark it up with some structures.

HTML Elements

To write HTML, we pick from a set of standard Elements that all browsers recognize

Common Elmements includes:

1
2
-  element: represent a paragraph of text
-

Our Very First HTML Page

  1. Save your HTML file with the file extension [.html]
  2. After that you should be able view your web in local browser
1
2
DEVELOPING ON OMNIVERSE
NVIDIA Omniverse™ is a powerful multi-GPU real-time simulation and collaboration platform for 3D production pipelines based on Pixar's Universal Scene Description and NVIDIA RTX™technology.

1
2
DEVELOPING ON OMNIVERSE
NVIDIA Omniverse™ is a powerful multi-GPU real-time simulation and collaboration platform for 3D production pipelines based on Pixar's Universal Scene Description and NVIDIA RTX™technology.

Developer Resources

https://developer.mozilla.org/en-US/

HTML Tags

Fast Way to Type HTML Tags

For example:

Press ‘b’ then ‘Tab’ to autocomplete

Paragraph Tag

1
Something in between
  • Take a block of space

Heading Elements

1
2
3
4
5
6
- 
-
-
-
-
-

Chrome Inspector

Right click on the webpage select “Chrome Inspector” and then we can see the html instruction of the current showing web.

HTML Boilerplate

HTML SKELETON

We write our HTML in a standard “skeleton”

1
2
3
4
5
6
7
8
9
10
11




JimYuan



All the webpage contains


  • !DOCTYPE html is weird by not having the closing tab
  • Html element should have inside
    • head tag
    • body tag
  • Title is for the webpage name/ tab-name(Google use this tag element in the head to create the link in the search result)

Short cut for generate this skeleton

! + “Tab”

1
2
3
4
5
6
7
8
9
10
11
12






Document





Reference Resources

VSCode Tip: Auto-format

Ctrl + Shift + P + (searching “format”)

List Element

1
2
3
- unordered list 
- ordered list
- list item

The Anchor Element

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a

The HTML element (or anchor element), with its href attribute, creates a hyperlink to web pages, files, email addresses, locations in the same page, or anything else a URL can address.

You can reach Michael at:

* [Website](https://example.com) * [Email](mailto:m.bluth@example.com) * [Phone](tel:+123456789)

Image

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img

1

  • note that image tag don’t have closing tag

The alt attribute holds a text description of the image, which isn’t mandatory but is incredibly useful for accessibility.

Comment

The Shortcut In VScode

Toggle line comment

This is the note from The Web Developer Bootcamp on Udemy created by Colt Steele. I’ve always want to know more about web, and I think it might be a good idea to just follow this bootcamp a bit.

Link: https://www.udemy.com/course/the-web-developer-bootcamp/

The Internet In 5 Minutes

  • Routing: phyiscal machine to help you connet your computer to someone else.
  • My computer doesn’t need to know your computer at all
  • Internet -> Network of networks

HTTP requests

  • Foundation of communication on the World Wide Web
  • Hyper Text Transfer Protocol
  • Request -> I would like this information please
  • Responese -> Ok, here you go!

The Request/Response Cycle

A server somewhere(Here are the instructions) -INSTRUCTION-> your browser (Look what I made!)

You can right click on any webpage [View_Page_Source] to see the content of the Instrucstion from that server.

Front End/ Back End

  • Front End: Dining Place
  • Back End: Kitchen

What do HTML/CSS/JS do?

The

  • Purple [CSS_adj]
  • Dinosaur [HTML_noun]
  • Danced [JS_verbs]

https://codepen.io/

Physical Sitmalation

One big idea behind the physical simualtion is all the things inside computer is discrete. We should tranfer the smooth/ continuous real world into digit/ discrete/ finite computer language. Instead of having infinite elements(or atoms) in one rope, we are have finite amount of element.

rope

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
private void RunScript(bool reset, Point3d anchor0, Point3d anchor1, int nodeCount, double mass, Vector3d gravity, double stiffness, double friction, ref object P, ref object V, ref object C)
{
if(reset){
nodes.Clear();
vels.Clear();

Line line = new Line(anchor0, anchor1);
NurbsCurve lineCurve = line.ToNurbsCurve();

Point3d[] pts;
lineCurve.DivideByCount(nodeCount - 1, true, out pts);

nodes.AddRange(pts);

for (int i = 0; i < nodeCount; i++)
{
vels.Add(new Vector3d(0, 0, 0));
}
}

// Update the location of the anchors
nodes[0] = anchor0;
nodes[nodes.Count - 1] = anchor1;



// Simulation forces for each node
for (int i = 1; i < nodes.Count - 1; i++)
{
Point3d n = nodes[i];
Vector3d v = vels[i];

// Calculating all the forces
Vector3d gravityForce = mass * gravity;
Vector3d prevSpring = -stiffness * (n - nodes[i - 1]);
Vector3d nextSpring = -stiffness * (n - nodes[i + 1]);

// Aggregate all the forces
Vector3d totalForce = gravityForce + prevSpring + nextSpring;

// Update velocity
v += totalForce;

// Add friction
v *= friction;

// Update location of the node
n += v;

// Update values on the original lists
nodes[i] = n;
vels[i] = v;

}

P = nodes;
V = vels;
C = new Polyline(nodes);
}

//
List nodes = new List();
List vels = new List();
//

Intro

In grasshopper field, there’re some useful and famous plug-ins for phyiscal simulation. Just to mention a few, Kangaroo, Flexhopper,… and etc.
I always think it’s more fun to play around the modelling which mimic the realistic phyiscal behaviours. This post is for noting down some developers’ thoughts while developing the phyiscal simulation tools.

And again this amazing tutorial is from Professor. Jose.
Here’s the link:

https://www.youtube.com/watch?v=kG-AxzMPjxk&t=5311s

Also, one important concept before doing simulations would be iteration.

Iteration

Usually, the physic behaviors are related to time, meaning it’s a function of time.
In code, we need to make sure the result of previous round can be brought to the next round.
Might be seen something like this.

1
NextRound += PreviousRound;

Iteration In C# script Component

https://www.youtube.com/watch?v=ek2iL88WqGQ&t=497s
Professor Jose well explained the scope of the variables in C# script component, which is one of the vital ingredient before you do any simualtion related to time.

Code

Here I would like to share one of the example in this tutorial.
idea

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
private void RunScript(bool reset, Point3d anchorPoint, Point3d startPoint, double radius, Vector3d gravity, double stiffness, double friction, ref object L, ref object S, ref object P, ref object V)
{
//Algorithm
if(reset)
{
currentLocation = startPoint;
currentVelocity = Vector3d.Zero;
}

// Calculate all forces acting on the particle
Vector3d gravityForce = gravity;
Vector3d springForce = -stiffness * (currentLocation - anchorPoint);

Vector3d totalForces = gravityForce + springForce;

// Update the currentVelocity with all the acting forces
currentVelocity += totalForces;

// Damp down velocity a little assuming friction on the system
currentVelocity *= friction;

// Update the location based on the velocity
currentLocation += currentVelocity;

// Output
L = new Line(anchorPoint, currentLocation);
S = new Sphere(currentLocation, radius);
P = currentLocation;
V = currentVelocity;
}

//
Point3d currentLocation = Point3d.Unset;
Vector3d currentVelocity = Vector3d.Unset;

I just finished this quick introduction of JSON video, and it was so helpful.
Here is the link:
https://www.youtube.com/watch?v=iiADhChRriM&t=553s

Several things I would like to take away from this lesson:

The most important thing might be this one:

Everything in JSON is VALID in JavaScript


JaveScript Object Notation

  • Data Representation Format
  • Commonly Used for APIs and Configs
  • Lightweight and Easy to Read/Write
  • Integrate Easily With Most Language

JSON Types

  • Strings
  • Number
  • Booleans
  • null
  • Array
  • Object

Example

user.json
{
“name”: “Kyle”,
“favoriteNumber”: 3,
“isProgrammer”: true,
“hobbies”: [“Weight Lifting”, “Bowling”],
“friends”: [{
“name”: “Joey”,
“favoriteNumber”: 100,
“isProgrammer”: false,
“friends”: […]
}]
}

How to Parse from string to JSON

JSON.Parse(string)