[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-96247":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":8,"htmlUrl":8,"language":9,"languages":8,"totalLinesOfCode":8,"stars":10,"forks":11,"watchers":12,"openIssues":13,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":14,"stars7d":14,"stars30d":14,"stars90d":14,"forks30d":14,"starsTrendScore":14,"compositeScore":15,"rankGlobal":8,"rankLanguage":8,"license":16,"archived":17,"fork":17,"defaultBranch":18,"hasWiki":19,"hasPages":17,"topics":20,"createdAt":8,"pushedAt":8,"updatedAt":21,"readmeContent":22,"aiSummary":23,"trendingCount":14,"starSnapshotCount":14,"syncStatus":24,"lastSyncTime":25,"discoverSource":26},96247,"DuoLikeAnimation","elijah-semyonov\u002FDuoLikeAnimation","elijah-semyonov",null,"Swift",125,29,117,1,0,41.43,"MIT License",false,"main",true,[],"2026-09-20 04:01:32","# DuoLikeAnimation\n\nAn iOS demo project that mimics the folding animation of the iPhone Duo using nothing but SwiftUI\nshaders and Core Motion. It shows how a Metal `layerEffect` fed with live device attitude can make a\nflat phone behave like one half of a folding device.\n\nThe effect turns the iPhone into a pane of frosted glass. Tilt the phone around its vertical axis and\nthe interface stays where it was in space, while the screen renders what you would see through a\ntilted, slightly cloudy window: reprojected by perspective, blurred and dimmed in proportion to how\nfar the glass has moved away from the interface, and black wherever a ray misses the interface\nentirely.\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"Docs\u002Fdemo.png\" alt=\"iPhone tilted to the right: the interface stays sharp at the hinge edge and turns into frosted glass toward the lifted edge\" width=\"420\">\n\u003C\u002Fp>\n\n## The model\n\n- The interface lives on a fixed plane in the world: the plane the screen occupied at zero tilt.\n- The viewer does not move. Their eye stays on that plane's normal through the screen center, at a\n  hand-held viewing distance (320 mm by default).\n- When the device tilts, the screen rotates around the edge that is farther from the viewer. That\n  edge stays in the interface plane; the rest of the glass rises toward the eye.\n- For every pixel the shader casts a ray from the eye through its position on the rotated glass and\n  continues it to the interface plane. It samples the interface there with a disk blur whose radius\n  grows with the gap between glass and plane, and dims the result by the same measure.\n\n## Layout\n\n| File | Role |\n| --- | --- |\n| `DuoLikeAnimation\u002FShaders\u002FDuoFold.metal` | The `layerEffect` shader: reprojection, blur, darkening. |\n| `DuoLikeAnimation\u002FFoldEffect.swift` | `.foldEffect(angle:parameters:)` and the tunables in `FoldParameters`. |\n| `DuoLikeAnimation\u002FFoldMotionModel.swift` | Core Motion: calibrated zero pose, tilt around the screen's Y axis, gyro prediction. |\n| `DuoLikeAnimation\u002FDemoContentView.swift` | The interface being looked at. |\n| `DuoLikeAnimation\u002FContentView.swift` | Composition plus a floating panel for recalibration and manual tilt. |\n\n## Running it\n\nOpen `DuoLikeAnimation.xcodeproj` and run on a device. The first motion sample becomes the zero-tilt\npose; the panel in the bottom-right corner lets you recalibrate or switch to a manual tilt slider.\n\nOn the simulator there is no motion data, so manual mode is on by default. A launch-time tilt can be\npassed for screenshots:\n\n```sh\nSIMCTL_CHILD_TILT_DEGREES=-20 xcrun simctl launch booted io.elijahsemyonov.DuoLikeAnimation\n```\n\n## Notes\n\n- Everything under the effect must be pure SwiftUI. UIKit-backed views such as `ScrollView` are not\n  rasterized into a shader layer, and the subtree has to be flattened with a compositing group first,\n  otherwise SwiftUI shades every leaf view on its own transparent layer.\n- The Core Motion rotation matrix convention is resolved at runtime against the gravity vector, so\n  the hinge lands on the correct side without depending on documentation.\n\n## Credits\n\nBuilt with [Claude Code](https:\u002F\u002Fclaude.com\u002Fclaude-code) using Claude Fable 5.1.\n\n### Prompt\n\n> It's a new wizard Xcode iOS project. The idea of this project is to demonstrate how SwiftUI shaders and core motion data can be used to mimic iPhone Duo folding animation. The essence of the effect is the following: whenever the phone tilts around axis colinear with UIKit screenspace Y axis, the following effect happens: the original image of UI stays in the plane that has zero tilt in this axis, and passing through the left or right edge of the phone and is farther from the person holding it. and the shader manipulates the image of the view with two effects: reprojecting it as if the screen is the window through which we look at the original UI sitting at this plane, and blurring it proportional to distance from the physical screen to the plane-aligned UI (for example using importance sampling on rough translucent surface), divergent raycast intersections must darken the resulting color. In physical terms - the device mimics frosted glass window through which we can see the original interface, that ignores the device physical rotation. The reprojected rays that miss the original UI are black. The estimated position of human eyes is around 30cm on the line orthogonal to zero-tilt plane. Your task is to implement this effect.\n\n## License\n\nMIT, see [LICENSE](LICENSE).\n","这是一个基于 SwiftUI 的 iOS 动效演示项目，通过 Metal 着色器与 Core Motion 实现类折叠屏（如 iPhone Duo 概念）的实时物理模拟动画。核心功能包括：利用设备姿态数据驱动屏幕绕竖直轴倾斜，结合射线投影、距离自适应高斯模糊与衰减着色，在平面上渲染出‘半透明玻璃窗’般的视差折叠效果；所有逻辑封装为可复用的 `.foldEffect` 修饰符。项目适用于需要沉浸式设备交互反馈的原型设计、UI 动效研究或折叠屏概念验证场景，要求纯 SwiftUI 视图树以确保着色器正确合成。",2,"2026-09-12 02:30:13","CREATED_QUERY"]