diff --git a/app/web/src/components/Hero/AssetWithGooey.tsx b/app/web/src/components/Hero/AssetWithGooey.tsx index 3f9b084..3b861cd 100644 --- a/app/web/src/components/Hero/AssetWithGooey.tsx +++ b/app/web/src/components/Hero/AssetWithGooey.tsx @@ -9,11 +9,9 @@ import { useTexture, MeshDistortMaterial, Sphere } from '@react-three/drei' const thresholdAngle = 10 export default function AssetWithGooey({ assetUrl, - offset, scale, }: { assetUrl: string - offset: number[] scale: number }) { const geo = useLoader(STLLoader, assetUrl) @@ -22,7 +20,7 @@ export default function AssetWithGooey({ const mesh = useEdgeSplit((thresholdAngle * Math.PI) / 180, true, geo) const colorMap = useTexture(texture) const edges = React.useMemo(() => new THREE.EdgesGeometry(geo, 12), [geo]) - const position = [offset[0], offset[1], 5] + const position = [0, 0, 5] const scaleArr = Array.from({ length: 3 }).map(() => scale) const { mouse } = useThree() const [rEuler, rQuaternion] = useMemo( diff --git a/app/web/src/components/Hero/Hero.tsx b/app/web/src/components/Hero/Hero.tsx index 0d2defc..97fdc3a 100644 --- a/app/web/src/components/Hero/Hero.tsx +++ b/app/web/src/components/Hero/Hero.tsx @@ -13,153 +13,217 @@ import ProjectsCell from 'src/components/ProjectsCell' import OutBound from 'src/components/OutBound/OutBound' // dynamic import to enable pre-render iof the homepage -const Coffee = React.lazy(() => import('src/components/Hero/AssetWithGooey')) +const AssetWithGooey = React.lazy(() => import('src/components/Hero/AssetWithGooey')) +const cqCode = `from cadquery import * -export const Hero = () => { - const [width, widthSetter] = React.useState(1024) +d1 = 58.5 +d2 = 56.5 +d3 = 63.5 +d4 = 84 +d5 = 88 - React.useEffect(() => { - const onResize = () => { - widthSetter(window.innerWidth) - } - window.addEventListener('resize', onResize) - onResize() - return () => { - window.removeEventListener('resize', onResize) - } - }, []) - const { heroOffset, tutOffset } = React.useMemo(() => { - if (width < 1024) { - return { - heroOffset: [0, -3], - tutOffset: [0, -3], +h1 = 8.5 +h2 = 154 + +l1 = 14.5 +l2 = 4.5 + +cup = ( + Workplane("XY").circle(d1 / 2).extrude(h1) + .faces(">Z").circle(d3 / 2) + .workplane(offset=h2).circle(d5 / 2) + .loft() + .cut(Workplane("XY") + .circle((d3 - 3.5) / 2) + .workplane(offset=h2).circle((d5 - 3.5) / 2) + .loft() + .translate([0, 0, h1]) + ) +`.split('\n') + +const scadCode = `hingeHalfExtrudeLength=hingeLength/2-clearance/2; +mountingHoleMoveIncrement=(hingeLength-2*mountingHoleEdgeOffset)/ + (mountingHoleCount-1); + +module costomizerEnd() {} +$fn=30; +tiny=0.005; +// modules +module hingeBaseProfile() { + translate([pivotRadius,0,0]){ + square([baseWidth,baseThickness]); + } +} + +module hingeBodyHalf() { + difference() { + union() { + linear_extrude(hingeHalfExtrudeLength){ + offset(1)offset(-2)offset(1){ + translate([0,pivotRadius,0]){ + circle(pivotRadius); + } + square([pivotRadius,pivotRadius]); + hingeBaseProfile(); + } + } + linear_extrude(hingeLength){ + offset(1)offset(-1)hingeBaseProfile(); } } - return { - heroOffset: [-5, 0], - tutOffset: [4, 0], - } - }, [width]) + plateHoles(); + } +}`.split('\n') +export const Hero = () => { return (
+ {cqCode.map((line, index) => {index+1}{line})}
+
+
+
- - We want you to learn Code-CAD today so it can change the way you - work tomorrow. Our community is writing tutorials to make this - powerful paradigm more accessible to people new to code and CAD. -
-
+ {scadCode.map((line, index) => {index+1}{line})}
+
- + We want you to learn Code-CAD today so it can change the way you + work tomorrow. Our community is writing tutorials to make this + powerful paradigm more accessible to people new to code and CAD. +
+