gl-transitions 1.74.0 → 1.76.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (389) hide show
  1. package/README.md +78 -0
  2. package/compatibility.json +2070 -0
  3. package/glsl3/AdvancedMosaic.glsl +21 -0
  4. package/glsl3/BlockDissolve.glsl +16 -0
  5. package/glsl3/BookFlip.glsl +37 -0
  6. package/glsl3/Bounce.glsl +35 -0
  7. package/glsl3/BowTieHorizontal.glsl +123 -0
  8. package/glsl3/BowTieVertical.glsl +117 -0
  9. package/glsl3/BowTieWithParameter.glsl +74 -0
  10. package/glsl3/Box.glsl +33 -0
  11. package/glsl3/ButterflyWaveScrawler.glsl +33 -0
  12. package/glsl3/CircleCrop.glsl +20 -0
  13. package/glsl3/ColourDistance.glsl +19 -0
  14. package/glsl3/CrazyParametricFun.glsl +20 -0
  15. package/glsl3/CrossZoom.glsl +68 -0
  16. package/glsl3/DefocusBlur.glsl +47 -0
  17. package/glsl3/Directional.glsl +18 -0
  18. package/glsl3/DirectionalScaled.glsl +35 -0
  19. package/glsl3/DoomScreenTransition.glsl +62 -0
  20. package/glsl3/Dreamy.glsl +14 -0
  21. package/glsl3/DreamyZoom.glsl +43 -0
  22. package/glsl3/Drop_Zone_Flicker.glsl +159 -0
  23. package/glsl3/EdgeTransition.glsl +50 -0
  24. package/glsl3/FilmBurn.glsl +63 -0
  25. package/glsl3/Fold.glsl +12 -0
  26. package/glsl3/GlitchDisplace.glsl +78 -0
  27. package/glsl3/GlitchMemories.glsl +17 -0
  28. package/glsl3/GridFlip.glsl +77 -0
  29. package/glsl3/HSVfade.glsl +29 -0
  30. package/glsl3/HorizontalClose.glsl +16 -0
  31. package/glsl3/HorizontalOpen.glsl +18 -0
  32. package/glsl3/InvertedPageCurl.glsl +228 -0
  33. package/glsl3/LeftRight.glsl +28 -0
  34. package/glsl3/LinearBlur.glsl +30 -0
  35. package/glsl3/Mosaic.glsl +45 -0
  36. package/glsl3/Overexposure.glsl +25 -0
  37. package/glsl3/PolkaDotsCurtain.glsl +14 -0
  38. package/glsl3/PuzzleRight.glsl +57 -0
  39. package/glsl3/Radial.glsl +19 -0
  40. package/glsl3/Rectangle.glsl +29 -0
  41. package/glsl3/RectangleCrop.glsl +30 -0
  42. package/glsl3/Revolve_Left.glsl +98 -0
  43. package/glsl3/Rolls.glsl +42 -0
  44. package/glsl3/RotateScaleVanish.glsl +42 -0
  45. package/glsl3/SimpleFlip.glsl +14 -0
  46. package/glsl3/SimpleZoom.glsl +20 -0
  47. package/glsl3/SimpleZoomOut.glsl +23 -0
  48. package/glsl3/Slides.glsl +41 -0
  49. package/glsl3/StarWipe.glsl +51 -0
  50. package/glsl3/StaticFade.glsl +47 -0
  51. package/glsl3/StereoViewer.glsl +214 -0
  52. package/glsl3/StripDatamoshGlitch.glsl +187 -0
  53. package/glsl3/Swirl.glsl +34 -0
  54. package/glsl3/TVStatic.glsl +29 -0
  55. package/glsl3/TilesWave.glsl +63 -0
  56. package/glsl3/TopBottom.glsl +27 -0
  57. package/glsl3/VerticalClose.glsl +16 -0
  58. package/glsl3/VerticalOpen.glsl +17 -0
  59. package/glsl3/WaterDrop.glsl +21 -0
  60. package/glsl3/ZoomInCircles.glsl +40 -0
  61. package/glsl3/ZoomLeftWipe.glsl +36 -0
  62. package/glsl3/ZoomRigthWipe.glsl +36 -0
  63. package/glsl3/angular.glsl +25 -0
  64. package/glsl3/burn.glsl +14 -0
  65. package/glsl3/burn0.glsl +55 -0
  66. package/glsl3/cannabisleaf.glsl +18 -0
  67. package/glsl3/chessboard.glsl +28 -0
  68. package/glsl3/circle.glsl +24 -0
  69. package/glsl3/circleopen.glsl +18 -0
  70. package/glsl3/colorphase.glsl +19 -0
  71. package/glsl3/coord-from-in.glsl +18 -0
  72. package/glsl3/crosshatch.glsl +20 -0
  73. package/glsl3/crosswarp.glsl +10 -0
  74. package/glsl3/cube.glsl +71 -0
  75. package/glsl3/directional-easing.glsl +19 -0
  76. package/glsl3/directionalwarp.glsl +20 -0
  77. package/glsl3/directionalwipe.glsl +22 -0
  78. package/glsl3/displacement.glsl +26 -0
  79. package/glsl3/dissolve.glsl +54 -0
  80. package/glsl3/doorway.glsl +55 -0
  81. package/glsl3/fade.glsl +13 -0
  82. package/glsl3/fadecolor.glsl +15 -0
  83. package/glsl3/fadegrayscale.glsl +21 -0
  84. package/glsl3/flyeye.glsl +20 -0
  85. package/glsl3/fragment.glsl +54 -0
  86. package/glsl3/heart.glsl +19 -0
  87. package/glsl3/hexagonalize.glsl +78 -0
  88. package/glsl3/kaleidoscope.glsl +25 -0
  89. package/glsl3/luma.glsl +15 -0
  90. package/glsl3/luminance_melt.glsl +131 -0
  91. package/glsl3/morph.glsl +20 -0
  92. package/glsl3/mosaic_transition.glsl +20 -0
  93. package/glsl3/multiply_blend.glsl +19 -0
  94. package/glsl3/old_tv_lost_signal.glsl +51 -0
  95. package/glsl3/parametric_glitch.glsl +29 -0
  96. package/glsl3/perlin.glsl +66 -0
  97. package/glsl3/pinwheel.glsl +20 -0
  98. package/glsl3/pixelize.glsl +21 -0
  99. package/glsl3/polar_function.glsl +24 -0
  100. package/glsl3/powerKaleido.glsl +57 -0
  101. package/glsl3/randomNoisex.glsl +15 -0
  102. package/glsl3/randomsquares.glsl +20 -0
  103. package/glsl3/ripple.glsl +20 -0
  104. package/glsl3/rotateTransition.glsl +22 -0
  105. package/glsl3/rotate_scale_fade.glsl +39 -0
  106. package/glsl3/scale-in.glsl +18 -0
  107. package/glsl3/splitSlideInHorizontal.glsl +26 -0
  108. package/glsl3/splitSlideInOutHorizontal.glsl +23 -0
  109. package/glsl3/splitSlideInOutVertical.glsl +23 -0
  110. package/glsl3/splitSlideInVertical.glsl +24 -0
  111. package/glsl3/splitSlideOutHorizontal.glsl +22 -0
  112. package/glsl3/splitSlideOutVertical.glsl +22 -0
  113. package/glsl3/squareswire.glsl +26 -0
  114. package/glsl3/squeeze.glsl +23 -0
  115. package/glsl3/static_wipe.glsl +39 -0
  116. package/glsl3/swap.glsl +64 -0
  117. package/glsl3/tangentMotionBlur.glsl +139 -0
  118. package/glsl3/undulatingBurnOut.glsl +56 -0
  119. package/glsl3/wind.glsl +25 -0
  120. package/glsl3/windowblinds.glsl +18 -0
  121. package/glsl3/windowslice.glsl +16 -0
  122. package/glsl3/wipeDown.glsl +12 -0
  123. package/glsl3/wipeLeft.glsl +12 -0
  124. package/glsl3/wipeRight.glsl +12 -0
  125. package/glsl3/wipeUp.glsl +12 -0
  126. package/glsl3/x_axis_translation.glsl +21 -0
  127. package/glsl3/zoomInOut.glsl +20 -0
  128. package/index.d.ts +61 -0
  129. package/layouts.json +2956 -0
  130. package/llms-full.txt +1707 -0
  131. package/llms.txt +153 -0
  132. package/msl/AdvancedMosaic.metal +136 -0
  133. package/msl/BlockDissolve.metal +108 -0
  134. package/msl/BookFlip.metal +191 -0
  135. package/msl/Bounce.metal +128 -0
  136. package/msl/BowTieHorizontal.metal +375 -0
  137. package/msl/BowTieVertical.metal +375 -0
  138. package/msl/BowTieWithParameter.metal +361 -0
  139. package/msl/Box.metal +204 -0
  140. package/msl/ButterflyWaveScrawler.metal +190 -0
  141. package/msl/CircleCrop.metal +117 -0
  142. package/msl/ColourDistance.metal +110 -0
  143. package/msl/CrazyParametricFun.metal +139 -0
  144. package/msl/CrossZoom.metal +274 -0
  145. package/msl/DefocusBlur.metal +297 -0
  146. package/msl/Directional.metal +107 -0
  147. package/msl/DirectionalScaled.metal +147 -0
  148. package/msl/DoomScreenTransition.metal +212 -0
  149. package/msl/Dreamy.metal +133 -0
  150. package/msl/DreamyZoom.metal +182 -0
  151. package/msl/Drop_Zone_Flicker.metal +561 -0
  152. package/msl/EdgeTransition.metal +277 -0
  153. package/msl/FilmBurn.metal +425 -0
  154. package/msl/Fold.metal +110 -0
  155. package/msl/GlitchDisplace.metal +374 -0
  156. package/msl/GlitchMemories.metal +146 -0
  157. package/msl/GridFlip.metal +285 -0
  158. package/msl/HSVfade.metal +161 -0
  159. package/msl/HorizontalClose.metal +100 -0
  160. package/msl/HorizontalOpen.metal +103 -0
  161. package/msl/InvertedPageCurl.metal +762 -0
  162. package/msl/LeftRight.metal +138 -0
  163. package/msl/LinearBlur.metal +169 -0
  164. package/msl/Mosaic.metal +212 -0
  165. package/msl/Overexposure.metal +130 -0
  166. package/msl/PolkaDotsCurtain.metal +112 -0
  167. package/msl/PuzzleRight.metal +262 -0
  168. package/msl/Radial.metal +102 -0
  169. package/msl/Rectangle.metal +129 -0
  170. package/msl/RectangleCrop.metal +127 -0
  171. package/msl/Revolve_Left.metal +363 -0
  172. package/msl/Rolls.metal +209 -0
  173. package/msl/RotateScaleVanish.metal +227 -0
  174. package/msl/SimpleFlip.metal +110 -0
  175. package/msl/SimpleZoom.metal +116 -0
  176. package/msl/SimpleZoomOut.metal +127 -0
  177. package/msl/Slides.metal +244 -0
  178. package/msl/StarWipe.metal +204 -0
  179. package/msl/StaticFade.metal +193 -0
  180. package/msl/StereoViewer.metal +707 -0
  181. package/msl/StripDatamoshGlitch.metal +828 -0
  182. package/msl/Swirl.metal +152 -0
  183. package/msl/TVStatic.metal +136 -0
  184. package/msl/TilesWave.metal +290 -0
  185. package/msl/TopBottom.metal +138 -0
  186. package/msl/VerticalClose.metal +100 -0
  187. package/msl/VerticalOpen.metal +103 -0
  188. package/msl/WaterDrop.metal +126 -0
  189. package/msl/ZoomInCircles.metal +169 -0
  190. package/msl/ZoomLeftWipe.metal +152 -0
  191. package/msl/ZoomRigthWipe.metal +152 -0
  192. package/msl/angular.metal +111 -0
  193. package/msl/burn.metal +103 -0
  194. package/msl/burn0.metal +236 -0
  195. package/msl/cannabisleaf.metal +120 -0
  196. package/msl/chessboard.metal +144 -0
  197. package/msl/circle.metal +115 -0
  198. package/msl/circleopen.metal +124 -0
  199. package/msl/colorphase.metal +106 -0
  200. package/msl/coord-from-in.metal +111 -0
  201. package/msl/crosshatch.metal +126 -0
  202. package/msl/crosswarp.metal +103 -0
  203. package/msl/cube.metal +259 -0
  204. package/msl/directional-easing.metal +111 -0
  205. package/msl/directionalwarp.metal +121 -0
  206. package/msl/directionalwipe.metal +120 -0
  207. package/msl/displacement.metal +129 -0
  208. package/msl/dissolve.metal +146 -0
  209. package/msl/doorway.metal +210 -0
  210. package/msl/fade.metal +95 -0
  211. package/msl/fadecolor.metal +104 -0
  212. package/msl/fadegrayscale.metal +123 -0
  213. package/msl/flyeye.metal +133 -0
  214. package/msl/fragment.metal +276 -0
  215. package/msl/heart.metal +134 -0
  216. package/msl/hexagonalize.metal +274 -0
  217. package/msl/kaleidoscope.metal +157 -0
  218. package/msl/luma.metal +113 -0
  219. package/msl/luminance_melt.metal +337 -0
  220. package/msl/morph.metal +131 -0
  221. package/msl/mosaic_transition.metal +137 -0
  222. package/msl/multiply_blend.metal +127 -0
  223. package/msl/old_tv_lost_signal.metal +172 -0
  224. package/msl/parametric_glitch.metal +152 -0
  225. package/msl/perlin.metal +206 -0
  226. package/msl/pinwheel.metal +112 -0
  227. package/msl/pixelize.metal +134 -0
  228. package/msl/polar_function.metal +116 -0
  229. package/msl/powerKaleido.metal +304 -0
  230. package/msl/randomNoisex.metal +115 -0
  231. package/msl/randomsquares.metal +118 -0
  232. package/msl/ripple.metal +113 -0
  233. package/msl/rotateTransition.metal +116 -0
  234. package/msl/rotate_scale_fade.metal +167 -0
  235. package/msl/scale-in.metal +111 -0
  236. package/msl/splitSlideInHorizontal.metal +147 -0
  237. package/msl/splitSlideInOutHorizontal.metal +138 -0
  238. package/msl/splitSlideInOutVertical.metal +138 -0
  239. package/msl/splitSlideInVertical.metal +144 -0
  240. package/msl/splitSlideOutHorizontal.metal +131 -0
  241. package/msl/splitSlideOutVertical.metal +131 -0
  242. package/msl/squareswire.metal +144 -0
  243. package/msl/squeeze.metal +133 -0
  244. package/msl/static_wipe.metal +147 -0
  245. package/msl/swap.metal +256 -0
  246. package/msl/tangentMotionBlur.metal +583 -0
  247. package/msl/undulatingBurnOut.metal +217 -0
  248. package/msl/wind.metal +131 -0
  249. package/msl/windowblinds.metal +107 -0
  250. package/msl/windowslice.metal +108 -0
  251. package/msl/wipeDown.metal +105 -0
  252. package/msl/wipeLeft.metal +105 -0
  253. package/msl/wipeRight.metal +105 -0
  254. package/msl/wipeUp.metal +105 -0
  255. package/msl/x_axis_translation.metal +110 -0
  256. package/msl/zoomInOut.metal +125 -0
  257. package/package.json +1 -1
  258. package/skills/gl-transitions/SKILL.md +46 -0
  259. package/skills/gl-transitions/references/catalog.md +224 -0
  260. package/skills/gl-transitions/references/skia.md +118 -0
  261. package/skills/gl-transitions/references/video.md +71 -0
  262. package/skills/gl-transitions/references/webgl.md +122 -0
  263. package/sksl/index.d.ts +4 -0
  264. package/sksl/index.js +1 -0
  265. package/wgsl/AdvancedMosaic.wgsl +108 -0
  266. package/wgsl/BlockDissolve.wgsl +78 -0
  267. package/wgsl/BookFlip.wgsl +157 -0
  268. package/wgsl/Bounce.wgsl +98 -0
  269. package/wgsl/BowTieHorizontal.wgsl +331 -0
  270. package/wgsl/BowTieVertical.wgsl +331 -0
  271. package/wgsl/BowTieWithParameter.wgsl +313 -0
  272. package/wgsl/Box.wgsl +176 -0
  273. package/wgsl/ButterflyWaveScrawler.wgsl +158 -0
  274. package/wgsl/CircleCrop.wgsl +88 -0
  275. package/wgsl/ColourDistance.wgsl +82 -0
  276. package/wgsl/CrazyParametricFun.wgsl +111 -0
  277. package/wgsl/CrossZoom.wgsl +219 -0
  278. package/wgsl/DefocusBlur.wgsl +269 -0
  279. package/wgsl/Directional.wgsl +79 -0
  280. package/wgsl/DirectionalScaled.wgsl +117 -0
  281. package/wgsl/DoomScreenTransition.wgsl +171 -0
  282. package/wgsl/Dreamy.wgsl +102 -0
  283. package/wgsl/DreamyZoom.wgsl +154 -0
  284. package/wgsl/Drop_Zone_Flicker.wgsl +513 -0
  285. package/wgsl/EdgeTransition.wgsl +216 -0
  286. package/wgsl/FilmBurn.wgsl +361 -0
  287. package/wgsl/Fold.wgsl +82 -0
  288. package/wgsl/GlitchDisplace.wgsl +327 -0
  289. package/wgsl/GlitchMemories.wgsl +118 -0
  290. package/wgsl/GridFlip.wgsl +250 -0
  291. package/wgsl/HSVfade.wgsl +131 -0
  292. package/wgsl/HorizontalClose.wgsl +72 -0
  293. package/wgsl/HorizontalOpen.wgsl +75 -0
  294. package/wgsl/InvertedPageCurl.wgsl +690 -0
  295. package/wgsl/LeftRight.wgsl +109 -0
  296. package/wgsl/LinearBlur.wgsl +131 -0
  297. package/wgsl/Mosaic.wgsl +174 -0
  298. package/wgsl/Overexposure.wgsl +102 -0
  299. package/wgsl/PolkaDotsCurtain.wgsl +83 -0
  300. package/wgsl/PuzzleRight.wgsl +230 -0
  301. package/wgsl/Radial.wgsl +74 -0
  302. package/wgsl/Rectangle.wgsl +100 -0
  303. package/wgsl/RectangleCrop.wgsl +98 -0
  304. package/wgsl/Revolve_Left.wgsl +314 -0
  305. package/wgsl/Rolls.wgsl +181 -0
  306. package/wgsl/RotateScaleVanish.wgsl +199 -0
  307. package/wgsl/SimpleFlip.wgsl +82 -0
  308. package/wgsl/SimpleZoom.wgsl +85 -0
  309. package/wgsl/SimpleZoomOut.wgsl +96 -0
  310. package/wgsl/Slides.wgsl +216 -0
  311. package/wgsl/StarWipe.wgsl +169 -0
  312. package/wgsl/StaticFade.wgsl +159 -0
  313. package/wgsl/StereoViewer.wgsl +625 -0
  314. package/wgsl/StripDatamoshGlitch.wgsl +755 -0
  315. package/wgsl/Swirl.wgsl +124 -0
  316. package/wgsl/TVStatic.wgsl +106 -0
  317. package/wgsl/TilesWave.wgsl +262 -0
  318. package/wgsl/TopBottom.wgsl +109 -0
  319. package/wgsl/VerticalClose.wgsl +72 -0
  320. package/wgsl/VerticalOpen.wgsl +75 -0
  321. package/wgsl/WaterDrop.wgsl +98 -0
  322. package/wgsl/ZoomInCircles.wgsl +138 -0
  323. package/wgsl/ZoomLeftWipe.wgsl +121 -0
  324. package/wgsl/ZoomRigthWipe.wgsl +121 -0
  325. package/wgsl/angular.wgsl +83 -0
  326. package/wgsl/burn.wgsl +74 -0
  327. package/wgsl/burn0.wgsl +198 -0
  328. package/wgsl/cannabisleaf.wgsl +92 -0
  329. package/wgsl/chessboard.wgsl +116 -0
  330. package/wgsl/circle.wgsl +87 -0
  331. package/wgsl/circleopen.wgsl +96 -0
  332. package/wgsl/colorphase.wgsl +77 -0
  333. package/wgsl/coord-from-in.wgsl +83 -0
  334. package/wgsl/crosshatch.wgsl +96 -0
  335. package/wgsl/crosswarp.wgsl +75 -0
  336. package/wgsl/cube.wgsl +217 -0
  337. package/wgsl/directional-easing.wgsl +83 -0
  338. package/wgsl/directionalwarp.wgsl +92 -0
  339. package/wgsl/directionalwipe.wgsl +91 -0
  340. package/wgsl/displacement.wgsl +96 -0
  341. package/wgsl/dissolve.wgsl +116 -0
  342. package/wgsl/doorway.wgsl +174 -0
  343. package/wgsl/fade.wgsl +67 -0
  344. package/wgsl/fadecolor.wgsl +75 -0
  345. package/wgsl/fadegrayscale.wgsl +93 -0
  346. package/wgsl/flyeye.wgsl +105 -0
  347. package/wgsl/fragment.wgsl +227 -0
  348. package/wgsl/heart.wgsl +103 -0
  349. package/wgsl/hexagonalize.wgsl +238 -0
  350. package/wgsl/kaleidoscope.wgsl +124 -0
  351. package/wgsl/luma.wgsl +80 -0
  352. package/wgsl/luminance_melt.wgsl +299 -0
  353. package/wgsl/morph.wgsl +103 -0
  354. package/wgsl/mosaic_transition.wgsl +107 -0
  355. package/wgsl/multiply_blend.wgsl +96 -0
  356. package/wgsl/old_tv_lost_signal.wgsl +142 -0
  357. package/wgsl/parametric_glitch.wgsl +124 -0
  358. package/wgsl/perlin.wgsl +174 -0
  359. package/wgsl/pinwheel.wgsl +84 -0
  360. package/wgsl/pixelize.wgsl +105 -0
  361. package/wgsl/polar_function.wgsl +88 -0
  362. package/wgsl/powerKaleido.wgsl +254 -0
  363. package/wgsl/randomNoisex.wgsl +85 -0
  364. package/wgsl/randomsquares.wgsl +87 -0
  365. package/wgsl/ripple.wgsl +85 -0
  366. package/wgsl/rotateTransition.wgsl +85 -0
  367. package/wgsl/rotate_scale_fade.wgsl +138 -0
  368. package/wgsl/scale-in.wgsl +79 -0
  369. package/wgsl/splitSlideInHorizontal.wgsl +118 -0
  370. package/wgsl/splitSlideInOutHorizontal.wgsl +109 -0
  371. package/wgsl/splitSlideInOutVertical.wgsl +109 -0
  372. package/wgsl/splitSlideInVertical.wgsl +115 -0
  373. package/wgsl/splitSlideOutHorizontal.wgsl +102 -0
  374. package/wgsl/splitSlideOutVertical.wgsl +102 -0
  375. package/wgsl/squareswire.wgsl +115 -0
  376. package/wgsl/squeeze.wgsl +105 -0
  377. package/wgsl/static_wipe.wgsl +117 -0
  378. package/wgsl/swap.wgsl +218 -0
  379. package/wgsl/tangentMotionBlur.wgsl +503 -0
  380. package/wgsl/undulatingBurnOut.wgsl +181 -0
  381. package/wgsl/wind.wgsl +101 -0
  382. package/wgsl/windowblinds.wgsl +79 -0
  383. package/wgsl/windowslice.wgsl +80 -0
  384. package/wgsl/wipeDown.wgsl +77 -0
  385. package/wgsl/wipeLeft.wgsl +77 -0
  386. package/wgsl/wipeRight.wgsl +77 -0
  387. package/wgsl/wipeUp.wgsl +77 -0
  388. package/wgsl/x_axis_translation.wgsl +82 -0
  389. package/wgsl/zoomInOut.wgsl +94 -0
