Chronstruct / primitives

MIT License
3 stars 0 forks source link

Content, Structure, and Interactions #19

Open kylpo opened 6 years ago

kylpo commented 6 years ago

OR Paint, Layout, and Events (user generated and system generated)

Primitives made up of content, structure, and interaction components.

Content: text is content, img is content.

divs are not

Structure: divs

Interaction: button, input, link

kylpo commented 5 years ago

The Container widget lets you create a rectangular visual element. A container can be decorated with a BoxDecoration, such as a background, a border, or a shadow. A Container can also have margins, padding, and constraints applied to its size. In addition, a Container can be transformed in three dimensional space using a matrix.

Introduction to widgets - Flutter

kylpo commented 5 years ago

Had no idea that primitives like <input> were using shadow-dom before shadow-dom was a thing. <input type="range"> is just a wrapper of multiple divs in a shadow-root.

https://bitsofco.de/what-is-the-shadow-dom/

So, really, button, input, are maybe not the base level of primitives. They can be considered a composite component. Maybe a "primitive" composite component?

kylpo commented 5 years ago

On that thought, link really is just interactable text with state for if it has been visited or not.

kylpo commented 5 years ago

Layout. E.g. Column and Row widgets which make it easy for us to align other widgets vertically or horizontally to each other. Painting. E.g. Text and Image widgets allow us to display (‘paint’) some content onto the screen. Hit-Testing. E.g. the GestureDetector allows us to recognise different gestures such as tapping (for detecting the press of a button) and dragging (for swiping through a list).

The Layer Cake – Flutter Community – Medium

kylpo commented 5 years ago

Word for component container that lays things out

Template

Setting

Structure -the arrangement of and relations between the parts or elements of something complex.

Arrangement

Compositor

Composition

Configuration (configurator, configurational)

Choreography (choreographer)

kylpo commented 5 years ago

There are several kinds of events, including touch events, motion events, remote-control events, and press events.

UIResponder

kylpo commented 5 years ago

UIView: Drawing and animation

Layout and subview management

Event handling

UIView - UIKit | Apple Developer Documentation

kylpo commented 5 years ago

layout, bounds, constraints, collision/hit detection of a rectangle-based layout when it is a circle or triangle?

Hit testing of drawings. Chapter 18. Touches

SpriteKit has a lot of affordances that specifically make creating games easier, such as the particle systems, physics system, collision callbacks, scene editor, gameplay loop, GameplayKit integration, etc.

There are some things it doesn't do really well, such as text rendering or displaying web content or laying out tabular data, so the UIKit animation stuff might be good for that narrow category of games which don't fall far from the typical UIKit conventions - A Dark Room would be an example - but for most traditional 2D games, SpriteKit will probably be a better choice.

Keep in mind that you can mix and match. You can have the main menu as a standard UIKit screen, and then the main gameplay driven by a SpriteKit scene in a SpriteKit view. So depending on the structure of your app, you can perhaps take advantage of the strengths of both approaches. reddit: the front page of the internet

There is nothing you can do about that if you're going to use simple-minded collisions (e.g. the built-in UIKit Dynamics - it does only rectangular view collisions). If you want advanced shape collisions, either you must implement them yourself or you must use Sprites. ios - Triangle UIView - Swift - Stack Overflow

kylpo commented 5 years ago

Content objects as just containers of paint/pixels, lines, etc. 2d coordinate system. Bounded and described as a rectangle.

Triangle in UIKit:

context.beginPath()
        context.move(to: CGPoint(x: rect.minX + _margin, y: rect.maxY - _margin))
        context.addLine(to: CGPoint(x: rect.maxX - _margin, y: rect.maxY - _margin))
        context.addLine(to: CGPoint(x: (rect.maxX / 2.0), y: rect.minY + _margin))
        context.closePath()

        context.setFillColor(_color.cgColor)
        context.fillPath()
kylpo commented 5 years ago

an image is paint (pixels), a line, a box, text is paint.

kylpo commented 5 years ago

"View" is just something in a box (rectangular coordinates) that can be interacted with. This is why you can onClick any web element.

smallest unit is a static pixel. But this isn't too helpful for a developer, so we instead are given lines, shapes, etc. Still only good for non-interactive content. So, we are given a higher abstraction: the View.

kylpo commented 5 years ago

Layout: question is what to do on overflow: wrap, scroll, cut off, zoom out, etc

kylpo commented 5 years ago

UIView takes care of many things including layout or handling touch events. It’s interesting to notice that it doesn’t directly take care of the drawing or animations, UIKit delegates that task to its brother: CoreAnimation.

CALayer Tutorial for iOS: Getting Started | raywenderlich.com

kylpo commented 5 years ago

Dominic Gannaway on Twitter: "It's way too early to say what we end up with. The experimental event API is a fork from the current "Plugin" based event system. The idea is that you use event components, like \<Press> to wrap parts of your UI that you want to provide events for.… https://t.co/XS0mvQYDBT"

Jared Palmer on Twitter: "React Flare looks🔥🔥🔥 “The idea is to extend React's event system to include high-level events that allow for consistent cross-device and cross-platform behavior.” —@necolas https://t.co/OYtER8xFfN" and [Umbrella] React Events · Issue #15257 · facebook/react related?

kylpo commented 12 months ago

Collection Describe the containment and grouping of things.

https://classnames.paulrobertlloyd.com/collection/