

import SwiftUI | |
// MARK: - Model | |
@MainActor | |
@Observable | |
final class Model { | |
var angles: [[Angle]] | |
init(row: Int, column: Int) { | |
angles = (0..<row).map { _ in |
import React, { useState } from 'react'; | |
import { Pressable, View } from 'react-native'; | |
import Animated, { css } from 'react-native-reanimated'; | |
export default function Wave() { | |
const [clickLocation, setClickLocation] = useState({ x: -1, y: -1 }); | |
const dots = Array.from({ length: 323 }); | |
const size = 19; | |
const color = `rgb(${Math.random() * 255}, ${Math.random() * 255}, ${Math.random() * 255})` |
import SwiftUI | |
struct ContentView: View { | |
@State var start = Date() | |
var body: some View { | |
TimelineView(.animation) { context in | |
let time = context.date.timeIntervalSince(start) / 120 | |
let rotation = 0.8 + 0.2 * abs((cos(.pi * time) + 1.0) / 2.0) | |
Canvas { context, size in |
import SwiftUI | |
// MARK: - Model | |
@MainActor | |
@Observable | |
final class Model { | |
var rotations: [[Int]] | |
init(row: Int, column: Int) { | |
rotations = (0..<row).map { _ in |
import SwiftUI | |
struct ContentView: View { | |
@StateObject private var viewModel = RectsViewModel() | |
var body: some View { | |
GeometryReader { geometry in | |
TimelineView(.animation) { timeline in | |
Canvas {context, size in | |
let rects = viewModel.rects |
import SwiftUI | |
#Preview { | |
@Previewable @State var value: Double = 3.0 | |
VStack { | |
SampleView() | |
.environment(\.dynamicTypeSize, .allCases[Int(value)]) | |
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .trailing) | |
.contentTransition(.numericText()) | |
Text("\(DynamicTypeSize.allCases[Int(value)])") |
import SwiftUI | |
struct ContentView: View { | |
@Environment(\.colorScheme) var scheme | |
private let date = Date() | |
private let colors = [Color.green, .pink, .blue, .orange, .purple] | |
private let titles = ["NEON", "GLOW", "LIGHT", "SHINE", "BRIGHT"] | |
var body: some View { | |
TimelineView(.animation) { context in |