@@ -0,0 +1,111 @@
1
+ // coord-from-in — MSL, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/coord-from-in.glsl
2
+ // Author: haiyoucuv
3
+ // License: MIT
4
+ // Description: A crossfade in which the colors of one image displace the other
5
+ // Bindings and uniform layout: see the gl-transitions package README
6
+
7
+ // language: metal1.0
8
+ #include <metal_stdlib>
9
+ #include <simd/simd.h>
10
+
11
+ using metal::uint;
12
+
13
+ struct Uniforms {
14
+ float progress;
15
+ float ratio;
16
+ };
17
+
18
+ metal::float4 getFromColor(
19
+ thread metal::float2& uv,
20
+ metal::texture2d<float, metal::access::sample> _from,
21
+ metal::sampler _sampler
22
+ ) {
23
+ float _e13 = uv[0u];
24
+ float _e15 = uv[1u];
25
+ metal::float4 _e18 = _from.sample(_sampler, metal::float2(_e13, 1.0 - _e15), metal::level(0.0));
26
+ return _e18;
27
+ }
28
+
29
+ metal::float4 getToColor(
30
+ thread metal::float2& uv_1,
31
+ metal::sampler _sampler,
32
+ metal::texture2d<float, metal::access::sample> _to
33
+ ) {
34
+ float _e13 = uv_1[0u];
35
+ float _e15 = uv_1[1u];
36
+ metal::float4 _e18 = _to.sample(_sampler, metal::float2(_e13, 1.0 - _e15), metal::level(0.0));
37
+ return _e18;
38
+ }
39
+
40
+ metal::float4 transition(
41
+ thread metal::float2& uv_2,
42
+ metal::texture2d<float, metal::access::sample> _from,
43
+ metal::sampler _sampler,
44
+ metal::texture2d<float, metal::access::sample> _to,
45
+ constant Uniforms& uniforms
46
+ ) {
47
+ metal::float4 coordTo = {};
48
+ metal::float2 param = {};
49
+ metal::float4 coordFrom = {};
50
+ metal::float2 param_1 = {};
51
+ metal::float2 param_2 = {};
52
+ metal::float2 param_3 = {};
53
+ metal::float2 _e18 = uv_2;
54
+ param = _e18;
55
+ metal::float4 _e19 = getToColor(param, _sampler, _to);
56
+ coordTo = _e19;
57
+ metal::float2 _e20 = uv_2;
58
+ param_1 = _e20;
59
+ metal::float4 _e21 = getFromColor(param_1, _from, _sampler);
60
+ coordFrom = _e21;
61
+ metal::float2 _e22 = uv_2;
62
+ metal::float4 _e23 = coordTo;
63
+ float _e26 = uniforms.progress;
64
+ param_2 = metal::mix(_e22, _e23.xy, metal::float2(_e26));
65
+ metal::float4 _e29 = getFromColor(param_2, _from, _sampler);
66
+ metal::float4 _e30 = coordFrom;
67
+ metal::float2 _e32 = uv_2;
68
+ float _e34 = uniforms.progress;
69
+ param_3 = metal::mix(_e30.xy, _e32, metal::float2(_e34));
70
+ metal::float4 _e37 = getToColor(param_3, _sampler, _to);
71
+ float _e39 = uniforms.progress;
72
+ return metal::mix(_e29, _e37, metal::float4(_e39));
73
+ }
74
+
75
+ void main_1(
76
+ metal::texture2d<float, metal::access::sample> _from,
77
+ metal::sampler _sampler,
78
+ metal::texture2d<float, metal::access::sample> _to,
79
+ constant Uniforms& uniforms,
80
+ thread metal::float4& _fragColor,
81
+ thread metal::float2& _uv_1
82
+ ) {
83
+ metal::float2 param_4 = {};
84
+ metal::float2 _e12 = _uv_1;
85
+ param_4 = _e12;
86
+ metal::float4 _e13 = transition(param_4, _from, _sampler, _to, uniforms);
87
+ _fragColor = _e13;
88
+ return;
89
+ }
90
+
91
+ struct main_Input {
92
+ metal::float2 _uv [[user(loc0), center_perspective]];
93
+ };
94
+ struct main_Output {
95
+ metal::float4 member [[color(0)]];
96
+ };
97
+ fragment main_Output main_(
98
+ main_Input varyings [[stage_in]]
99
+ , metal::texture2d<float, metal::access::sample> _from [[texture(0)]]
100
+ , metal::sampler _sampler [[sampler(0)]]
101
+ , metal::texture2d<float, metal::access::sample> _to [[texture(1)]]
102
+ , constant Uniforms& uniforms [[buffer(0)]]
103
+ ) {
104
+ metal::float4 _fragColor = {};
105
+ metal::float2 _uv_1 = {};
106
+ const auto _uv = varyings._uv;
107
+ _uv_1 = _uv;
108
+ main_1(_from, _sampler, _to, uniforms, _fragColor, _uv_1);
109
+ metal::float4 _e3 = _fragColor;
110
+ return main_Output { _e3 };
111
+ }
@@ -0,0 +1,126 @@
1
+ // crosshatch — MSL, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/crosshatch.glsl
2
+ // Author: pthrasher
3
+ // License: MIT
4
+ // Description: The incoming image appears through a crosshatch of lines spreading from the center
5
+ // Bindings and uniform layout: see the gl-transitions package README
6
+
7
+ // language: metal1.0
8
+ #include <metal_stdlib>
9
+ #include <simd/simd.h>
10
+
11
+ using metal::uint;
12
+
13
+ struct Uniforms {
14
+ float progress;
15
+ float ratio;
16
+ metal::float2 center;
17
+ float threshold;
18
+ float fadeEdge;
19
+ };
20
+
21
+ metal::float4 getToColor(
22
+ thread metal::float2& uv,
23
+ metal::sampler _sampler,
24
+ metal::texture2d<float, metal::access::sample> _to
25
+ ) {
26
+ float _e20 = uv[0u];
27
+ float _e22 = uv[1u];
28
+ metal::float4 _e25 = _to.sample(_sampler, metal::float2(_e20, 1.0 - _e22), metal::level(0.0));
29
+ return _e25;
30
+ }
31
+
32
+ metal::float4 getFromColor(
33
+ thread metal::float2& uv_1,
34
+ metal::texture2d<float, metal::access::sample> _from,
35
+ metal::sampler _sampler
36
+ ) {
37
+ float _e20 = uv_1[0u];
38
+ float _e22 = uv_1[1u];
39
+ metal::float4 _e25 = _from.sample(_sampler, metal::float2(_e20, 1.0 - _e22), metal::level(0.0));
40
+ return _e25;
41
+ }
42
+
43
+ float rand(
44
+ thread metal::float2& co
45
+ ) {
46
+ metal::float2 _e19 = co;
47
+ return metal::fract(metal::sin(metal::dot(_e19, metal::float2(12.9898, 78.233))) * 43758.547);
48
+ }
49
+
50
+ metal::float4 transition(
51
+ thread metal::float2& p,
52
+ metal::texture2d<float, metal::access::sample> _from,
53
+ metal::sampler _sampler,
54
+ metal::texture2d<float, metal::access::sample> _to,
55
+ constant Uniforms& uniforms
56
+ ) {
57
+ float dist = {};
58
+ float r = {};
59
+ metal::float2 param = {};
60
+ metal::float2 param_1 = {};
61
+ metal::float2 param_2 = {};
62
+ metal::float2 param_3 = {};
63
+ metal::float2 _e26 = uniforms.center;
64
+ metal::float2 _e27 = p;
65
+ float _e30 = uniforms.threshold;
66
+ dist = metal::distance(_e26, _e27) / _e30;
67
+ float _e33 = uniforms.progress;
68
+ float _e35 = p[1u];
69
+ param = metal::float2(_e35, 0.0);
70
+ float _e37 = rand(param);
71
+ float _e39 = p[0u];
72
+ param_1 = metal::float2(0.0, _e39);
73
+ float _e41 = rand(param_1);
74
+ r = _e33 - metal::min(_e37, _e41);
75
+ metal::float2 _e44 = p;
76
+ param_2 = _e44;
77
+ metal::float4 _e45 = getFromColor(param_2, _from, _sampler);
78
+ metal::float2 _e46 = p;
79
+ param_3 = _e46;
80
+ metal::float4 _e47 = getToColor(param_3, _sampler, _to);
81
+ float _e48 = dist;
82
+ float _e49 = r;
83
+ float _e52 = uniforms.fadeEdge;
84
+ float _e55 = uniforms.progress;
85
+ float _e59 = uniforms.fadeEdge;
86
+ float _e61 = uniforms.progress;
87
+ return metal::mix(_e45, _e47, metal::float4(metal::mix(0.0, metal::mix(metal::step(_e48, _e49), 1.0, metal::smoothstep(1.0 - _e52, 1.0, _e55)), metal::smoothstep(0.0, _e59, _e61))));
88
+ }
89
+
90
+ void main_1(
91
+ metal::texture2d<float, metal::access::sample> _from,
92
+ metal::sampler _sampler,
93
+ metal::texture2d<float, metal::access::sample> _to,
94
+ constant Uniforms& uniforms,
95
+ thread metal::float4& _fragColor,
96
+ thread metal::float2& _uv_1
97
+ ) {
98
+ metal::float2 param_4 = {};
99
+ metal::float2 _e19 = _uv_1;
100
+ param_4 = _e19;
101
+ metal::float4 _e20 = transition(param_4, _from, _sampler, _to, uniforms);
102
+ _fragColor = _e20;
103
+ return;
104
+ }
105
+
106
+ struct main_Input {
107
+ metal::float2 _uv [[user(loc0), center_perspective]];
108
+ };
109
+ struct main_Output {
110
+ metal::float4 member [[color(0)]];
111
+ };
112
+ fragment main_Output main_(
113
+ main_Input varyings [[stage_in]]
114
+ , metal::texture2d<float, metal::access::sample> _from [[texture(0)]]
115
+ , metal::sampler _sampler [[sampler(0)]]
116
+ , metal::texture2d<float, metal::access::sample> _to [[texture(1)]]
117
+ , constant Uniforms& uniforms [[buffer(0)]]
118
+ ) {
119
+ metal::float4 _fragColor = {};
120
+ metal::float2 _uv_1 = {};
121
+ const auto _uv = varyings._uv;
122
+ _uv_1 = _uv;
123
+ main_1(_from, _sampler, _to, uniforms, _fragColor, _uv_1);
124
+ metal::float4 _e3 = _fragColor;
125
+ return main_Output { _e3 };
126
+ }
@@ -0,0 +1,103 @@
1
+ // crosswarp — MSL, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/crosswarp.glsl
2
+ // Author: Eke Péter <peterekepeter@gmail.com>
3
+ // License: MIT
4
+ // Description: The outgoing image zooms in while the incoming one zooms out into place, sweeping from right to left
5
+ // Bindings and uniform layout: see the gl-transitions package README
6
+
7
+ // language: metal1.0
8
+ #include <metal_stdlib>
9
+ #include <simd/simd.h>
10
+
11
+ using metal::uint;
12
+
13
+ struct Uniforms {
14
+ float progress;
15
+ float ratio;
16
+ };
17
+
18
+ metal::float4 getToColor(
19
+ thread metal::float2& uv,
20
+ metal::sampler _sampler,
21
+ metal::texture2d<float, metal::access::sample> _to
22
+ ) {
23
+ float _e15 = uv[0u];
24
+ float _e17 = uv[1u];
25
+ metal::float4 _e20 = _to.sample(_sampler, metal::float2(_e15, 1.0 - _e17), metal::level(0.0));
26
+ return _e20;
27
+ }
28
+
29
+ metal::float4 getFromColor(
30
+ thread metal::float2& uv_1,
31
+ metal::texture2d<float, metal::access::sample> _from,
32
+ metal::sampler _sampler
33
+ ) {
34
+ float _e15 = uv_1[0u];
35
+ float _e17 = uv_1[1u];
36
+ metal::float4 _e20 = _from.sample(_sampler, metal::float2(_e15, 1.0 - _e17), metal::level(0.0));
37
+ return _e20;
38
+ }
39
+
40
+ metal::float4 transition(
41
+ thread metal::float2& p,
42
+ metal::texture2d<float, metal::access::sample> _from,
43
+ metal::sampler _sampler,
44
+ metal::texture2d<float, metal::access::sample> _to,
45
+ constant Uniforms& uniforms
46
+ ) {
47
+ float x = {};
48
+ metal::float2 param = {};
49
+ metal::float2 param_1 = {};
50
+ float _e18 = uniforms.progress;
51
+ x = _e18;
52
+ float _e19 = x;
53
+ float _e22 = p[0u];
54
+ x = metal::smoothstep(0.0, 1.0, ((_e19 * 2.0) + _e22) - 1.0);
55
+ metal::float2 _e26 = p;
56
+ float _e29 = x;
57
+ param = ((_e26 - metal::float2(0.5)) * (1.0 - _e29)) + metal::float2(0.5);
58
+ metal::float4 _e34 = getFromColor(param, _from, _sampler);
59
+ metal::float2 _e35 = p;
60
+ float _e38 = x;
61
+ param_1 = ((_e35 - metal::float2(0.5)) * _e38) + metal::float2(0.5);
62
+ metal::float4 _e42 = getToColor(param_1, _sampler, _to);
63
+ float _e43 = x;
64
+ return metal::mix(_e34, _e42, metal::float4(_e43));
65
+ }
66
+
67
+ void main_1(
68
+ metal::texture2d<float, metal::access::sample> _from,
69
+ metal::sampler _sampler,
70
+ metal::texture2d<float, metal::access::sample> _to,
71
+ constant Uniforms& uniforms,
72
+ thread metal::float4& _fragColor,
73
+ thread metal::float2& _uv_1
74
+ ) {
75
+ metal::float2 param_2 = {};
76
+ metal::float2 _e14 = _uv_1;
77
+ param_2 = _e14;
78
+ metal::float4 _e15 = transition(param_2, _from, _sampler, _to, uniforms);
79
+ _fragColor = _e15;
80
+ return;
81
+ }
82
+
83
+ struct main_Input {
84
+ metal::float2 _uv [[user(loc0), center_perspective]];
85
+ };
86
+ struct main_Output {
87
+ metal::float4 member [[color(0)]];
88
+ };
89
+ fragment main_Output main_(
90
+ main_Input varyings [[stage_in]]
91
+ , metal::texture2d<float, metal::access::sample> _from [[texture(0)]]
92
+ , metal::sampler _sampler [[sampler(0)]]
93
+ , metal::texture2d<float, metal::access::sample> _to [[texture(1)]]
94
+ , constant Uniforms& uniforms [[buffer(0)]]
95
+ ) {
96
+ metal::float4 _fragColor = {};
97
+ metal::float2 _uv_1 = {};
98
+ const auto _uv = varyings._uv;
99
+ _uv_1 = _uv;
100
+ main_1(_from, _sampler, _to, uniforms, _fragColor, _uv_1);
101
+ metal::float4 _e3 = _fragColor;
102
+ return main_Output { _e3 };
103
+ }
package/msl/cube.metal ADDED
@@ -0,0 +1,259 @@
1
+ // cube — MSL, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/cube.glsl
2
+ // Author: gre
3
+ // License: MIT
4
+ // Description: The two images are faces of a rotating 3D cube, with a floor reflection
5
+ // Bindings and uniform layout: see the gl-transitions package README
6
+
7
+ // language: metal1.0
8
+ #include <metal_stdlib>
9
+ #include <simd/simd.h>
10
+
11
+ using metal::uint;
12
+
13
+ struct Uniforms {
14
+ float progress;
15
+ float ratio;
16
+ float persp;
17
+ float unzoom;
18
+ float reflection;
19
+ float floating;
20
+ };
21
+
22
+ metal::float4 getToColor(
23
+ thread metal::float2& uv,
24
+ metal::sampler _sampler,
25
+ metal::texture2d<float, metal::access::sample> _to
26
+ ) {
27
+ float _e27 = uv[0u];
28
+ float _e29 = uv[1u];
29
+ metal::float4 _e32 = _to.sample(_sampler, metal::float2(_e27, 1.0 - _e29), metal::level(0.0));
30
+ return _e32;
31
+ }
32
+
33
+ metal::float4 getFromColor(
34
+ thread metal::float2& uv_1,
35
+ metal::texture2d<float, metal::access::sample> _from,
36
+ metal::sampler _sampler
37
+ ) {
38
+ float _e27 = uv_1[0u];
39
+ float _e29 = uv_1[1u];
40
+ metal::float4 _e32 = _from.sample(_sampler, metal::float2(_e27, 1.0 - _e29), metal::level(0.0));
41
+ return _e32;
42
+ }
43
+
44
+ bool inBounds(
45
+ thread metal::float2& p
46
+ ) {
47
+ bool phi_109_ = {};
48
+ metal::float2 _e26 = p;
49
+ bool _e28 = metal::all(metal::float2(0.0, 0.0) < _e26);
50
+ phi_109_ = _e28;
51
+ if (_e28) {
52
+ metal::float2 _e29 = p;
53
+ phi_109_ = metal::all(_e29 < metal::float2(1.0, 1.0));
54
+ }
55
+ bool _e33 = phi_109_;
56
+ return _e33;
57
+ }
58
+
59
+ metal::float2 project(
60
+ thread metal::float2& p_1,
61
+ constant Uniforms& uniforms
62
+ ) {
63
+ metal::float2 _e26 = p_1;
64
+ float _e29 = uniforms.floating;
65
+ return (_e26 * metal::float2(1.0, -1.2)) + metal::float2(0.0, -(_e29) / 100.0);
66
+ }
67
+
68
+ metal::float4 bgColor(
69
+ thread metal::float2& p_2,
70
+ thread metal::float2& pfr,
71
+ thread metal::float2& pto,
72
+ metal::texture2d<float, metal::access::sample> _from,
73
+ metal::sampler _sampler,
74
+ metal::texture2d<float, metal::access::sample> _to,
75
+ constant Uniforms& uniforms
76
+ ) {
77
+ metal::float4 c = {};
78
+ metal::float2 param = {};
79
+ metal::float2 param_1 = {};
80
+ metal::float2 param_2 = {};
81
+ metal::float2 param_3 = {};
82
+ metal::float2 param_4 = {};
83
+ metal::float2 param_5 = {};
84
+ c = metal::float4(0.0, 0.0, 0.0, 1.0);
85
+ metal::float2 _e35 = pfr;
86
+ param = _e35;
87
+ metal::float2 _e36 = project(param, uniforms);
88
+ pfr = _e36;
89
+ metal::float2 _e37 = pfr;
90
+ param_1 = _e37;
91
+ bool _e38 = inBounds(param_1);
92
+ if (_e38) {
93
+ metal::float2 _e39 = pfr;
94
+ param_2 = _e39;
95
+ metal::float4 _e40 = getFromColor(param_2, _from, _sampler);
96
+ float _e42 = uniforms.reflection;
97
+ float _e44 = pfr[1u];
98
+ metal::float4 _e49 = c;
99
+ c = _e49 + metal::mix(metal::float4(0.0, 0.0, 0.0, 0.0), _e40, metal::float4(_e42 * metal::mix(1.0, 0.0, _e44)));
100
+ }
101
+ metal::float2 _e51 = pto;
102
+ param_3 = _e51;
103
+ metal::float2 _e52 = project(param_3, uniforms);
104
+ pto = _e52;
105
+ metal::float2 _e53 = pto;
106
+ param_4 = _e53;
107
+ bool _e54 = inBounds(param_4);
108
+ if (_e54) {
109
+ metal::float2 _e55 = pto;
110
+ param_5 = _e55;
111
+ metal::float4 _e56 = getToColor(param_5, _sampler, _to);
112
+ float _e58 = uniforms.reflection;
113
+ float _e60 = pto[1u];
114
+ metal::float4 _e65 = c;
115
+ c = _e65 + metal::mix(metal::float4(0.0, 0.0, 0.0, 0.0), _e56, metal::float4(_e58 * metal::mix(1.0, 0.0, _e60)));
116
+ }
117
+ metal::float4 _e67 = c;
118
+ return _e67;
119
+ }
120
+
121
+ metal::float2 xskew(
122
+ thread metal::float2& p_3,
123
+ thread float& persp,
124
+ thread float& center
125
+ ) {
126
+ float x = {};
127
+ float _e30 = p_3[0u];
128
+ float _e32 = p_3[0u];
129
+ float _e34 = center;
130
+ x = metal::mix(_e30, 1.0 - _e32, _e34);
131
+ float _e36 = x;
132
+ float _e38 = p_3[1u];
133
+ float _e39 = persp;
134
+ float _e42 = x;
135
+ float _e45 = persp;
136
+ float _e47 = x;
137
+ float _e52 = center;
138
+ float _e57 = center;
139
+ float _e60 = center;
140
+ float _e66 = center;
141
+ return ((metal::float2(_e36, (_e38 - ((0.5 * (1.0 - _e39)) * _e42)) / (1.0 + ((_e45 - 1.0) * _e47))) - metal::float2(0.5 - metal::abs(_e52 - 0.5), 0.0)) * metal::float2((0.5 / metal::abs(_e57 - 0.5)) * ((_e60 < 0.5) ? 1.0 : -1.0), 1.0)) + metal::float2((_e66 < 0.5) ? 0.0 : 1.0, 0.0);
142
+ }
143
+
144
+ metal::float4 transition(
145
+ thread metal::float2& op,
146
+ metal::texture2d<float, metal::access::sample> _from,
147
+ metal::sampler _sampler,
148
+ metal::texture2d<float, metal::access::sample> _to,
149
+ constant Uniforms& uniforms
150
+ ) {
151
+ float uz = {};
152
+ metal::float2 p_4 = {};
153
+ metal::float2 fromP = {};
154
+ metal::float2 param_6 = {};
155
+ float param_7 = {};
156
+ float param_8 = {};
157
+ metal::float2 toP = {};
158
+ metal::float2 param_9 = {};
159
+ float param_10 = {};
160
+ float param_11 = {};
161
+ metal::float2 param_12 = {};
162
+ metal::float2 param_13 = {};
163
+ metal::float2 param_14 = {};
164
+ metal::float2 param_15 = {};
165
+ metal::float2 param_16 = {};
166
+ metal::float2 param_17 = {};
167
+ metal::float2 param_18 = {};
168
+ float _e44 = uniforms.unzoom;
169
+ float _e47 = uniforms.progress;
170
+ uz = (_e44 * 2.0) * (0.5 - metal::abs(0.5 - _e47));
171
+ float _e51 = uz;
172
+ float _e54 = uz;
173
+ metal::float2 _e56 = op;
174
+ p_4 = metal::float2(-(_e51) * 0.5) + (_e56 * (1.0 + _e54));
175
+ metal::float2 _e60 = p_4;
176
+ float _e62 = uniforms.progress;
177
+ float _e66 = uniforms.progress;
178
+ float _e71 = uniforms.progress;
179
+ float _e73 = uniforms.persp;
180
+ param_6 = (_e60 - metal::float2(_e62, 0.0)) / metal::float2(1.0 - _e66, 1.0);
181
+ param_7 = 1.0 - metal::mix(_e71, 0.0, _e73);
182
+ param_8 = 0.0;
183
+ metal::float2 _e76 = xskew(param_6, param_7, param_8);
184
+ fromP = _e76;
185
+ metal::float2 _e77 = p_4;
186
+ float _e79 = uniforms.progress;
187
+ float _e83 = uniforms.progress;
188
+ float _e86 = uniforms.persp;
189
+ param_9 = _e77 / metal::float2(_e79, 1.0);
190
+ param_10 = metal::mix(metal::pow(_e83, 2.0), 1.0, _e86);
191
+ param_11 = 1.0;
192
+ metal::float2 _e88 = xskew(param_9, param_10, param_11);
193
+ toP = _e88;
194
+ metal::float2 _e89 = fromP;
195
+ param_12 = _e89;
196
+ bool _e90 = inBounds(param_12);
197
+ if (_e90) {
198
+ metal::float2 _e91 = fromP;
199
+ param_13 = _e91;
200
+ metal::float4 _e92 = getFromColor(param_13, _from, _sampler);
201
+ return _e92;
202
+ } else {
203
+ metal::float2 _e93 = toP;
204
+ param_14 = _e93;
205
+ bool _e94 = inBounds(param_14);
206
+ if (_e94) {
207
+ metal::float2 _e95 = toP;
208
+ param_15 = _e95;
209
+ metal::float4 _e96 = getToColor(param_15, _sampler, _to);
210
+ return _e96;
211
+ }
212
+ }
213
+ metal::float2 _e97 = op;
214
+ param_16 = _e97;
215
+ metal::float2 _e98 = fromP;
216
+ param_17 = _e98;
217
+ metal::float2 _e99 = toP;
218
+ param_18 = _e99;
219
+ metal::float4 _e100 = bgColor(param_16, param_17, param_18, _from, _sampler, _to, uniforms);
220
+ return _e100;
221
+ }
222
+
223
+ void main_1(
224
+ metal::texture2d<float, metal::access::sample> _from,
225
+ metal::sampler _sampler,
226
+ metal::texture2d<float, metal::access::sample> _to,
227
+ constant Uniforms& uniforms,
228
+ thread metal::float4& _fragColor,
229
+ thread metal::float2& _uv_1
230
+ ) {
231
+ metal::float2 param_19 = {};
232
+ metal::float2 _e26 = _uv_1;
233
+ param_19 = _e26;
234
+ metal::float4 _e27 = transition(param_19, _from, _sampler, _to, uniforms);
235
+ _fragColor = _e27;
236
+ return;
237
+ }
238
+
239
+ struct main_Input {
240
+ metal::float2 _uv [[user(loc0), center_perspective]];
241
+ };
242
+ struct main_Output {
243
+ metal::float4 member [[color(0)]];
244
+ };
245
+ fragment main_Output main_(
246
+ main_Input varyings [[stage_in]]
247
+ , metal::texture2d<float, metal::access::sample> _from [[texture(0)]]
248
+ , metal::sampler _sampler [[sampler(0)]]
249
+ , metal::texture2d<float, metal::access::sample> _to [[texture(1)]]
250
+ , constant Uniforms& uniforms [[buffer(0)]]
251
+ ) {
252
+ metal::float4 _fragColor = {};
253
+ metal::float2 _uv_1 = {};
254
+ const auto _uv = varyings._uv;
255
+ _uv_1 = _uv;
256
+ main_1(_from, _sampler, _to, uniforms, _fragColor, _uv_1);
257
+ metal::float4 _e3 = _fragColor;
258
+ return main_Output { _e3 };
259
+ }
@@ -0,0 +1,111 @@
1
+ // directional-easing — MSL, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/directional-easing.glsl
2
+ // Author: Max Plotnikov
3
+ // License: MIT
4
+ // Description: Like Directional, with an eased movement
5
+ // Bindings and uniform layout: see the gl-transitions package README
6
+
7
+ // language: metal1.0
8
+ #include <metal_stdlib>
9
+ #include <simd/simd.h>
10
+
11
+ using metal::uint;
12
+
13
+ struct Uniforms {
14
+ float progress;
15
+ float ratio;
16
+ metal::float2 direction;
17
+ };
18
+
19
+ metal::float4 getFromColor(
20
+ thread metal::float2& uv,
21
+ metal::texture2d<float, metal::access::sample> _from,
22
+ metal::sampler _sampler
23
+ ) {
24
+ float _e15 = uv[0u];
25
+ float _e17 = uv[1u];
26
+ metal::float4 _e20 = _from.sample(_sampler, metal::float2(_e15, 1.0 - _e17), metal::level(0.0));
27
+ return _e20;
28
+ }
29
+
30
+ metal::float4 getToColor(
31
+ thread metal::float2& uv_1,
32
+ metal::sampler _sampler,
33
+ metal::texture2d<float, metal::access::sample> _to
34
+ ) {
35
+ float _e15 = uv_1[0u];
36
+ float _e17 = uv_1[1u];
37
+ metal::float4 _e20 = _to.sample(_sampler, metal::float2(_e15, 1.0 - _e17), metal::level(0.0));
38
+ return _e20;
39
+ }
40
+
41
+ metal::float4 transition(
42
+ thread metal::float2& uv_2,
43
+ metal::texture2d<float, metal::access::sample> _from,
44
+ metal::sampler _sampler,
45
+ metal::texture2d<float, metal::access::sample> _to,
46
+ constant Uniforms& uniforms
47
+ ) {
48
+ float easing = {};
49
+ metal::float2 p = {};
50
+ metal::float2 f = {};
51
+ metal::float2 param = {};
52
+ metal::float2 param_1 = {};
53
+ float _e20 = uniforms.progress;
54
+ float _e23 = uniforms.progress;
55
+ easing = metal::sqrt((2.0 - _e20) * _e23);
56
+ metal::float2 _e26 = uv_2;
57
+ float _e27 = easing;
58
+ metal::float2 _e29 = uniforms.direction;
59
+ p = _e26 + (metal::sign(_e29) * _e27);
60
+ metal::float2 _e33 = p;
61
+ f = metal::fract(_e33);
62
+ metal::float2 _e35 = f;
63
+ param = _e35;
64
+ metal::float4 _e36 = getToColor(param, _sampler, _to);
65
+ metal::float2 _e37 = f;
66
+ param_1 = _e37;
67
+ metal::float4 _e38 = getFromColor(param_1, _from, _sampler);
68
+ float _e40 = p[1u];
69
+ float _e43 = p[1u];
70
+ float _e47 = p[0u];
71
+ float _e51 = p[0u];
72
+ return metal::mix(_e36, _e38, metal::float4(((metal::step(0.0, _e40) * metal::step(_e43, 1.0)) * metal::step(0.0, _e47)) * metal::step(_e51, 1.0)));
73
+ }
74
+
75
+ void main_1(
76
+ metal::texture2d<float, metal::access::sample> _from,
77
+ metal::sampler _sampler,
78
+ metal::texture2d<float, metal::access::sample> _to,
79
+ constant Uniforms& uniforms,
80
+ thread metal::float4& _fragColor,
81
+ thread metal::float2& _uv_1
82
+ ) {
83
+ metal::float2 param_2 = {};
84
+ metal::float2 _e14 = _uv_1;
85
+ param_2 = _e14;
86
+ metal::float4 _e15 = transition(param_2, _from, _sampler, _to, uniforms);
87
+ _fragColor = _e15;
88
+ return;
89
+ }
90
+
91
+ struct main_Input {
92
+ metal::float2 _uv [[user(loc0), center_perspective]];
93
+ };
94
+ struct main_Output {
95
+ metal::float4 member [[color(0)]];
96
+ };
97
+ fragment main_Output main_(
98
+ main_Input varyings [[stage_in]]
99
+ , metal::texture2d<float, metal::access::sample> _from [[texture(0)]]
100
+ , metal::sampler _sampler [[sampler(0)]]
101
+ , metal::texture2d<float, metal::access::sample> _to [[texture(1)]]
102
+ , constant Uniforms& uniforms [[buffer(0)]]
103
+ ) {
104
+ metal::float4 _fragColor = {};
105
+ metal::float2 _uv_1 = {};
106
+ const auto _uv = varyings._uv;
107
+ _uv_1 = _uv;
108
+ main_1(_from, _sampler, _to, uniforms, _fragColor, _uv_1);
109
+ metal::float4 _e3 = _fragColor;
110
+ return main_Output { _e3 };
111
+ }