CAPITALS = Global coordinates
lowercase = relative coords
M x y: Move to
m x y: move to, relative to last position
L x y: Line to
l x y: line to, relative to last position
H x: Horizontal line to position x\
| import * as React from "react"; | |
| import { useMousePosition } from "~/hooks/useMousePosition"; | |
| /** Component to cover the area between the mouse cursor and the sub-menu, to allow moving cursor to lower parts of sub-menu without the sub-menu disappearing. */ | |
| export function MouseSafeArea(props: { parentRef: React.RefObject<HTMLDivElement> }) { | |
| const { x = 0, y = 0, height: h = 0, width: w = 0 } = props.parentRef.current?.getBoundingClientRect() || {}; | |
| const [mouseX, mouseY] = useMousePosition(); | |
| const positions = { x, y, h, w, mouseX, mouseY }; | |
| return ( | |
| <div |
| import SwiftUI | |
| struct CollapsibleDemoView: View { | |
| var body: some View { | |
| VStack(spacing: 10) { | |
| HStack { | |
| Text("Here we have some fancy text content. Could be whatever you imagine.") | |
| Spacer() | |
| } | |
| .padding(.bottom) |
| import SwiftUI | |
| struct Collapsible<Content: View>: View { | |
| @State var label: () -> Text | |
| @State var content: () -> Content | |
| @State private var collapsed: Bool = true | |
| var body: some View { | |
| VStack { |
| import SwiftUI | |
| struct EnumPicker<T: Hashable & CaseIterable, V: View>: View { | |
| @Binding var selected: T | |
| var title: String? = nil | |
| let mapping: (T) -> V | |
| var body: some View { |
| global.THREE = require("three"); | |
| const canvasSketch = require('canvas-sketch'); | |
| const Random = require('canvas-sketch-util/random'); | |
| const gradientHeight = 512; | |
| const settings = { | |
| dimensions: [ 2048, gradientHeight * 2 ] | |
| }; |
| const canvasSketch = require("canvas-sketch"); | |
| const { GUI } = require("dat.gui"); | |
| const data = { | |
| background: "#de6060", | |
| number: 0.35 | |
| }; | |
| const settings = { | |
| dimensions: [2048, 2048], |
This workshop encourages students to make use of npm modules to build complex and interesting artworks.
If you find a module you want to use, like riso-colors, you can install it from your project folder like so:
npm install riso-colors